From 953ad36de870c81d7c567b4dc2feb4d3ca1fb617 Mon Sep 17 00:00:00 2001 From: esteinig Date: Fri, 26 Jan 2024 11:37:31 +1100 Subject: [PATCH] chore(stack): fix deployment --- .gitignore | 7 ++++- README.md | 35 +++++++++++++++------ docker/docker-compose.localhost.yml | 4 --- docker/docker-compose.traefik.localhost.yml | 6 ++-- docker/docker-compose.traefik.web.yml | 6 ++-- docker/docker-compose.web.yml | 4 --- 6 files changed, 37 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index 8849b4c..e0399c8 100644 --- a/.gitignore +++ b/.gitignore @@ -43,4 +43,9 @@ venv.bak/ .vscode certs/* -.secrets/ \ No newline at end of file +.secrets/ + +/docker-compose.web.yml +/docker-compose.localhost.yml +/docker-compose.traefik.web.yml +/docker-compose.traefik.localhost.yml \ No newline at end of file diff --git a/README.md b/README.md index 1021269..fc14252 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,7 @@ docker compose --profile prod up # Application available in your browser at: http://localhost:5173/ ``` -Some minor unit tests can be run with the `tests` service: - -```bash -docker compose run tests -``` - -Update to the latest stable version onm `main`: +Update to the latest stable version on `main`: ```bash git pull # update main @@ -59,8 +53,7 @@ In this example, we are using the pre-configured `localhost` reverse-proxy to te # connects your stack with the reverse-proxy docker network create proxy -# Link the localhost stack and traefik service -# into the current repository +# Link the localhost stack into the current repository ln -s docker/docker-compose.localhost.yml . ln -s docker/docker-compose.traefik.localhost.yml . @@ -98,7 +91,29 @@ If you are running a web-instance through `Cloudflare` you need to set your SSL ## Development -Any and all questions, suggestions for improvement, bug reports, pull requests and ideas you would like to see implemented are welcome! Please open an [issue](https://github.com/esteinig/brick/issues) in this repository. Development and pull requests can be made on the [`dev`](https://github.com/esteinig/brick/tree/dev) branch. +Any and all questions, suggestions for improvement, bug reports, pull requests and ideas you would like to see implemented are welcome! Please open an [issue](https://github.com/esteinig/brick/issues) in this repository. + +Development and pull requests can be made on the [`dev`](https://github.com/esteinig/brick/tree/dev) branch. You can use the `dev` profile for hot reloads of changes to the application interface. + +It often helps to run a fresh development stack with a project identifier to keep volumes and containers separate for the current branch. Project specific stack containers and volumes (all data) can be removed with the `-v` flag. Changes to the `Python` package currently have to use the `--build` flag to rebuild the package inside the `docker/Dockerfile.server` container. + +Note that the `--profile dev` stack serves the application on port `5174` **not** on `5173` as for the `--profile prod` service, so that it can be run concurrently for production build testing. + +```bash +# You may be on a new feature branch `feat/new-feture` +# Up a fresh stack with the `--project` flag for this branch +docker compose --profile dev --project new-feature up -d + +# Down the stack and remove all volumes +docker compose --profile dev --project new-feature down -v +``` + +Unit tests are defined in `tests` can be run with the `tests` service: + +```bash +# At the moment we need to rebuild after modifying tests +docker compose build tests && docker compose run --rm tests +``` ## Dependencies diff --git a/docker/docker-compose.localhost.yml b/docker/docker-compose.localhost.yml index 533be3f..27d0915 100644 --- a/docker/docker-compose.localhost.yml +++ b/docker/docker-compose.localhost.yml @@ -16,8 +16,6 @@ services: restart: unless-stopped expose: - "5173" - ports: - - "5173:5173" security_opt: - no-new-privileges:true env_file: docker/brick.env @@ -47,8 +45,6 @@ services: - /usr/src/app/node_modules expose: - "5174" - ports: - - "5174:5174" security_opt: - no-new-privileges:true env_file: docker/brick.env diff --git a/docker/docker-compose.traefik.localhost.yml b/docker/docker-compose.traefik.localhost.yml index 2923639..75f59c5 100644 --- a/docker/docker-compose.traefik.localhost.yml +++ b/docker/docker-compose.traefik.localhost.yml @@ -19,11 +19,11 @@ services: # Give access to the UNIX Docker socket - /var/run/docker.sock:/var/run/docker.sock:ro # Map the static configuration into the container - - ./traefik/localhost/static.yml:/etc/traefik/traefik.yml:ro + - ./docker/traefik/localhost/static.yml:/etc/traefik/traefik.yml:ro # Map the dynamic configuration into the container - - ./traefik/localhost/dynamic.yml:/etc/traefik/dynamic.yml:ro + - ./docker/traefik/localhost/dynamic.yml:/etc/traefik/dynamic.yml:ro # Set the location where the local ACME certificate is saved - - ./certs:/etc/traefik/certs + - ./docker/certs:/etc/traefik/certs networks: - proxy security_opt: diff --git a/docker/docker-compose.traefik.web.yml b/docker/docker-compose.traefik.web.yml index db0dc9d..686f21e 100644 --- a/docker/docker-compose.traefik.web.yml +++ b/docker/docker-compose.traefik.web.yml @@ -19,11 +19,11 @@ services: # Give access to the UNIX Docker socket - /var/run/docker.sock:/var/run/docker.sock:ro # Map the static configuration into the container - - ./traefik/web/static.yml:/etc/traefik/traefik.yml:ro + - ./docker/traefik/web/static.yml:/etc/traefik/traefik.yml:ro # Map the dynamic configuration into the container - - ./traefik/web/dynamic.yml:/etc/traefik/dynamic.yml:ro + - ./docker/traefik/web/dynamic.yml:/etc/traefik/dynamic.yml:ro # Set the location where the local ACME certificate is saved - - ./certs:/etc/traefik/certs + - ./docker/certs:/etc/traefik/certs networks: - proxy security_opt: diff --git a/docker/docker-compose.web.yml b/docker/docker-compose.web.yml index b30e3cb..01e6e0f 100644 --- a/docker/docker-compose.web.yml +++ b/docker/docker-compose.web.yml @@ -16,8 +16,6 @@ services: restart: unless-stopped expose: - "5173" - ports: - - "5173:5173" security_opt: - no-new-privileges:true env_file: docker/brick.env @@ -52,8 +50,6 @@ services: - /usr/src/app/node_modules expose: - "5174" - ports: - - "5174:5174" security_opt: - no-new-privileges:true env_file: docker/brick.env