-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add test server setup and doc #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
35d8a03
b9286e5
05ff897
fb5641b
fe3ac67
2366ec6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| name: Deploy to Test | ||
|
|
||
| on: | ||
| workflow_dispatch: # For manual triggers via the GitHub Actions UI | ||
| inputs: | ||
| image-tag: | ||
| type: string | ||
| description: 'Image tag to deploy (default: pr-<number> if PR exists, latest for default branch)' | ||
|
|
||
| jobs: | ||
| deploy: | ||
| uses: ls1intum/.github/.github/workflows/deploy-docker-compose.yml@main | ||
| with: | ||
| environment: Test | ||
| docker-compose-file: './docker/test/docker-compose.yml' | ||
| main-image-name: ls1intum/memo/memo-app | ||
| image-tag: ${{ inputs.image-tag }} | ||
| env-file-name: ./docker/test/.env | ||
| remove-volumes: false | ||
| secrets: inherit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| version: '3.8' | ||
|
|
||
| name: memo-test | ||
|
|
||
| services: | ||
| nginx: | ||
| container_name: memo-test-nginx | ||
| image: nginx:alpine | ||
| ports: | ||
| - '80:80' | ||
| - '443:443' | ||
| volumes: | ||
| - ./nginx.conf:/etc/nginx/nginx.conf:ro | ||
| - /etc/letsencrypt:/etc/letsencrypt:ro | ||
| - /var/www/certbot:/var/www/certbot:ro | ||
| depends_on: | ||
| - app | ||
| networks: | ||
| - memo-test-network | ||
| restart: unless-stopped | ||
|
|
||
| app: | ||
| container_name: memo-test-app | ||
| image: 'ghcr.io/ls1intum/memo/memo-app:${IMAGE_TAG:-latest}' | ||
| environment: | ||
| - NODE_ENV=production | ||
| - APP_ENV=test | ||
| - DATABASE_URL=${DATABASE_URL:-postgresql://memo_user:memo_password@db:5432/memo_test} | ||
| - NEXT_PUBLIC_APP_ENV=${NEXT_PUBLIC_APP_ENV:-test} | ||
| - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-https://memo-test1.aet.cit.tum.de/api} | ||
| expose: | ||
| - '3000' | ||
| depends_on: | ||
| - db | ||
| networks: | ||
| - memo-test-network | ||
| restart: unless-stopped | ||
|
|
||
| db: | ||
| container_name: memo-test-db | ||
| image: postgres:16-alpine | ||
| environment: | ||
| - POSTGRES_DB=memo_test | ||
| - POSTGRES_USER=memo_user | ||
| - POSTGRES_PASSWORD=memo_password | ||
|
Comment on lines
+28
to
+45
|
||
| volumes: | ||
| - postgres_test_data:/var/lib/postgresql/data | ||
| - ../../scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql | ||
| networks: | ||
| - memo-test-network | ||
| restart: unless-stopped | ||
|
|
||
| volumes: | ||
| postgres_test_data: | ||
|
|
||
| networks: | ||
| memo-test-network: | ||
| driver: bridge | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,88 @@ | ||||||
| events { | ||||||
| worker_connections 1024; | ||||||
| } | ||||||
|
|
||||||
| http { | ||||||
| upstream app { | ||||||
| server app:3000; | ||||||
| } | ||||||
|
|
||||||
| # HTTP server - redirect to HTTPS | ||||||
| server { | ||||||
| listen 80; | ||||||
| server_name memo-test1.aet.cit.tum.de; | ||||||
|
|
||||||
| # Allow Let's Encrypt ACME challenge | ||||||
| location /.well-known/acme-challenge/ { | ||||||
| root /var/www/certbot; | ||||||
| } | ||||||
|
|
||||||
| # Redirect all other HTTP traffic to HTTPS | ||||||
| location / { | ||||||
| return 301 https://$host$request_uri; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| # HTTPS server | ||||||
| server { | ||||||
| listen 443 ssl http2; | ||||||
| server_name memo-test1.aet.cit.tum.de; | ||||||
|
|
||||||
| # SSL certificates (managed by Certbot) | ||||||
| ssl_certificate /etc/letsencrypt/live/memo-test1.aet.cit.tum.de/fullchain.pem; | ||||||
| ssl_certificate_key /etc/letsencrypt/live/memo-test1.aet.cit.tum.de/privkey.pem; | ||||||
|
|
||||||
| # SSL configuration | ||||||
| ssl_protocols TLSv1.2 TLSv1.3; | ||||||
| ssl_prefer_server_ciphers on; | ||||||
| ssl_ciphers 'ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384'; | ||||||
|
|
||||||
| # Security headers | ||||||
| add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; | ||||||
| add_header X-Frame-Options "SAMEORIGIN" always; | ||||||
| add_header X-XSS-Protection "1; mode=block" always; | ||||||
| add_header X-Content-Type-Options "nosniff" always; | ||||||
| add_header Referrer-Policy "no-referrer-when-downgrade" always; | ||||||
| add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always; | ||||||
|
||||||
| add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always; | |
| add_header Content-Security-Policy "default-src 'self'; script-src 'self' http: https:; style-src 'self' http: https:; img-src 'self' data: blob: http: https:; font-src 'self' data: http: https:; connect-src 'self' http: https:; object-src 'none'" always; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checklist mentions a
docker/test/.env.examplefile, but this file was not included in the PR. This file should be created to provide a template for the test environment configuration, similar to how other environments have example or actual .env files.