diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..306cc78 --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,44 @@ +name: Build and Deploy + +on: + push: + branches: [main] + +jobs: + build-and-deploy: + runs-on: docker + steps: + - name: Checkout code + uses: https://data.forgejo.org/actions/checkout@v4 + + - name: Login to registry + run: | + echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.lilastudy.com -u "${{ secrets.REGISTRY_USER }}" --password-stdin + + - name: Build API image + run: | + docker build \ + -t git.lilastudy.com/forgejo-lila/lila-api:latest \ + --target runner \ + -f apps/api/Dockerfile . + + - name: Build Web image + run: | + docker build \ + -t git.lilastudy.com/forgejo-lila/lila-web:latest \ + --target production \ + --build-arg VITE_API_URL=https://api.lilastudy.com \ + -f apps/web/Dockerfile . + + - name: Push images + run: | + docker push git.lilastudy.com/forgejo-lila/lila-api:latest + docker push git.lilastudy.com/forgejo-lila/lila-web:latest + + - name: Deploy via SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \ + "cd ~/lila-app && docker compose pull api web && docker compose up -d api web && docker image prune -f" diff --git a/documentation/notes.md b/documentation/notes.md index ef5357f..7d1b801 100644 --- a/documentation/notes.md +++ b/documentation/notes.md @@ -7,6 +7,10 @@ ## problems+thoughts +### IMPORTANT + +verify if hetzner domain needs to be pushed, theres a change on hetzner and some domains need to be migrated + ### docker credential helper WARNING! Your credentials are stored unencrypted in '/home/languagedev/.docker/config.json'. @@ -15,7 +19,8 @@ https://docs.docker.com/go/credential-store/ ### vps setup -monitoring and logging (eg via chrootkit or rkhunter, logwatch/monit => mails daily with summary) +- monitoring and logging (eg via chrootkit or rkhunter, logwatch/monit => mails daily with summary) +- keep the vps clean (e.g. old docker images/containers) ### cd/ci pipeline