Skip to content

Commit 17e4f61

Browse files
committed
Refactor postgres docker setup and update docs (#190)
1 parent 747e091 commit 17e4f61

File tree

7 files changed

+65
-50
lines changed

7 files changed

+65
-50
lines changed

.github/workflows/publish-docker-images.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ jobs:
3838
with:
3939
images: ${{ env.REGISTRY }}/${{ env.REPO_LOWER }}
4040

41+
- name: Build and push Postgres image
42+
uses: docker/build-push-action@v5
43+
with:
44+
context: .
45+
file: src/Databases/AliasServerDb/Dockerfile
46+
push: true
47+
tags: ${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-postgres:latest,${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-postgres:${{ github.ref_name }}
48+
4149
- name: Build and push API image
4250
uses: docker/build-push-action@v5
4351
with:
@@ -62,6 +70,14 @@ jobs:
6270
push: true
6371
tags: ${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-admin:latest,${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-admin:${{ github.ref_name }}
6472

73+
- name: Build and push Reverse Proxy image
74+
uses: docker/build-push-action@v5
75+
with:
76+
context: .
77+
file: Dockerfile
78+
push: true
79+
tags: ${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-reverse-proxy:latest,${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-reverse-proxy:${{ github.ref_name }}
80+
6581
- name: Build and push SMTP image
6682
uses: docker/build-push-action@v5
6783
with:
@@ -78,14 +94,6 @@ jobs:
7894
push: true
7995
tags: ${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-task-runner:latest,${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-task-runner:${{ github.ref_name }}
8096

81-
- name: Build and push Reverse Proxy image
82-
uses: docker/build-push-action@v5
83-
with:
84-
context: .
85-
file: Dockerfile
86-
push: true
87-
tags: ${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-reverse-proxy:latest,${{ env.REGISTRY }}/${{ env.REPO_LOWER }}-reverse-proxy:${{ github.ref_name }}
88-
8997
- name: Build and push InstallCli image
9098
uses: docker/build-push-action@v5
9199
with:

docker-compose.build.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
services:
2-
reverse-proxy:
3-
image: aliasvault-reverse-proxy
2+
postgres:
3+
image: aliasvault-postgres
44
build:
55
context: .
6-
dockerfile: Dockerfile
6+
dockerfile: src/Databases/AliasServerDb/Dockerfile
77

88
client:
99
image: aliasvault-client
@@ -23,6 +23,12 @@ services:
2323
context: .
2424
dockerfile: src/AliasVault.Admin/Dockerfile
2525

26+
reverse-proxy:
27+
image: aliasvault-reverse-proxy
28+
build:
29+
context: .
30+
dockerfile: Dockerfile
31+
2632
smtp:
2733
image: aliasvault-smtp
2834
build:
@@ -34,9 +40,3 @@ services:
3440
build:
3541
context: .
3642
dockerfile: src/Services/AliasVault.TaskRunner/Dockerfile
37-
38-
postgres:
39-
image: aliasvault-postgres
40-
build:
41-
context: .
42-
dockerfile: Dockerfile.postgres

docker-compose.yml

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
services:
2-
reverse-proxy:
3-
image: ghcr.io/lanedirt/aliasvault-reverse-proxy:latest
4-
ports:
5-
- "${HTTP_PORT:-80}:80"
6-
- "${HTTPS_PORT:-443}:443"
2+
postgres:
3+
image: ghcr.io/lanedirt/aliasvault-postgres:latest
74
volumes:
8-
- ./certificates/ssl:/etc/nginx/ssl:rw
9-
- ./certificates/letsencrypt:/etc/nginx/ssl-letsencrypt:rw
10-
- ./certificates/letsencrypt/www:/var/www/certbot:rw
11-
depends_on:
12-
- admin
13-
- client
14-
- api
15-
- smtp
16-
restart: always
5+
- ./database/postgres:/var/lib/postgresql/data:rw
176
env_file:
187
- .env
8+
restart: always
9+
healthcheck:
10+
test: ["CMD-SHELL", "pg_isready -U aliasvault"]
11+
interval: 5s
12+
timeout: 5s
13+
retries: 5
14+
start_period: 10s
1915

2016
client:
2117
image: ghcr.io/lanedirt/aliasvault-client:latest
@@ -61,6 +57,24 @@ services:
6157
environment:
6258
ConnectionStrings__AliasServerDbContext: "Host=postgres;Database=aliasvault;Username=aliasvault;Password=${POSTGRES_PASSWORD}"
6359

60+
reverse-proxy:
61+
image: ghcr.io/lanedirt/aliasvault-reverse-proxy:latest
62+
ports:
63+
- "${HTTP_PORT:-80}:80"
64+
- "${HTTPS_PORT:-443}:443"
65+
volumes:
66+
- ./certificates/ssl:/etc/nginx/ssl:rw
67+
- ./certificates/letsencrypt:/etc/nginx/ssl-letsencrypt:rw
68+
- ./certificates/letsencrypt/www:/var/www/certbot:rw
69+
depends_on:
70+
- admin
71+
- client
72+
- api
73+
- smtp
74+
restart: always
75+
env_file:
76+
- .env
77+
6478
smtp:
6579
image: ghcr.io/lanedirt/aliasvault-smtp:latest
6680
ports:
@@ -90,18 +104,4 @@ services:
90104
postgres:
91105
condition: service_healthy
92106
environment:
93-
ConnectionStrings__AliasServerDbContext: "Host=postgres;Database=aliasvault;Username=aliasvault;Password=${POSTGRES_PASSWORD}"
94-
95-
postgres:
96-
image: ghcr.io/lanedirt/aliasvault-postgres:latest
97-
volumes:
98-
- ./database/postgres:/var/lib/postgresql/data:rw
99-
env_file:
100-
- .env
101-
restart: always
102-
healthcheck:
103-
test: ["CMD-SHELL", "pg_isready -U aliasvault"]
104-
interval: 5s
105-
timeout: 5s
106-
retries: 5
107-
start_period: 10s
107+
ConnectionStrings__AliasServerDbContext: "Host=postgres;Database=aliasvault;Username=aliasvault;Password=${POSTGRES_PASSWORD}"

docs/misc/release/create-new-release.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ nav_order: 1
1010

1111
Follow the steps in the checklist below to prepare a new release.
1212

13+
## Versioning
1314
- [ ] Update ./src/Shared/AliasVault.Shared.Core/AppInfo.cs and update major/minor/patch to the new version. This version will be shown in the client and admin app footer.
1415
- [ ] Update ./install.sh `@version` in header if the install script has changed. This allows the install script to self-update when running ./install.sh update command on default installations.
15-
- [ ] Update README screenshots if applicable
16-
- [ ] Update README current/upcoming features
1716

18-
Optional steps:
17+
## Docker Images
18+
If docker containers have been added or removed:
19+
- [ ] Verify that `publish-docker-images.yml` contains all docker images that need to be published.
20+
- [ ] Update `install.sh` and verify that the `images()` array that takes care of pulling the images from the GitHub Container Registry is updated.
21+
22+
## Documentation
1923
- [ ] Update /docs instructions if any changes have been made to the setup process
24+
- [ ] Update README screenshots if applicable
25+
- [ ] Update README current/upcoming features

install.sh

+1
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,7 @@ handle_install_version() {
14521452
printf "${CYAN}> Installing version: ${target_version}${NC}\n"
14531453

14541454
images=(
1455+
"${GITHUB_CONTAINER_REGISTRY}-postgres:${target_version}"
14551456
"${GITHUB_CONTAINER_REGISTRY}-reverse-proxy:${target_version}"
14561457
"${GITHUB_CONTAINER_REGISTRY}-api:${target_version}"
14571458
"${GITHUB_CONTAINER_REGISTRY}-client:${target_version}"
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM postgres:16-alpine
22

33
# Add any custom PostgreSQL configurations if needed
4-
COPY postgresql.conf /etc/postgresql/postgresql.conf
4+
COPY src/Databases/AliasServerDb/postgresql.conf /etc/postgresql/postgresql.conf
55

66
CMD ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
File renamed without changes.

0 commit comments

Comments
 (0)