This document explains the GitHub Actions workflows in this repository, how they run, the required secrets, and how deployments work. The workflows live in .github/workflows/ and the helper scripts are in .github/bash-scripts/.
Automated pipeline for building, testing, packaging, and deploying the application.
Stack: Java 21, Maven, PostgreSQL 16, Docker, GitHub Container Registry (GHCR).
PR → develop (CI) → merge to develop
PR → master (CI) → on merge to master run Dockerize → Deploy
- Triggers: pull requests to
developandmasterand pushes todevelop. - Runs JDK 21, starts PostgreSQL service (Postgres 16), and runs:
mvn -B clean verify- Purpose: compile, run unit and integration tests, and fail fast on regressions.
- Triggers: push/merge to
master(or a tag depending on workflow config). - Steps: run CI, build production Docker image, tag, and push to GHCR (
ghcr.io/{owner}/{repo}/bitelo-api:latest). - Requires:
GHCR_TOKENorGITHUB_TOKENwithpackages:writepermissions.
- Triggers: manual or workflow run-on-success after Dockerize (see workflow file).
- Steps: SSH to production server and run the deployment script.
- The repo contains a helper deploy script at
.github/bash-scripts/deploy.shwhich can be used or copied to the server.
Recommended server location for deploy.sh: /opt/burgerman/deploy.sh (this is where the production server script is expected to live).
What deploy.sh typically does:
- Pull latest image from GHCR
- Create Docker network if missing
- Ensure PostgreSQL container exists/starts (persistent data volume)
- Stop old app container and start the new one on port
8080
Quick server bootstrap (run on the server):
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Create deployment directory
sudo mkdir -p /opt/burgerman
sudo chown $USER:$USER /opt/burgerman
# Place the deploy script and make it executable
chmod +x /opt/burgerman/deploy.shDB_USER— PostgreSQL username used by containers or the app.DB_PASSWORD— PostgreSQL password.DB_DATABASE— Database name.GHCR_TOKEN— GitHub Package/Container Registry token (or useGITHUB_TOKENwith appropriate permissions).SERVER_HOST— Production server host/IP for SSH deploy.SERVER_USER— SSH username for deploy.SERVER_SSH_KEY— Private SSH key (set assshsecret) for the deploy user.
Additional secrets may be required by the application itself (DB URL, JWT secrets, Cloudinary keys, Tron node RPC credentials). Keep those in the repository or environment-specific secret stores.
Run the build and tests locally with Maven:
mvn clean verifyBuild the Docker image locally:
docker build -t bitelo-api:local -f Dockerfile .- PostgreSQL health checks fail: increase the startup timeout in the workflow or ensure the service image tag matches the workflow config.
- Docker push denied: confirm the token has
packages:writeandread:packagesas required. - SSH connection refused: validate
SERVER_HOST,SERVER_USER, andSERVER_SSH_KEYvalues. - Container won't start: inspect logs with
docker logs <container>.
Useful commands on the server:
docker logs bitelo-api
docker logs bitelo-db
docker ps -aTo re-run deployment manually on the server:
ssh $SERVER_USER@$SERVER_HOST
cd /opt/burgerman
./deploy.sh- Workflow files: .github/workflows/ci.yml, .github/workflows/docker.yml, .github/workflows/deploy.yml
- Deploy script: .github/bash-scripts/deploy.sh
If you want, I can:
- Generate a checklist of repository secrets from
application.yml. - Update the workflows to use a centralized
deployjob with environment protection rules.