Skip to content

Commit

Permalink
Merge pull request #36 from esteinig/chore/fix-docker-ports
Browse files Browse the repository at this point in the history
chore(stack): fix running docker compose stacks
  • Loading branch information
esteinig authored Jan 26, 2024
2 parents a31a3fc + 953ad36 commit 5c15165
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 25 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@ venv.bak/
.vscode

certs/*
.secrets/
.secrets/

/docker-compose.web.yml
/docker-compose.localhost.yml
/docker-compose.traefik.web.yml
/docker-compose.traefik.localhost.yml
35 changes: 25 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 .

Expand Down Expand Up @@ -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

Expand Down
4 changes: 0 additions & 4 deletions docker/docker-compose.localhost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ services:
restart: unless-stopped
expose:
- "5173"
ports:
- "5173:5173"
security_opt:
- no-new-privileges:true
env_file: docker/brick.env
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docker/docker-compose.traefik.localhost.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions docker/docker-compose.traefik.web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 0 additions & 4 deletions docker/docker-compose.web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ services:
restart: unless-stopped
expose:
- "5173"
ports:
- "5173:5173"
security_opt:
- no-new-privileges:true
env_file: docker/brick.env
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5c15165

Please sign in to comment.