-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Davis Muro
committed
Jan 19, 2023
1 parent
af66c0f
commit 5c0c2d0
Showing
4 changed files
with
173 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
FROM ubuntu:20.04 | ||
|
||
# Silence configuration prompts | ||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV PYTHONUNBUFFERED 1 | ||
|
||
ENV DJANGO_SETTINGS_MODULE onadata.settings.docker | ||
|
||
# Install service dependencies | ||
# hadolint ignore=DL3008 | ||
RUN apt-get update -q &&\ | ||
apt-get install -y --no-install-recommends software-properties-common \ | ||
binutils \ | ||
libproj-dev \ | ||
gdal-bin \ | ||
memcached \ | ||
libmemcached-dev \ | ||
build-essential \ | ||
supervisor \ | ||
python3.9 \ | ||
python3-dev \ | ||
python3-pip \ | ||
python3-setuptools \ | ||
git \ | ||
libssl-dev \ | ||
libpq-dev \ | ||
gfortran \ | ||
libatlas-base-dev \ | ||
libjpeg-dev \ | ||
libxml2-dev \ | ||
libxslt1-dev \ | ||
libpython3.9-dev \ | ||
zlib1g-dev \ | ||
ghostscript \ | ||
python3-celery \ | ||
python3-sphinx \ | ||
pkg-config \ | ||
gcc \ | ||
automake \ | ||
libtool \ | ||
openjdk-11-jre-headless \ | ||
libpcre3 \ | ||
libpcre3-dev \ | ||
locales \ | ||
netcat && \ | ||
apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade &&\ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Generate and set en_US.UTF-8 locale | ||
RUN locale-gen en_US.UTF-8 | ||
ENV LC_ALL en_US.UTF-8 | ||
ENV LC_CTYPE en_US.UTF-8 | ||
RUN dpkg-reconfigure locales | ||
|
||
# Create OnaData user and add to tty group | ||
RUN useradd -G tty -m onadata | ||
|
||
# Make app directory | ||
RUN mkdir -p /srv/onadata && chown -R onadata:onadata /srv | ||
|
||
# Copy local codebase | ||
COPY . /srv/onadata | ||
|
||
# Install service requirements | ||
# hadolint ignore=DL3013 | ||
RUN python3.9 -m pip install --no-cache-dir -U pip && \ | ||
python3.9 -m pip install --no-cache-dir -r /srv/onadata/requirements/base.pip && \ | ||
python3.9 -m pip install --no-cache-dir -r /srv/onadata/requirements/s3.pip && \ | ||
python3.9 -m pip install --no-cache-dir -r /srv/onadata/requirements/ses.pip && \ | ||
python3.9 -m pip install --no-cache-dir -r /srv/onadata/requirements/azure.pip && \ | ||
python3.9 -m pip install --no-cache-dir uwsgitop django-silk | ||
|
||
WORKDIR /srv/onadata | ||
|
||
EXPOSE 8000 | ||
|
||
USER onadata | ||
|
||
CMD ["/usr/local/bin/uwsgi", "--ini", "/srv/onadata/uwsgi.ini"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
services: | ||
api: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
depends_on: | ||
- database | ||
- cache | ||
stdin_open: true | ||
tty: true | ||
user: "onadata" | ||
volumes: | ||
- ./:/srv/onadata | ||
ports: | ||
- 8000:8000 | ||
command: /usr/local/bin/uwsgi --ini /srv/onadata/uwsgi.ini | ||
|
||
celery: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
depends_on: | ||
- database | ||
- cache | ||
- api | ||
volumes: | ||
- ./:/srv/onadata | ||
user: "onadata" | ||
command: celery -A onadata.celeryapp worker -B -l INFO -E | ||
|
||
database: | ||
image: postgis/postgis:13-3.3-alpine | ||
environment: | ||
POSTGRES_PASSWORD: onadata | ||
POSTGRES_USER: onadata | ||
POSTGRES_DB: onadata | ||
volumes: | ||
- dbdata:/var/lib/postgresql/data | ||
|
||
cache: | ||
image: redis:alpine | ||
|
||
volumes: | ||
dbdata: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
[uwsgi] | ||
http=:3030 | ||
module=onadata.apps.main.wsgi:application | ||
master=True | ||
processes=2 | ||
vacuum=True # clear environment on exit | ||
max-requests=50 # respawn processes after serving 50 requests | ||
static-map=/static=onadata/static | ||
stats=/tmp/onadata-stats.sock | ||
uid = onadata | ||
gid = onadata | ||
|
||
http = :8000 | ||
stats = :8001 | ||
socket-timeout = 360 | ||
http-timeout = 360 | ||
http-keepalive = true | ||
post-buffering = 113 | ||
max-requests = 300 | ||
|
||
# Set to 0 or remove when not in development env | ||
py-autoreload = 1 | ||
honour-stdin = true | ||
master = true | ||
vacuum = true | ||
enable-threads = true | ||
ignore-sigpipe = true | ||
ignore-write-errors = true | ||
disable-write-exception = true | ||
workers = 2 | ||
threads = 15 | ||
|
||
chdir = /srv/onadata | ||
module = onadata.apps.main.wsgi:application | ||
static-map = /static=/srv/onadata/onadata/static |