-
-
Notifications
You must be signed in to change notification settings - Fork 0
chore(staging): isolate apps VM stack for whatsapp feature work #42
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: dev
Are you sure you want to change the base?
Changes from all commits
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,10 @@ | ||
| # Copy values into /srv/secrets/instalab-staging.env (do not commit secrets) | ||
| INSTALAB_DB_TYPE=postgres | ||
| INSTALAB_DB_HOST=apps-postgres | ||
| INSTALAB_DB_PORT=5432 | ||
| INSTALAB_DB_NAME=instalab_staging | ||
| INSTALAB_DB_USER=instalab_staging | ||
| INSTALAB_DB_PASS=REPLACE_ME | ||
| INSTALAB_ENCRYPTION_KEY=REPLACE_WITH_32_BYTE_BASE64_URLSAFE_KEY | ||
| INSTALAB_SCRAPER_BACKEND=private | ||
| INSTALAB_PROXY_ENABLED=false |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| services: | ||
| instalab-api-staging: | ||
| build: | ||
| context: /srv/apps/instalab-staging | ||
| container_name: instalab-api-staging | ||
| user: "1001:1003" | ||
| command: ddtrace-run python server.py | ||
| env_file: | ||
| - /srv/secrets/instalab-staging.env | ||
| environment: | ||
| INSTALAB_ENV: /srv/secrets/instalab-staging.env | ||
| INSTALAB_DB_HOST: apps-postgres | ||
| HOME: /data/instalab/home | ||
| DD_SERVICE: instalab-api-staging | ||
| DD_ENV: homelab-staging | ||
| DD_VERSION: "1" | ||
| DD_TRACE_ENABLED: "false" | ||
| DD_DYNAMIC_INSTRUMENTATION_ENABLED: "false" | ||
| DD_TRACE_EXCLUDED_URLS: "/api/health,/api/health/detail" | ||
| DD_EXCEPTION_REPLAY_ENABLED: "false" | ||
| DD_LOGS_INJECTION: "false" | ||
| DD_RUNTIME_METRICS_ENABLED: "false" | ||
| volumes: | ||
| - /srv/apps/instalab-staging/app:/app | ||
| - /srv/secrets/instalab-staging.env:/srv/secrets/instalab-staging.env:ro | ||
| - /srv/secrets/instalab-staging-logins.json:/srv/secrets/instalab-logins.json | ||
| - /srv/secrets/instalab-staging-cookies:/data/instalab/cookies | ||
| - /srv/secrets/instalab-staging-private:/data/instalab/private | ||
| - /srv/data/instalab-staging:/data/instalab | ||
| ports: | ||
| - "192.168.4.30:5100:5000" | ||
| restart: unless-stopped | ||
| healthcheck: | ||
| test: | ||
| [ | ||
| "CMD", | ||
| "python", | ||
| "-c", | ||
| "import urllib.request; urllib.request.urlopen('http://127.0.0.1:5000/api/health', timeout=5).read()", | ||
| ] | ||
| interval: 30s | ||
| timeout: 5s | ||
| retries: 3 | ||
| start_period: 20s | ||
| networks: | ||
| - apps-db | ||
|
|
||
| instalab-ui-staging: | ||
| build: | ||
| context: /srv/apps/instalab-staging | ||
| container_name: instalab-ui-staging | ||
| user: "1001:1003" | ||
| command: /app/scripts/start_ui.sh | ||
| env_file: | ||
| - /srv/secrets/instalab-staging.env | ||
| environment: | ||
| INSTALAB_ENV: /srv/secrets/instalab-staging.env | ||
| INSTALAB_API_BASE: http://instalab-api-staging:5000/ | ||
| INSTALAB_DB_HOST: apps-postgres | ||
| DD_SERVICE: instalab-ui-staging | ||
| DD_ENV: homelab-staging | ||
| DD_VERSION: "1" | ||
| DD_TRACE_ENABLED: "false" | ||
| DD_DYNAMIC_INSTRUMENTATION_ENABLED: "false" | ||
| DD_TRACE_EXCLUDED_URLS: "/healthz/" | ||
| DD_EXCEPTION_REPLAY_ENABLED: "false" | ||
| DD_LOGS_INJECTION: "false" | ||
| DD_RUNTIME_METRICS_ENABLED: "false" | ||
| volumes: | ||
| - /srv/apps/instalab-staging/app:/app | ||
| - /srv/secrets/instalab-staging.env:/srv/secrets/instalab-staging.env:ro | ||
| ports: | ||
| - "127.0.0.1:8102:8000" | ||
| depends_on: | ||
| - instalab-api-staging | ||
| restart: unless-stopped | ||
| healthcheck: | ||
| test: | ||
| [ | ||
| "CMD", | ||
| "python", | ||
| "-c", | ||
| "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/healthz/', timeout=5).read()", | ||
| ] | ||
| interval: 30s | ||
| timeout: 5s | ||
| retries: 3 | ||
| start_period: 20s | ||
| networks: | ||
| - apps-db | ||
|
|
||
| networks: | ||
| apps-db: | ||
| external: true | ||
| name: apps-db | ||
|
Comment on lines
+1
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file is almost a complete copy of To reduce duplication and improve maintainability, consider using Docker Compose's |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||
| #!/usr/bin/env bash | ||||||
| set -euo pipefail | ||||||
| cd /srv/apps/instalab-staging | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script hardcodes the path
Suggested change
|
||||||
| docker compose -f docker-compose.staging.yml --project-name instalab-staging down | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||
| #!/usr/bin/env bash | ||||||
| set -euo pipefail | ||||||
| cd /srv/apps/instalab-staging | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script hardcodes the path
Suggested change
|
||||||
| docker compose -f docker-compose.staging.yml --project-name instalab-staging ps | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||
| #!/usr/bin/env bash | ||||||
| set -euo pipefail | ||||||
| cd /srv/apps/instalab-staging | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The script hardcodes the path
Suggested change
|
||||||
| docker compose -f docker-compose.staging.yml --project-name instalab-staging up -d --build | ||||||
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.
This Docker Compose file contains hardcoded absolute paths (e.g.,
/srv/apps/instalab-staging,/srv/secrets/...,/srv/data/...) and a hardcoded IP address (192.168.4.30). This makes the configuration brittle and not portable, as it's tied to a specific host machine setup.Consider using environment variables with default values to make these paths and the IP configurable. This would improve maintainability and reusability.
For example:
These variables could then be defined in an
.envfile.