Skip to content

Commit

Permalink
Cleanup and simplify deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
h4llow3En committed Mar 19, 2020
1 parent cc93118 commit 6b27f0c
Show file tree
Hide file tree
Showing 11 changed files with 85 additions and 125 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ staticfiles/
postgresql/


/docker-compose.yml
/docker-compose.override.yml
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM python:3.8-alpine

# hadolint ignore=DL3018
RUN apk add --no-cache postgresql-libs gettext zlib libjpeg libxml2-dev libxslt-dev
ENV PYTHONUNBUFFERED 1
EXPOSE 8080
Expand All @@ -14,6 +15,7 @@ COPY --chown=recipes:recipes . ./
RUN pwd && ls -lha
RUN chmod +x boot.sh

# hadolint ignore=DL3018
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev && \
python -m venv venv && \
venv/bin/pip install -r requirements.txt --no-cache-dir &&\
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,10 @@ When clicking submit, every recipe containing the word will be updated (tags are

### Docker-Compose
1. Clone this repository to your desired install location
2. Choose one of the included `docker-compose.yml` files [here](https://github.com/vabene1111/recipes/tree/develop/docs/docker).
3. Copy it to the root directory (where this readme is)
2. Choose one of the included configurations [here](https://github.com/vabene1111/recipes/tree/develop/docs/docker).
3. Copy (if needed) the `docker-compose.override.yml.template` to `docker-compose.override.yml` and uncomment the configurations you need.
4. Start the container (`docker-compose up -d`)
5. This time and **on each update** run `update.sh` to apply migrations and collect static files
6. Create a default user by executing into the container with `docker-compose exec web_recipes sh` and run `python3 manage.py createsuperuser`.
5. Create a default user by executing into the container with `docker-compose exec web_recipes sh` and run `python3 manage.py createsuperuser`.

### Manual
Copy `.env.template` to `.env` and fill in the missing values accordingly.
Expand Down
46 changes: 46 additions & 0 deletions docker-compose.override.yml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@


# Uncomment and edit the services as you like in here
# there are several examples available
# The docker-compose.override.yml is merged with docker-compose.yml on runtime

#####################
# WITH NGINX-PROXY #
#####################

# version: "3"
# services:
# nginx_recipes:
# image: "nginx"
# restart: always
# env_file:
# - ./.env
# volumes:
# - ./nginx/conf.d:/etc/nginx/conf.d
# - ./staticfiles:/static
# - ./mediafiles:/media
# networks:
# - default
# - nginx-proxy
# networks:
# nginx-proxy:
# external:
# name: nginx-proxy


#######################
# WITH TREAFIK-PROXY #
#######################

# version: "3"
# services:
# web_recipes:
# labels: # This lables are only examples!
# - "traefik.enable=true"
# - "traefik.http.routers.recipes.rule=Host(`recipes.mydomain.com`, `recipes.myotherdomain.com`)"
# - "traefik.http.routers.recipes.entrypoints=web_secure"
# - "traefik.http.routers.recipes.tls.certresolver=le_resolver"

# networks:
# traefik: # This is you external traefic network
# external: true
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: "3"
services:
db_recipes:
restart: always
image: "postgres:11-alpine"
volumes:
- ./postgresql:/var/lib/postgresql/data
env_file:
- ./.env
networks:
- default

web_recipes:
build: .
restart: always
env_file:
- ./.env
volumes:
- ./staticfiles:/opt/recipes/staticfiles
- ./mediafiles:/opt/recipes/mediafiles
ports:
- 80:8080
depends_on:
- db_recipes
networks:
- default

networks:
default:
2 changes: 2 additions & 0 deletions docs/docker/nginx-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ This is a docker compose example when using [jwilder's nginx reverse proxy](http
in combination with [jrcs's letsencrypt companion](https://hub.docker.com/r/jrcs/letsencrypt-nginx-proxy-companion/).

Please refer to the appropriate documentation on how to setup the reverse proxy and networks.

Copy the docker-compose.override.yml.template and uncomment the corresponding part.
43 changes: 0 additions & 43 deletions docs/docker/nginx-proxy/docker-compose.yml

This file was deleted.

1 change: 1 addition & 0 deletions docs/docker/plain/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Just run docker-compose up in the root of this repository.
37 changes: 0 additions & 37 deletions docs/docker/plain/docker-compose.yml

This file was deleted.

1 change: 1 addition & 0 deletions docs/docker/traefik/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Please refer to the traefik documentation on how to setup a docker service in traefik. Since treafik can be a little
confusing at times, the following are examples of my traefik configuration.

Copy the docker-compose.override.yml.template and uncomment the corresponding part.

You need to create a network called `traefik` using `docker network create traefik`.
## docker-compose.yml
Expand Down
40 changes: 0 additions & 40 deletions docs/docker/traefik/docker-compose.yml

This file was deleted.

0 comments on commit 6b27f0c

Please sign in to comment.