Skip to content

Commit 374172f

Browse files
committed
refactor: docker compose file and container naming
1 parent ccfffb9 commit 374172f

File tree

6 files changed

+23
-55
lines changed

6 files changed

+23
-55
lines changed

docker-compose-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: "3.8"
33
services:
44
nixopus-test-db:
55
image: postgres:14-alpine
6-
container_name: nixopus-test-db-container
6+
container_name: nixopus-test-db
77
ports:
88
- "${TEST_DB_PORT:-5433}:5432"
99
restart: unless-stopped

docker-compose.yml

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,28 @@ version: "3.8"
33
services:
44
nixopus-api:
55
image: ghcr.io/${GITHUB_REPOSITORY:-raghavyuva/nixopus}-api:latest
6-
container_name: nixopus-api-container
6+
container_name: nixopus-api
77
ports:
88
- "${API_PORT:-8443}:${API_PORT:-8443}"
99
restart: unless-stopped
1010
env_file:
11-
- /etc/nixopus/source/api/.env
11+
- ${NIXOPUS_HOME:-/etc/nixopus}/source/api/.env
1212
environment:
1313
- HOST_NAME=nixopus-db
1414
volumes:
1515
- ./logs:/app/logs
16-
- ${DOCKER_CERT_PATH:-/etc/nixopus/docker-certs}:/etc/nixopus/docker-certs
17-
- ${SSH_PRIVATE_KEY:-/etc/nixopus/ssh/id_rsa}:/etc/nixopus/ssh/id_rsa
18-
- ${MOUNT_PATH:-/etc/nixopus/configs}:/etc/nixopus/configs
16+
- ${NIXOPUS_HOME:-/etc/nixopus}:/etc/nixopus
1917
- /var/run/docker.sock:/var/run/docker.sock
20-
- /etc/nixopus/source/api/.env:/app/.env
18+
- ${NIXOPUS_HOME:-/etc/nixopus}/source/api/.env:/app/.env
2119
networks:
2220
- nixopus-network
2321
depends_on:
2422
nixopus-db:
2523
condition: service_healthy
2624

27-
nixopus-redis:
28-
image: redis:7-alpine
29-
container_name: nixopus-redis-container
30-
restart: unless-stopped
31-
ports:
32-
- "${REDIS_PORT:-6379}:6379"
33-
volumes:
34-
- ${REDIS_VOLUME:-/etc/nixopus/redis}:/data
35-
command: redis-server --appendonly yes
36-
networks:
37-
- nixopus-network
38-
healthcheck:
39-
test: ["CMD", "redis-cli", "ping"]
40-
interval: 5s
41-
timeout: 5s
42-
retries: 5
43-
4425
nixopus-db:
4526
image: postgres:14-alpine
46-
container_name: nixopus-db-container
27+
container_name: nixopus-db
4728
restart: unless-stopped
4829
environment:
4930
- POSTGRES_USER=${USERNAME}
@@ -53,7 +34,7 @@ services:
5334
ports:
5435
- "${DB_PORT:-5432}:5432"
5536
volumes:
56-
- ${DB_VOLUME:-/etc/nixopus/db}:/var/lib/postgresql/data
37+
- ${NIXOPUS_HOME:-/etc/nixopus}/db:/var/lib/postgresql/data
5738
networks:
5839
- nixopus-network
5940
healthcheck:
@@ -62,47 +43,34 @@ services:
6243
timeout: 5s
6344
retries: 5
6445

65-
# nixopus-test-db:
66-
# image: postgres:14-alpine
67-
# container_name: nixopus-test-db-container
68-
# ports:
69-
# - "${TEST_DB_PORT:-5433}:5432"
70-
# restart: unless-stopped
71-
# environment:
72-
# - POSTGRES_USER=${TEST_DB_USERNAME:-nixopus}
73-
# - POSTGRES_PASSWORD=${TEST_DB_PASSWORD:-nixopus}
74-
# - POSTGRES_DB=${TEST_DB_NAME:-nixopus_test}
75-
# networks:
76-
# - nixopus-network
77-
7846
nixopus-view:
7947
image: ghcr.io/${GITHUB_REPOSITORY:-raghavyuva/nixopus}-view:latest
80-
container_name: nixopus-view-container
48+
container_name: nixopus-view
8149
build:
8250
args:
8351
- NEXT_PUBLIC_PORT=${NEXT_PUBLIC_PORT}
8452
ports:
8553
- "${NEXT_PUBLIC_PORT:-7443}:${NEXT_PUBLIC_PORT:-7443}"
8654
restart: unless-stopped
8755
env_file:
88-
- /etc/nixopus/source/view/.env
56+
- ${NIXOPUS_HOME:-/etc/nixopus}/source/view/.env
8957
volumes:
9058
- ./logs:/app/logs
91-
- /etc/nixopus/source/view/.env:/app/.env
59+
- ${NIXOPUS_HOME:-/etc/nixopus}/source/view/.env:/app/.env
9260
networks:
9361
- nixopus-network
9462

9563
nixopus-caddy:
9664
image: caddy:latest
97-
container_name: nixopus-caddy-container
65+
container_name: nixopus-caddy
9866
ports:
9967
- "2019:2019"
10068
- "80:80"
10169
- "443:443"
10270
volumes:
103-
- /etc/nixopus/source/helpers/Caddyfile:/etc/caddy/Caddyfile
104-
- ${CADDY_DATA_VOLUME:-/etc/nixopus/caddy}:/data
105-
- ${CADDY_CONFIG_VOLUME:-/etc/nixopus/caddy}:/config
71+
- ${NIXOPUS_HOME:-/etc/nixopus}/source/helpers/Caddyfile:/etc/caddy/Caddyfile
72+
- ${NIXOPUS_HOME:-/etc/nixopus}/caddy:/data
73+
- ${NIXOPUS_HOME:-/etc/nixopus}/caddy:/config
10674
command:
10775
[
10876
"caddy",

docs/contributing/docker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ Create specialized image variants:
514514
time docker-compose up -d api
515515

516516
# Check resource usage
517-
docker stats nixopus-api-container
517+
docker stats nixopus-api
518518
```
519519

520520
3. **Security Scanning**

docs/contributing/self-hosting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ When enhancing the installation process:
281281
self._stop_services()
282282

283283
print(f"Restoring database from {backup_path}...")
284-
container_name = "nixopus-db-container"
284+
container_name = "nixopus-db"
285285
command = [
286286
"docker", "exec", "-i", container_name,
287287
"pg_restore", "-U", "nixopus", "-d", "nixopus",

helpers/config.dev.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ services:
3838
REDIS_PORT: ${REDIS_PORT:-6379}
3939
REDIS_VOLUME: ${REDIS_VOLUME:-./redis}
4040
REDIS_IMAGE: ${REDIS_IMAGE:-redis:7-alpine}
41-
REDIS_CONTAINER_NAME: ${REDIS_CONTAINER_NAME:-nixopus-redis-container}
41+
REDIS_CONTAINER_NAME: ${REDIS_CONTAINER_NAME:-nixopus-redis}
4242

4343
db:
4444
env:
4545
DB_PORT: ${DB_PORT:-5432}
4646
DB_VOLUME: ${DB_VOLUME:-./db}
4747
DB_IMAGE: ${DB_IMAGE:-postgres:14-alpine}
48-
DB_CONTAINER_NAME: ${DB_CONTAINER_NAME:-nixopus-db-container}
48+
DB_CONTAINER_NAME: ${DB_CONTAINER_NAME:-nixopus-db}
4949
POSTGRES_USER: ${USERNAME:-postgres}
5050
POSTGRES_PASSWORD: ${PASSWORD:-changeme}
5151
POSTGRES_DB: ${DB_NAME:-postgres}

helpers/config.prod.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
API_ENV_FILE: ${API_ENV_FILE:-/etc/nixopus/source/api/.env}
2525
API_VOLUME: ${API_VOLUME:-/etc/nixopus/configs}
2626
API_IMAGE: ${API_IMAGE:-ghcr.io/raghavyuva/nixopus-api:latest}
27-
API_CONTAINER_NAME: ${API_CONTAINER_NAME:-nixopus-api-container}
27+
API_CONTAINER_NAME: ${API_CONTAINER_NAME:-nixopus-api}
2828
DOCKER_PORT: ${DOCKER_PORT:-2376}
2929
APP_VERSION: ${APP_VERSION:-0.1.0-alpha.11}
3030
view:
@@ -37,21 +37,21 @@ services:
3737
LOGS_PATH: ${LOGS_PATH:-./logs}
3838
VIEW_ENV_FILE: ${VIEW_ENV_FILE:-/etc/nixopus/source/view/.env}
3939
VIEW_IMAGE: ${VIEW_IMAGE:-ghcr.io/raghavyuva/nixopus-view:latest}
40-
VIEW_CONTAINER_NAME: ${VIEW_CONTAINER_NAME:-nixopus-view-container}
40+
VIEW_CONTAINER_NAME: ${VIEW_CONTAINER_NAME:-nixopus-view}
4141

4242
redis:
4343
env:
4444
REDIS_PORT: ${REDIS_PORT:-6379}
4545
REDIS_VOLUME: ${REDIS_VOLUME:-/etc/nixopus/redis}
4646
REDIS_IMAGE: ${REDIS_IMAGE:-redis:7-alpine}
47-
REDIS_CONTAINER_NAME: ${REDIS_CONTAINER_NAME:-nixopus-redis-container}
47+
REDIS_CONTAINER_NAME: ${REDIS_CONTAINER_NAME:-nixopus-redis}
4848

4949
db:
5050
env:
5151
DB_PORT: ${DB_PORT:-5432}
5252
DB_VOLUME: ${DB_VOLUME:-/etc/nixopus/db}
5353
DB_IMAGE: ${DB_IMAGE:-postgres:14-alpine}
54-
DB_CONTAINER_NAME: ${DB_CONTAINER_NAME:-nixopus-db-container}
54+
DB_CONTAINER_NAME: ${DB_CONTAINER_NAME:-nixopus-db}
5555
POSTGRES_USER: ${USERNAME:-postgres}
5656
POSTGRES_PASSWORD: ${PASSWORD:-changeme}
5757
POSTGRES_DB: ${DB_NAME:-postgres}
@@ -60,7 +60,7 @@ services:
6060
caddy:
6161
env:
6262
CADDY_IMAGE: ${CADDY_IMAGE:-caddy:latest}
63-
CADDY_CONTAINER_NAME: ${CADDY_CONTAINER_NAME:-nixopus-caddy-container}
63+
CADDY_CONTAINER_NAME: ${CADDY_CONTAINER_NAME:-nixopus-caddy}
6464
CADDY_DATA_VOLUME: ${CADDY_DATA_VOLUME:-/etc/nixopus/caddy}
6565
CADDY_CONFIG_VOLUME: ${CADDY_CONFIG_VOLUME:-/etc/nixopus/caddy}
6666
CADDY_PORTS: "2019:2019,80:80,443:443"

0 commit comments

Comments
 (0)