Skip to content

Commit

Permalink
Add deb cross-compliation for amd64. Bump version to 5.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
elonen committed Oct 20, 2023
1 parent 61773d2 commit 3e2e876
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 84 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ clean-debian:

debian-docker:
(cd client; make debian-docker)
(cd server; make dist_deb/built.target)
(cd server; make debian-docker)
@if [ "$(shell uname -m)" != "x86_64" ]; then \
echo "We're running on non-x86_64 architecture. Building x86_64 deb, too."; \
(cd server; export TARGET_ARCH=amd64; make debian-docker); \
fi
mkdir -p dist_deb
cp client/dist_deb/* dist_deb/
cp server/dist_deb/* dist_deb/
ls -l dist_deb/

clean: clean-debian
(cd client; make clean)
(cd server; make clean)
Expand Down
7 changes: 7 additions & 0 deletions client/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
clapshot-client (0.5.6) bullseye; urgency=low

* Fix video list row spacing
* Show upload form before video list

-- Jarno Elonen <elonen@iki.fi> Thu, 19 Oct 2023 21:04:00 +0200

clapshot-client (0.5.5) bullseye; urgency=low

* Make client reload on auth error to help (re)show login screen
Expand Down
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "clapshot-client",
"private": true,
"version": "0.5.5",
"version": "0.5.6",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion server/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "clapshot-server"
version = "0.5.4"
version = "0.5.6"
edition = "2021"

description = "Clapshot video review tool (backend)"
Expand Down
162 changes: 85 additions & 77 deletions server/Makefile
Original file line number Diff line number Diff line change
@@ -1,77 +1,85 @@
.PHONY: deps clean test docker test run run-local run-docker docs default debian-local

PACKAGE_VERSION=$(shell (git rev-parse --short HEAD || date +"%Y-%m-%d" || echo "dev"))

UID=$(shell id -u)
GID=$(shell id -g)

PACKAGE=clapshot_server
SERVER_CMD=target/release/clapshot-server
DEV_DATADIR=DEV_DATADIR

default: ${SERVER_CMD}

${DEV_DATADIR}:
mkdir -p "$@"

RUST_DEPS=$(shell find src/ migrations/ Cargo.toml diesel.toml -type f)
DEB_DEPS=$(shell find debian/ README* LICENSE* -type f)

${SERVER_CMD}: ${RUST_DEPS}
cargo build --release

clean:
cargo clean
rm -rf dist_deb || sudo rm -rf dist_deb
#cd docs; make proper


docker: ${DEV_DATADIR}
@echo "-------------------------------------------------------------------------------"
@echo "NOTE! Creating current user and UID/GID in Docker so bind mount is owned by it."
@echo "Otherwise you wouldn't be able to access it without root privileges."
@echo "-------------------------------------------------------------------------------"

DOCKER_BUILDKIT=1 docker build -t ${PACKAGE}:${PACKAGE_VERSION} --build-arg USER=${USER} --build-arg UID=${UID} --build-arg GID=${GID} .
docker tag ${PACKAGE}:${PACKAGE_VERSION} ${PACKAGE}:latest


debian-local: dist_deb/built.target

dist_deb/built.target: ${SERVER_CMD} ${DEB_DEPS}
cargo install cargo-deb
cargo deb
mkdir -p dist_deb
cp target/debian/* dist_deb/
touch $@

debian-docker: ${RUST_DEPS} ${DEB_DEPS} ${ENV} docker
mkdir -p dist_deb
$(eval PKGDIR=${PACKAGE}-${PVER})
$(eval CMD="cd /app && cp -r --preserve=mode,ownership,timestamps /deb ./dist_deb && ls -l ./dist_deb && make debian-local && cp dist_deb/* /deb/ && chown -R ${UID}:${GID} /deb")
docker run --rm --mount type=bind,source="$$(pwd)/dist_deb",target="/deb" --user root ${PACKAGE}:latest bash -c ${CMD}


test-local:
cargo test

test-docker: docker
docker run --rm ${PACKAGE}:latest cargo test

test:
@echo "Please run either 'test-docker' or 'test-local'"


docs:
cd docs; make clean html
@echo "------------"
@echo "Documentation generated. See docs/_build/"

run-local: ${SERVER_CMD} ${DEV_DATADIR}
${SERVER_CMD} --url-base http://127.0.0.1:8095/ --port 8095 --data-dir ${DEV_DATADIR} --migrate --debug

run-docker: docker
docker run --rm -it -p 127.0.0.1:8095:8095 --mount type=bind,source="$$(pwd)"/${DEV_DATADIR},target=/app/${DEV_DATADIR} ${PACKAGE}:latest

run:
@echo "Please run either 'run-docker' or 'run-local'"
.PHONY: deps clean test docker test run run-local run-docker docs default debian-local

PACKAGE_VERSION=$(shell (git rev-parse --short HEAD || date +"%Y-%m-%d" || echo "dev"))

UID=$(shell id -u)
GID=$(shell id -g)

ifeq ($(TARGET_ARCH),)
ARCH=$(shell uname -m)
PLATFORM_STR =
else
ARCH = $(TARGET_ARCH)
PLATFORM_STR = --platform linux/$(TARGET_ARCH)
endif

PACKAGE=clapshot_server_${ARCH}
SERVER_CMD=target/release/clapshot-server
DEV_DATADIR=DEV_DATADIR

default: ${SERVER_CMD}

${DEV_DATADIR}:
mkdir -p "$@"

RUST_DEPS=$(shell find src/ migrations/ Cargo.toml diesel.toml -type f)
DEB_DEPS=$(shell find debian/ README* LICENSE* -type f)

${SERVER_CMD}: ${RUST_DEPS}
cargo build --release

clean:
cargo clean
rm -rf dist_deb || sudo rm -rf dist_deb
#cd docs; make proper


docker: ${DEV_DATADIR}
@echo "-------------------------------------------------------------------------------"
@echo "NOTE! Creating current user and UID/GID in Docker so bind mount is owned by it."
@echo "Otherwise you wouldn't be able to access it without root privileges."
@echo "-------------------------------------------------------------------------------"

DOCKER_BUILDKIT=1 docker build $(PLATFORM_STR) -t ${PACKAGE}:${PACKAGE_VERSION} --build-arg USER=${USER} --build-arg UID=${UID} --build-arg GID=${GID} .
docker tag ${PACKAGE}:${PACKAGE_VERSION} ${PACKAGE}:latest


debian-local: dist_deb/built.target

dist_deb/built.target: ${SERVER_CMD} ${DEB_DEPS}
cargo install cargo-deb
cargo deb
mkdir -p dist_deb
cp target/debian/* dist_deb/
touch $@

debian-docker: ${RUST_DEPS} ${DEB_DEPS} ${ENV} docker
mkdir -p dist_deb
$(eval PKGDIR=${PACKAGE}-${PVER})
$(eval CMD="cd /app && cp -r --preserve=mode,ownership,timestamps /deb ./dist_deb && ls -l ./dist_deb && make debian-local && cp dist_deb/* /deb/ && chown -R ${UID}:${GID} /deb")
docker run --rm --mount type=bind,source="$$(pwd)/dist_deb",target="/deb" --user root ${PACKAGE}:latest bash -c ${CMD}


test-local:
cargo test

test-docker: docker
docker run --rm ${PACKAGE}:latest cargo test

test:
@echo "Please run either 'test-docker' or 'test-local'"


docs:
cd docs; make clean html
@echo "------------"
@echo "Documentation generated. See docs/_build/"

run-local: ${SERVER_CMD} ${DEV_DATADIR}
${SERVER_CMD} --url-base http://127.0.0.1:8095/ --port 8095 --data-dir ${DEV_DATADIR} --migrate --debug

run-docker: docker
docker run --rm -it -p 127.0.0.1:8095:8095 --mount type=bind,source="$$(pwd)"/${DEV_DATADIR},target=/app/${DEV_DATADIR} ${PACKAGE}:latest

run:
@echo "Please run either 'run-docker' or 'run-local'"
7 changes: 7 additions & 0 deletions server/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
clapshot-server (0.5.6) bullseye; urgency=low

* Sort videos from latest to oldest
* Update libraries, bump Rust to 1.73

-- Jarno Elonen <elonen@iki.fi> Thu, 19 Oct 2023 21:04:00 +0200

clapshot-server (0.5.4) bullseye; urgency=low

* Run ffmpeg on nice 10
Expand Down

0 comments on commit 3e2e876

Please sign in to comment.