This commit is contained in:
commit
479e3d5cf9
10 changed files with 466 additions and 0 deletions
64
.forgejo/workflows/deploy.yaml
Normal file
64
.forgejo/workflows/deploy.yaml
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
name: Deploy storage stack
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: arch-latest
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pacman -Syu --noconfirm nodejs openssh rsync
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Copy compose + init scripts
|
||||
uses: easingthemes/ssh-deploy@v5.1.0
|
||||
with:
|
||||
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
REMOTE_HOST: ${{ secrets.DEPLOY_IP }}
|
||||
REMOTE_USER: ${{ secrets.DEPLOY_USER }}
|
||||
SOURCE: "docker-compose.yml init/"
|
||||
TARGET: "/opt/storage/"
|
||||
|
||||
- name: Write .env from secrets and bring stack up
|
||||
uses: appleboy/ssh-action@v1.2.3
|
||||
env:
|
||||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
||||
MINIO_ROOT_USER: ${{ secrets.MINIO_ROOT_USER }}
|
||||
MINIO_ROOT_PASSWORD: ${{ secrets.MINIO_ROOT_PASSWORD }}
|
||||
ASXPIO_DB_PASSWORD: ${{ secrets.ASXPIO_DB_PASSWORD }}
|
||||
ASXPIO_S3_ACCESS_KEY: ${{ secrets.ASXPIO_S3_ACCESS_KEY }}
|
||||
ASXPIO_S3_SECRET_KEY: ${{ secrets.ASXPIO_S3_SECRET_KEY }}
|
||||
with:
|
||||
host: ${{ secrets.DEPLOY_IP }}
|
||||
username: ${{ secrets.DEPLOY_USER }}
|
||||
key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
envs: POSTGRES_PASSWORD,MINIO_ROOT_USER,MINIO_ROOT_PASSWORD,ASXPIO_DB_PASSWORD,ASXPIO_S3_ACCESS_KEY,ASXPIO_S3_SECRET_KEY
|
||||
script_stop: true
|
||||
script: |
|
||||
umask 077
|
||||
mkdir -p /opt/storage
|
||||
cat > /opt/storage/.env <<EOF
|
||||
POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
|
||||
MINIO_ROOT_USER=${MINIO_ROOT_USER}
|
||||
MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
|
||||
ASXPIO_DB_PASSWORD=${ASXPIO_DB_PASSWORD}
|
||||
ASXPIO_S3_ACCESS_KEY=${ASXPIO_S3_ACCESS_KEY}
|
||||
ASXPIO_S3_SECRET_KEY=${ASXPIO_S3_SECRET_KEY}
|
||||
EOF
|
||||
chmod 600 /opt/storage/.env
|
||||
chmod +x /opt/storage/init/postgres-init.sh /opt/storage/init/minio-bootstrap.sh
|
||||
|
||||
cd /opt/storage
|
||||
docker compose pull
|
||||
docker compose up -d postgres minio
|
||||
# Run init containers (idempotent) and wait for them to exit.
|
||||
docker compose up --exit-code-from postgres-init postgres-init
|
||||
docker compose up --exit-code-from minio-init minio-init
|
||||
|
||||
echo "Storage stack deployed."
|
||||
Loading…
Add table
Add a link
Reference in a new issue