diff --git a/docker/README.md b/docker/README.md index 27c33bc..edaf0fc 100644 --- a/docker/README.md +++ b/docker/README.md @@ -14,7 +14,7 @@ log in to your Nextcloud instance. For debugging, you can show the `nextcloud.log`: ```bash -make show-log +just show-log ``` There also is a [logging web interface](http://localhost:8081/index.php/settings/admin/logging). @@ -24,5 +24,6 @@ There also is a [logging web interface](http://localhost:8081/index.php/settings In case something is broken try to reset the container: ```bash -docker compose build; docker compose down; docker volume rm nextcloud-qownnotesapi_nextcloud +just build +just reset ``` diff --git a/docker/justfile b/docker/justfile index ca022d2..b86d3e0 100644 --- a/docker/justfile +++ b/docker/justfile @@ -1,53 +1,73 @@ # Use `just ` to run a recipe # https://just.systems/man/en/ -# By default, run the `--choose` command +# By default, run the `--list` command default: - @just --choose + @just --list # Variables # Try to use "docker compose" and fall back to "docker-compose" if not available dockerComposeCommand := `docker compose > /dev/null && echo docker compose || echo docker-compose` +containerName := "nextcloud-qownnotesapi-app-1" +volumeName := "nextcloud-qownnotesapi_nextcloud" +# Aliases + +alias remove-volumes := reset + +# Check the code, run tests and sign the app all: check-code test sign-app +# Build the docker image build: {{ dockerComposeCommand }} build +# Fetch the database from the container fetch-db: {{ dockerComposeCommand }} run --rm app su -c "cp data/mydb.db apps/qownnotesapi" www-data +# Push the database to the container push-db: {{ dockerComposeCommand }} run --rm app su -c "cp apps/qownnotesapi/mydb.db* data" www-data +# Open a shell in the container bash: {{ dockerComposeCommand }} run --rm app su -c "bash" www-data +# Open a shell in the container as root bash-root: {{ dockerComposeCommand }} run --rm app bash +# Run a sidecar container with more debugging tools slim-shell: - slim debug --target nextcloud-qownnotesapi-app-1 + slim debug --target {{ containerName }} +# Turn off maintenance mode maintenance-mode-off: {{ dockerComposeCommand }} run --rm app su -c "./occ maintenance:mode --off" www-data +# Run the app:check-code command check-code: {{ dockerComposeCommand }} run --rm app su -c "./occ app:check-code qownnotesapi" www-data +# Run the app signing command for Nextcloud sign-app: {{ dockerComposeCommand }} run --rm app ../sign-app.sh www-data +# Run the app signing command for Owncloud sign-app-owncloud: {{ dockerComposeCommand }} run --rm app ../sign-app-owncloud.sh +# Run the tests test: {{ dockerComposeCommand }} run --rm app su -c "cd apps/qownnotesapi && make test" www-data +# Show Nextcloud logs show-log: {{ dockerComposeCommand }} run --rm app tail -f /var/www/html/data/nextcloud.log -remove-volumes: +# Remove the docker volume +reset: docker compose down - docker volume rm nextcloud-qownnotesapi_nextcloud + docker volume rm {{ volumeName }} diff --git a/justfile b/justfile index 8b93ba4..6a3db82 100644 --- a/justfile +++ b/justfile @@ -1,33 +1,38 @@ # Use `just ` to run a recipe # https://just.systems/man/en/ -# By default, run the `--choose` command +# By default, run the `--list` command default: - @just --choose + @just --list # Variables transferDir := `if [ -d "$HOME/NextcloudPrivate/Transfer" ]; then echo "$HOME/NextcloudPrivate/Transfer"; else echo "$HOME/Nextcloud/Transfer"; fi` # Open a terminal with the qownnotesapi session +[group('dev')] term: zellij --layout term.kdl attach qownnotesapi -c # Kill the qownnotesapi session +[group('dev')] term-kill: zellij delete-session qownnotesapi -f # Apply the patch to the qownnotesapi repository +[group('patch')] git-apply-patch: git apply {{ transferDir }}/qownnotesapi.patch # Create a patch from the staged changes in the qownnotesapi repository +[group('patch')] @git-create-patch: echo "transferDir: {{ transferDir }}" git diff --no-ext-diff --staged --binary > {{ transferDir }}/qownnotesapi.patch ls -l1t {{ transferDir }}/ | head -2 # Format all justfiles +[group('linter')] just-format: #!/usr/bin/env bash # Find all files named "justfile" recursively and run just --fmt --unstable on them