Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Add an example docker-compose config
* Make uwsgi use its own proto, and not http
* Bundle psycopg2 with the image
* Add an example nginx config
  • Loading branch information
tdemin committed Jun 14, 2019
1 parent 9edcc79 commit 66b40df
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Dockerfile
Expand Up @@ -10,12 +10,13 @@ COPY bin /app/bin
COPY --chown=0:0 doc/config.json.example /etc/amber.json
COPY project_amber /app/project_amber

# we need gcc to build cffi, which is required by bcrypt
# we do not remove postgresql-dev after installation, as psycopg2 needs libpq
# present on the system
RUN adduser -D -u 1000 amber && \
mkdir -p /data && chown amber /data && chmod 700 /data && \
apk add --no-cache build-base libffi-dev && \
apk add --no-cache build-base libffi-dev postgresql-dev && \
pip install -r requirements.txt && \
pip install uwsgi && \
pip install uwsgi psycopg2 && \
apk del build-base libffi-dev && \
chmod +x /app/bin/run_uwsgi.sh

Expand Down
3 changes: 1 addition & 2 deletions bin/run_uwsgi.sh
@@ -1,9 +1,8 @@
#!/bin/sh

/usr/local/bin/uwsgi \
--http :${UWSGI_PORT} \
--socket :${UWSGI_PORT} \
--master \
--plugin python,http \
--manage-script-name \
--mount /=project_amber:app \
--processes ${UWSGI_PROCESSES} \
Expand Down
8 changes: 8 additions & 0 deletions doc/nginx.conf.example
@@ -0,0 +1,8 @@
server {
listen 80 default_server;
location / { try_files $uri @amber; }
location @amber {
include uwsgi_params;
uwsgi_pass amber:8080;
}
}
38 changes: 38 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,38 @@
version: "3"

volumes:
postgres:

services:
amber:
build: .
restart: always
# You'll likely need to add other drivers, like mysql-connector-python, to
# connect to databases other than the default SQLite and PostgreSQL. See:
# https://docs.sqlalchemy.org/en/13/core/engines.html#database-urls
environment:
- AMBER_DATABASE=postgres://amber:CHANGEME@database:5432/amber
- AMBER_LOGLEVEL=2
- AMBER_ALLOW_SIGNUP=0
- UWSGI_PORT=8080
- UWSGI_PROCESSES=1
- UWSGI_THREADS=2
depends_on:
- database
database:
image: postgres:11-alpine
restart: always
environment:
- POSTGRES_DB=amber
- POSTGRES_USER=amber
- POSTGRES_PASSWORD=CHANGEME
volumes:
- postgres:/var/lib/postgresql/data
web:
image: nginx:1.16-alpine
ports:
- 80:80
depends_on:
- amber
volumes:
- ./doc/nginx.conf.example:/etc/nginx/conf.d/default.conf:ro

0 comments on commit 66b40df

Please sign in to comment.