Skip to content
Snippets Groups Projects
Unverified Commit 90529c99 authored by Daniel Einars's avatar Daniel Einars
Browse files

feat: docker house keeping


  * add specific docker network to allow gateway and subnet configuration
  * add separate location for pgAdmin in dev mode
  * add docker container names attribute in addition to service name
  * add websocket config to nginx.conf from nginx.raw
  * make network-name configurable

Signed-off-by: default avatarDaniel Einars <contact@dle.dev>
parent 44acda13
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
include librephotos.env
DOCKER_TAG ?= ownphotos-backend
REPLACE_NAMES=sed 's/__backend_name__/$(BACKEND_CONT_NAME)/g; s/__frontend_name__/$(FRONTEND_CONT_NAME)/g; s/__proxy_name__/$(PROXY_CONT_NAME)/g; s/__redis_name__/$(REDIS_CONT_NAME)/g; s/__db_name__/$(DB_CONT_NAME)/g; s/__pgadmin_name__/$(PGADMIN_CONT_NAME)/g'
REPLACE_NAMES=sed 's/__backend_name__/$(BACKEND_CONT_NAME)/g; s/__frontend_name__/$(FRONTEND_CONT_NAME)/g; s/__proxy_name__/$(PROXY_CONT_NAME)/g; s/__redis_name__/$(REDIS_CONT_NAME)/g; s/__db_name__/$(DB_CONT_NAME)/g; s/__pgadmin_name__/$(PGADMIN_CONT_NAME)/g; s/__network_name__/$(NETWORK_NAME)/g'
default: build
......
......@@ -21,6 +21,7 @@ services:
build:
context: ./proxy
dockerfile: Dockerfile
container_name: __proxy_name__
volumes:
- ${myPhotos}:/data
- ${proMedia}:/protected_media
......@@ -30,9 +31,11 @@ services:
tty: true
environment:
- DEBUG=1
- WDS_SOCKET_PORT=0 # needed for webpack-dev-server
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: __frontend_name__
volumes:
- ${codedir}/librephotos-frontend:/usr/src/app
......@@ -46,6 +49,7 @@ services:
dockerfile: Dockerfile
args:
DEBUG: 1
container_name: __backend_name__
volumes:
- ${myPhotos}:/data
- ${proMedia}:/protected_media
......@@ -59,11 +63,12 @@ services:
__pgadmin_name__:
image: dpage/pgadmin4
container_name: __pgadmin_name__
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@admin.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
volumes:
- $HOME/pgadmin:/root/.pgadmin
- ${pgAdminLocation}/pgadmin:/root/.pgadmin
ports:
- "3001:80"
restart: unless-stopped
......@@ -21,6 +21,7 @@ services:
build:
context: ./proxy
dockerfile: Dockerfile
container_name: proxy
volumes:
- ${myPhotos}:/data
- ${proMedia}:/protected_media
......@@ -34,6 +35,7 @@ services:
build:
context: ./frontend
dockerfile: Dockerfile.dev
container_name: frontend
volumes:
- ${codedir}/librephotos-frontend:/usr/src/app
......@@ -47,6 +49,7 @@ services:
dockerfile: Dockerfile
args:
DEBUG: 1
container_name: backend
volumes:
- ${myPhotos}:/data
- ${proMedia}:/protected_media
......@@ -60,11 +63,12 @@ services:
pgadmin:
image: dpage/pgadmin4
container_name: pgadmin
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-admin@admin.com}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
volumes:
- $HOME/pgadmin:/root/.pgadmin
- ${pgAdminLocation}/pgadmin:/root/.pgadmin
ports:
- "3001:80"
restart: unless-stopped
......@@ -11,6 +11,7 @@ version: "3.8"
services:
__proxy_name__:
image: reallibrephotos/librephotos-proxy:${tag}
container_name: __proxy_name__
restart: unless-stopped
volumes:
- ${myPhotos}:/data
......@@ -24,6 +25,7 @@ services:
__db_name__:
image: postgres:13
container_name: __db_name__
restart: unless-stopped
environment:
- POSTGRES_USER=${dbUser}
......@@ -35,12 +37,14 @@ services:
__frontend_name__:
image: reallibrephotos/librephotos-frontend:${tag}
container_name: __frontend_name__
restart: unless-stopped
depends_on:
- __backend_name__
__backend_name__:
image: reallibrephotos/librephotos:${tag}
container_name: __backend_name__
restart: unless-stopped
volumes:
- ${myPhotos}:/data
......@@ -75,4 +79,5 @@ services:
__redis_name__:
image: redis:6
container_name: __redis_name__
restart: unless-stopped
......@@ -11,10 +11,12 @@ version: "3.8"
services:
proxy:
image: reallibrephotos/librephotos-proxy:${tag}
container_name: proxy
restart: unless-stopped
volumes:
- ${myPhotos}:/data
- ${proMedia}:/protected_media
- ./proxy/nginx.conf:/etc/nginx/nginx.conf:ro
ports:
- ${httpPort}:80
depends_on:
......@@ -23,6 +25,7 @@ services:
db:
image: postgres:13
container_name: db
restart: unless-stopped
environment:
- POSTGRES_USER=${dbUser}
......@@ -34,12 +37,14 @@ services:
frontend:
image: reallibrephotos/librephotos-frontend:${tag}
container_name: frontend
restart: unless-stopped
depends_on:
- backend
backend:
image: reallibrephotos/librephotos:${tag}
container_name: backend
restart: unless-stopped
volumes:
- ${myPhotos}:/data
......@@ -74,4 +79,5 @@ services:
redis:
image: redis:6
container_name: redis
restart: unless-stopped
......@@ -42,7 +42,6 @@ shhhhKey=D2VymuMn2gAhx4tmAawd
#What port should Libre Photos be accessed at (Default 3000)
httpPort=3000
# ------------------------------------------------------------------------------------------------
# Wow, we are at the optional now. Pretty easy so far. You do not have to change any of the below.
......@@ -86,11 +85,20 @@ FRONTEND_CONT_NAME=frontend
PROXY_CONT_NAME=proxy
REDIS_CONT_NAME=redis
PGADMIN_CONT_NAME=pgadmin
NETWORK_NAME=libre-photos-net
# ---------------------------------------------------------------------------------------------
# If you are not a developer ignore the following parameters: you will never need them.
# Where shall we store the backend and frontend code files.
# Where shall we store the backend and frontend code files.
codedir=./librephotos/code
# Location for pgAdmin
pgAdminLocation=./librephotos/pgadmin
# Which subnet should the docker network use
subnet=172.19.0.0/16
# On which Gateway should the proxy container be accessible
gateway=172.19.0.1
\ No newline at end of file
......@@ -28,12 +28,11 @@ http {
}
# needed for webpack-dev-server
location /ws {
proxy_pass http://frontend:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://frontend:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Django media
location /protected_media {
internal;
......
......@@ -26,6 +26,13 @@ http {
include uwsgi_params;
proxy_pass http://__backend_name__:8001;
}
# needed for webpack-dev-server
location /ws {
proxy_pass http://__frontend_name__:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
# Django media
location /protected_media {
internal;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment