18 Commits

Author SHA1 Message Date
cbae428e26 docker) use debian user creation commands
All checks were successful
PR Checks / lint-test-and-docker-build (pull_request) Successful in 2m8s
2026-02-20 23:24:12 -05:00
e5c4cbc331 test) stabilize vitest db bootstrap in ci
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 1m10s
2026-02-20 23:21:41 -05:00
e28741a4f1 trips) migrate sqlite and runtime to bun
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Has been cancelled
2026-02-20 23:05:22 -05:00
982c84cc33 docker) build app with node instead of bun
All checks were successful
PR Checks / lint-test-and-docker-build (pull_request) Successful in 4m9s
2026-02-20 22:55:21 -05:00
82a242e362 docker) install native build tools in bun stage
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 3m47s
2026-02-20 22:48:18 -05:00
d464e71654 ci) pin node 22 for svelte tooling
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 2m39s
2026-02-20 22:42:35 -05:00
6e02e5128a ci) use js svelte config for runner compatibility
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 1m53s
2026-02-20 22:39:02 -05:00
02b3d3ca1f test) sync svelte-kit before vitest
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 2m0s
2026-02-20 22:24:33 -05:00
3455afe396 ci) run svelte-kit sync before tests
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 1m42s
2026-02-20 22:19:54 -05:00
5331a05136 ci) switch linting to biome
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 1m42s
2026-02-20 22:15:22 -05:00
2ff8a71b0c ci) use non-stylish eslint formatter in runner
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 1m59s
2026-02-20 21:49:55 -05:00
dd9d142854 ci) revert to manual checkout in workflows
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 6m16s
2026-02-20 20:53:08 -05:00
0e8ac03e07 ci) fixing checkout repo
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 6s
2026-02-20 20:50:39 -05:00
8a0094a729 ci) use cloud domain for internal actions
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 7s
2026-02-20 20:49:29 -05:00
b7c794db21 ci) use internal checkout action
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 44s
2026-02-20 20:46:13 -05:00
19a62fce8d ci) use manual checkout for gitea actions
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 6m23s
2026-02-20 20:41:12 -05:00
982f0d89be ci) fix checkout for gitea subpath
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 33s
2026-02-20 20:37:19 -05:00
0f73be45cb ci) add gitea actions and refresh readme
Some checks failed
PR Checks / lint-test-and-docker-build (pull_request) Failing after 1m42s
2026-02-20 20:15:32 -05:00
3 changed files with 4 additions and 172 deletions

View File

@@ -4,10 +4,9 @@ on:
push:
branches:
- main
workflow_dispatch:
env:
REGISTRY_HOST: registry.campbellwireless.net
REGISTRY_HOST: git.campbellwireless.net
IMAGE_NAME: ${{ github.repository }}
jobs:
@@ -51,107 +50,3 @@ jobs:
tags: |
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}:${{ steps.tags.outputs.sha_short }}
- name: Preflight Portainer deploy config
env:
PORTAINER_URL: ${{ secrets.PORTAINER_URL }}
PORTAINER_API_KEY: ${{ secrets.PORTAINER_API_KEY }}
PORTAINER_STACK_ID: ${{ secrets.PORTAINER_STACK_ID }}
PORTAINER_ENDPOINT_ID: ${{ secrets.PORTAINER_ENDPOINT_ID }}
PORTAINER_INSECURE_TLS: ${{ secrets.PORTAINER_INSECURE_TLS }}
run: |
set -eu
for required in PORTAINER_URL PORTAINER_API_KEY PORTAINER_STACK_ID PORTAINER_ENDPOINT_ID; do
if [ -z "$(eval "printf '%s' \"\${$required:-}\"")" ]; then
echo "Missing required secret: $required" >&2
exit 1
fi
done
CURL_ARGS=(--fail --show-error --silent --retry 3 --retry-all-errors)
if [ "${PORTAINER_INSECURE_TLS:-false}" = "true" ]; then
CURL_ARGS+=(--insecure)
fi
API_BASE="${PORTAINER_URL%/}/api"
ENDPOINT_JSON="$(
curl "${CURL_ARGS[@]}" \
--header "X-API-Key: ${PORTAINER_API_KEY}" \
"${API_BASE}/endpoints/${PORTAINER_ENDPOINT_ID}"
)"
echo "${ENDPOINT_JSON}" | jq -e --arg id "${PORTAINER_ENDPOINT_ID}" \
'((.Id // .id) | tostring) == $id' >/dev/null
STACK_JSON="$(
curl "${CURL_ARGS[@]}" \
--header "X-API-Key: ${PORTAINER_API_KEY}" \
"${API_BASE}/stacks/${PORTAINER_STACK_ID}?endpointId=${PORTAINER_ENDPOINT_ID}"
)"
echo "${STACK_JSON}" | jq -e --arg id "${PORTAINER_STACK_ID}" \
'((.Id // .id) | tostring) == $id' >/dev/null
echo "Portainer preflight checks passed."
- name: Trigger Portainer stack redeploy
env:
PORTAINER_URL: ${{ secrets.PORTAINER_URL }}
PORTAINER_API_KEY: ${{ secrets.PORTAINER_API_KEY }}
PORTAINER_STACK_ID: ${{ secrets.PORTAINER_STACK_ID }}
PORTAINER_ENDPOINT_ID: ${{ secrets.PORTAINER_ENDPOINT_ID }}
PORTAINER_INSECURE_TLS: ${{ secrets.PORTAINER_INSECURE_TLS }}
run: |
set -eu
for required in PORTAINER_URL PORTAINER_API_KEY PORTAINER_STACK_ID PORTAINER_ENDPOINT_ID; do
if [ -z "$(eval "printf '%s' \"\${$required:-}\"")" ]; then
echo "Missing required secret: $required" >&2
exit 1
fi
done
CURL_ARGS=(--fail --show-error --silent --retry 3 --retry-all-errors)
if [ "${PORTAINER_INSECURE_TLS:-false}" = "true" ]; then
CURL_ARGS+=(--insecure)
fi
STACK_BASE="${PORTAINER_URL%/}/api/stacks/${PORTAINER_STACK_ID}"
QUERY="endpointId=${PORTAINER_ENDPOINT_ID}"
# Git-based stacks can be redeployed directly.
if curl "${CURL_ARGS[@]}" \
--header "X-API-Key: ${PORTAINER_API_KEY}" \
--request POST \
"${STACK_BASE}/git/redeploy?${QUERY}" >/dev/null; then
echo "Portainer deploy: git stack redeploy triggered."
exit 0
fi
# Non-git stacks: fetch current stack file and redeploy with pullImage=true.
STACK_FILE_CONTENT="$(
curl "${CURL_ARGS[@]}" \
--header "X-API-Key: ${PORTAINER_API_KEY}" \
"${STACK_BASE}/file" \
| jq -r '.StackFileContent'
)"
PAYLOAD_LOWER="$(jq -cn --arg stackFileContent "${STACK_FILE_CONTENT}" \
'{stackFileContent: $stackFileContent, prune: false, pullImage: true}')"
if curl "${CURL_ARGS[@]}" \
--header "X-API-Key: ${PORTAINER_API_KEY}" \
--header "Content-Type: application/json" \
--request PUT \
--data "${PAYLOAD_LOWER}" \
"${STACK_BASE}?${QUERY}" >/dev/null; then
echo "Portainer deploy: stack updated with lower-camel payload."
exit 0
fi
PAYLOAD_UPPER="$(jq -cn --arg StackFileContent "${STACK_FILE_CONTENT}" \
'{StackFileContent: $StackFileContent, Prune: false, PullImage: true}')"
curl "${CURL_ARGS[@]}" \
--header "X-API-Key: ${PORTAINER_API_KEY}" \
--header "Content-Type: application/json" \
--request PUT \
--data "${PAYLOAD_UPPER}" \
"${STACK_BASE}?${QUERY}" >/dev/null
echo "Portainer deploy: stack updated with upper-camel payload."

View File

@@ -1,11 +0,0 @@
Hello and welcome to the trips project!
We are glad you are here. This repository exists to help you build and
improve travel experiences, and your contributions make it better for
everyone.
If you are new, start by reading the README and checking the scripts and
configuration files to understand how the project is set up. Then pick an
issue or improvement you are interested in and dive in.
Thanks for being part of the team and happy coding!

View File

@@ -79,7 +79,7 @@ The container stores SQLite data at `/data/trips.db` (mounted as the `trips-data
Workflows live in `.gitea/workflows`:
- `pr-checks.yml`: runs lint, tests, and Docker build on pull requests.
- `main-image.yml`: builds and pushes a Docker image on push to `main`, then calls the Portainer API to redeploy. It can also be run manually from the Actions UI.
- `main-image.yml`: builds and pushes a Docker image on push to `main`.
### Registry secrets for image publish
@@ -87,62 +87,10 @@ Configure these repository secrets in Gitea:
- `REGISTRY_USERNAME`
- `REGISTRY_PASSWORD`
- `PORTAINER_URL` (for example, `https://portainer.example.com`)
- `PORTAINER_API_KEY` (Portainer API key for a user with access to the stack)
- `PORTAINER_STACK_ID` (numeric stack ID in Portainer)
- `PORTAINER_ENDPOINT_ID` (numeric environment/endpoint ID in Portainer)
- `PORTAINER_INSECURE_TLS` (optional: set to `true` only if Portainer uses self-signed TLS)
By default, the publish workflow pushes to:
- `registry.campbellwireless.net/<owner>/<repo>:latest`
- `registry.campbellwireless.net/<owner>/<repo>:<short-sha>`
- `git.campbellwireless.net/<owner>/<repo>:latest`
- `git.campbellwireless.net/<owner>/<repo>:<short-sha>`
If your registry host differs, edit `REGISTRY_HOST` in `.gitea/workflows/main-image.yml`.
## Deploy with Portainer API
The `main-image.yml` workflow now calls the Portainer API after pushing `latest`.
In Portainer, create/update your stack to use a published image (not `build`), for example:
```yaml
services:
trips:
image: registry.campbellwireless.net/<owner>/<repo>:latest
container_name: trips
restart: unless-stopped
ports:
- '3000:3000'
volumes:
- trips-data:/data
env_file:
- .env
environment:
NODE_ENV: production
DATABASE_URL: file:/data/trips.db
PORT: '3000'
volumes:
trips-data:
```
Then in Portainer:
1. Create an API key from your user profile (`My account` -> `API keys`).
2. Open the stack details page and note the stack ID.
3. Open `Environments` and note the endpoint/environment ID where the stack runs.
4. Save these values in your Gitea repository secrets:
- `PORTAINER_URL`
- `PORTAINER_API_KEY`
- `PORTAINER_STACK_ID`
- `PORTAINER_ENDPOINT_ID`
- optional `PORTAINER_INSECURE_TLS=true`
Flow on each push to `main` (or manual run of `main-image.yml`):
1. Build image.
2. Push `:latest` and `:<short-sha>`.
3. Run Portainer preflight checks (auth + stack/endpoint IDs).
4. Call Portainer API.
5. Portainer redeploys the stack and pulls the updated image.