✨ Update design
This commit is contained in:
+16
-82
@@ -13,7 +13,6 @@ env:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -69,92 +68,27 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Deploy to TrueNAS
|
- name: Deploy to TrueNAS
|
||||||
env:
|
env:
|
||||||
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
|
TRUENAS_URL: ${{ secrets.TRUENAS_URL }}
|
||||||
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
|
TRUENAS_API_KEY: ${{ secrets.TRUENAS_API_KEY }}
|
||||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
|
||||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
|
||||||
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
||||||
|
|
||||||
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
|
|
||||||
BETTER_AUTH_SECRET: ${{ secrets.BETTER_AUTH_SECRET }}
|
|
||||||
BETTER_AUTH_URL: ${{ secrets.BETTER_AUTH_URL }}
|
|
||||||
RESEND_API_KEY: ${{ secrets.RESEND_API_KEY }}
|
|
||||||
STAFF_SEED_EMAIL: ${{ secrets.STAFF_SEED_EMAIL }}
|
|
||||||
STAFF_SEED_PASSWORD: ${{ secrets.STAFF_SEED_PASSWORD }}
|
|
||||||
RESERVATIONS_FROM_EMAIL: ${{ secrets.RESERVATIONS_FROM_EMAIL }}
|
|
||||||
|
|
||||||
IMAGE_TAG: ${{ github.sha }}
|
IMAGE_TAG: ${{ github.sha }}
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
mkdir -p ~/.ssh
|
echo "Deploying image:"
|
||||||
|
echo "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${IMAGE_TAG}"
|
||||||
|
|
||||||
printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key
|
# TrueNAS API deployment goes here.
|
||||||
chmod 600 ~/.ssh/deploy_key
|
#
|
||||||
|
# IMPORTANT:
|
||||||
|
# The exact JSON-RPC request depends on your TrueNAS SCALE
|
||||||
|
# version and the name of your Custom App.
|
||||||
|
#
|
||||||
|
# TRUENAS_URL should look like:
|
||||||
|
# https://truenas.example.com
|
||||||
|
#
|
||||||
|
# TRUENAS_API_KEY should be a TrueNAS API key with permission
|
||||||
|
# to update the application.
|
||||||
|
|
||||||
ssh-keyscan \
|
echo "TrueNAS deployment configuration required."
|
||||||
-p "${DEPLOY_PORT:-22}" \
|
|
||||||
-H "$DEPLOY_HOST" \
|
|
||||||
>> ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
echo "Creating deployment directory if needed..."
|
|
||||||
|
|
||||||
ssh \
|
|
||||||
-i ~/.ssh/deploy_key \
|
|
||||||
-p "${DEPLOY_PORT:-22}" \
|
|
||||||
"$DEPLOY_USER@$DEPLOY_HOST" \
|
|
||||||
"mkdir -p '$DEPLOY_PATH'"
|
|
||||||
|
|
||||||
echo "Uploading compose file..."
|
|
||||||
|
|
||||||
scp \
|
|
||||||
-i ~/.ssh/deploy_key \
|
|
||||||
-P "${DEPLOY_PORT:-22}" \
|
|
||||||
docker-compose.prod.yml \
|
|
||||||
"$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/docker-compose.yml"
|
|
||||||
|
|
||||||
echo "Deploying..."
|
|
||||||
|
|
||||||
ssh \
|
|
||||||
-i ~/.ssh/deploy_key \
|
|
||||||
-p "${DEPLOY_PORT:-22}" \
|
|
||||||
"$DEPLOY_USER@$DEPLOY_HOST" \
|
|
||||||
"POSTGRES_PASSWORD=$(printf '%q' "$POSTGRES_PASSWORD") \
|
|
||||||
BETTER_AUTH_SECRET=$(printf '%q' "$BETTER_AUTH_SECRET") \
|
|
||||||
BETTER_AUTH_URL=$(printf '%q' "$BETTER_AUTH_URL") \
|
|
||||||
RESEND_API_KEY=$(printf '%q' "$RESEND_API_KEY") \
|
|
||||||
RESERVATIONS_FROM_EMAIL=$(printf '%q' "$RESERVATIONS_FROM_EMAIL") \
|
|
||||||
STAFF_SEED_EMAIL=$(printf '%q' "$STAFF_SEED_EMAIL") \
|
|
||||||
STAFF_SEED_PASSWORD=$(printf '%q' "$STAFF_SEED_PASSWORD") \
|
|
||||||
IMAGE_TAG=$(printf '%q' "$IMAGE_TAG") \
|
|
||||||
bash -c '
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
cd \"$DEPLOY_PATH\"
|
|
||||||
|
|
||||||
echo \"Pulling images...\"
|
|
||||||
docker compose pull
|
|
||||||
|
|
||||||
echo \"Starting PostgreSQL...\"
|
|
||||||
docker compose up -d postgres
|
|
||||||
|
|
||||||
echo "Running database migrations..."
|
|
||||||
docker compose run --rm app npx drizzle-kit migrate
|
|
||||||
|
|
||||||
echo "Seeding database..."
|
|
||||||
docker compose run --rm app npm run db:seed
|
|
||||||
|
|
||||||
echo "Starting application..."
|
|
||||||
docker compose up -d
|
|
||||||
|
|
||||||
echo \"Cleaning unused images...\"
|
|
||||||
docker image prune -f
|
|
||||||
|
|
||||||
echo \"Deployment complete.\"
|
|
||||||
'"
|
|
||||||
+43
-33
@@ -1,35 +1,45 @@
|
|||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: git.lukas-harat.com/lukas/promo_steakhouse:${IMAGE_TAG:-latest}
|
image: git.lukas-harat.com/lukas/promo_rathaus:${IMAGE_TAG:-latest}
|
||||||
restart: unless-stopped
|
|
||||||
ports:
|
|
||||||
- '3003:3000'
|
|
||||||
environment:
|
|
||||||
DATABASE_URL: postgres://steakhouse:${POSTGRES_PASSWORD}@postgres:5432/steakhouse
|
|
||||||
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET}
|
|
||||||
BETTER_AUTH_URL: ${BETTER_AUTH_URL}
|
|
||||||
STAFF_SEED_EMAIL: ${STAFF_SEED_EMAIL}
|
|
||||||
STAFF_SEED_PASSWORD: ${STAFF_SEED_PASSWORD}
|
|
||||||
RESEND_API_KEY: ${RESEND_API_KEY}
|
|
||||||
RESERVATIONS_FROM_EMAIL: ${RESERVATIONS_FROM_EMAIL}
|
|
||||||
depends_on:
|
|
||||||
postgres:
|
|
||||||
condition: service_healthy
|
|
||||||
|
|
||||||
postgres:
|
restart: unless-stopped
|
||||||
image: postgres:16-alpine
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: steakhouse
|
|
||||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
||||||
POSTGRES_DB: steakhouse
|
|
||||||
volumes:
|
|
||||||
- steakhouse-postgres-data:/var/lib/postgresql/data
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD-SHELL", "pg_isready -U steakhouse -d steakhouse"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 10
|
|
||||||
|
|
||||||
volumes:
|
ports:
|
||||||
steakhouse-postgres-data:
|
- "3003:3000"
|
||||||
|
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: postgres://promo_rathaus:${POSTGRES_PASSWORD}@postgres:5432/promo_rathaus
|
||||||
|
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET}
|
||||||
|
BETTER_AUTH_URL: ${BETTER_AUTH_URL}
|
||||||
|
STAFF_SEED_EMAIL: ${STAFF_SEED_EMAIL}
|
||||||
|
STAFF_SEED_PASSWORD: ${STAFF_SEED_PASSWORD}
|
||||||
|
RESEND_API_KEY: ${RESEND_API_KEY}
|
||||||
|
RESERVATIONS_FROM_EMAIL: ${RESERVATIONS_FROM_EMAIL}
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres:16-alpine
|
||||||
|
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: promo_rathaus
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
|
POSTGRES_DB: promo_rathaus
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /mnt/YOUR_POOL/apps/promo-rathaus/postgres:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
healthcheck:
|
||||||
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL",
|
||||||
|
"pg_isready -U promo_rathaus -d promo_rathaus"
|
||||||
|
]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 10
|
||||||
|
start_period: 10s
|
||||||
+5
-5
@@ -3,13 +3,13 @@ services:
|
|||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: steakhouse
|
POSTGRES_USER: promo_rathaus
|
||||||
POSTGRES_PASSWORD: steakhouse
|
POSTGRES_PASSWORD: promo_rathaus
|
||||||
POSTGRES_DB: steakhouse
|
POSTGRES_DB: promo_rathaus
|
||||||
ports:
|
ports:
|
||||||
- '5432:5432'
|
- '5432:5432'
|
||||||
volumes:
|
volumes:
|
||||||
- steakhouse-postgres-data:/var/lib/postgresql/data
|
- promo_rathaus-postgres-data:/var/lib/postgresql/data
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
steakhouse-postgres-data:
|
promo_rathaus-postgres-data:
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ const config = defineConfig({
|
|||||||
resolve: { tsconfigPaths: true },
|
resolve: { tsconfigPaths: true },
|
||||||
plugins: [tanstackStart(), viteReact()],
|
plugins: [tanstackStart(), viteReact()],
|
||||||
preview: {
|
preview: {
|
||||||
allowedHosts: ['localhost', '127.0.0.1', 'promo-steakhouse.lukas-harat.com'],
|
allowedHosts: ['localhost', '127.0.0.1', 'promo-rathaus.lukas-harat.com'],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user