Skip to content

Commit

Permalink
Merge pull request #10 from uw-it-aca/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ezturner authored Jun 18, 2019
2 parents 95fa36b + d3ddfae commit 71bb4b0
Show file tree
Hide file tree
Showing 11 changed files with 9,457 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "django-scaffold"]
path = django-scaffold
url = https://github.com/uw-it-aca/django-scaffold
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sudo: false
script:
- echo "$DOCKER_PASSWORD" | docker login --username "$DOCKER_USERNAME" --password-stdin
- docker build -t django-container .
- FIXED_BRANCH=$(echo $TRAVIS_BRANCH | tr / -)
- docker tag django-container "$DOCKER_USERNAME/django-container:$FIXED_BRANCH"
- docker push "$DOCKER_USERNAME/django-container:$FIXED_BRANCH"
- docker images
77 changes: 77 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
FROM ubuntu:18.04
WORKDIR /app/
ENV PYTHONUNBUFFERED 1
RUN apt-get -y update && \
apt-get -y install apache2 apache2-dev && \
apt-get upgrade -y && \
apt-get dist-upgrade -y && \
apt-get clean all

# Install system dependencies
RUN apt-get update -y&& \
apt-get install -y \
git \
hostname \
locales \
openssl \
sqlite3 \
sudo \
tar \
curl \
wget \
python-setuptools \
build-essential\
python3.6-dev \
python3-venv \
libxml2-dev \
libxmlsec1-dev \
python-pip

RUN locale-gen en_US.UTF-8
# locale.getdefaultlocale() searches in this order
ENV LANGUAGE en_US.UTF-8
ENV LC_ALL en_US.UTF-8
ENV LC_CTYPE en_US.UTF-8
ENV LANG en_US.UTF-8

RUN python3 -m venv /app/
RUN . /app/bin/activate && wget https://bootstrap.pypa.io/get-pip.py && python get-pip.py && pip3 install --upgrade pip && pip install mod_wsgi
RUN . /app/bin/activate && pip install django && django-admin.py startproject project . && pip uninstall django -y
ADD project/ /app/project
ADD scripts /scripts
ADD certs/ /app/certs
RUN mkdir /static


ADD conf/apache2.conf /tmp/apache2.conf
ADD conf/envvars /tmp/envvars
RUN rm -rf /etc/apache2/sites-available/ && \
mkdir /etc/apache2/sites-available/ && \
rm -rf /etc/apache2/sites-enabled/ && \
mkdir /etc/apache2/sites-enabled/ && \
rm /etc/apache2/apache2.conf && \
cp /tmp/apache2.conf /etc/apache2/apache2.conf && \
rm /etc/apache2/envvars &&\
cp /tmp/envvars /etc/apache2/envvars &&\
mkdir /etc/apache2/logs


RUN mkdir /var/lock/apache2 && mkdir /var/run/apache2
RUN groupadd -r acait -g 1000 && \
useradd -u 1000 -rm -g acait -d /home/acait -s /bin/bash -c "container user" acait &&\
chown -R acait:acait /app &&\
chown -R acait:acait /static &&\
chown -R acait:acait /home/acait &&\
chown -R acait:acait /var/lock/apache2 &&\
chown -R acait:acait /var/run/apache2

RUN chmod -R +x /scripts


USER acait

ENV PORT 8000
ENV DB sqlite3
ENV ENV localdev

CMD [ "/scripts/start.sh" ]
8,953 changes: 8,953 additions & 0 deletions certs/ca-bundle.crt

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions conf/apache2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so
LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so
LoadModule wsgi_module /app/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so
LoadModule env_module /usr/lib/apache2/modules/mod_env.so
LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
ServerName localhost
Listen ${PORT}
ErrorLog /dev/stderr
TransferLog /dev/stdout

<If "-T osenv('REMOTE_USER') ">
SetEnv REMOTE_USER ${REMOTE_USER}
</If>


PidFile /var/run/apache2/apache2.pid
WSGIPythonPath /app/bin/
WSGIPythonHome /app/

<VirtualHost *:${PORT}>

Alias /static "/static"

WSGIScriptAlias / /app/project/wsgi.py

<Directory /app/project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

</VirtualHost>
45 changes: 45 additions & 0 deletions conf/envvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# envdatas - default environment dataiables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}"
else
SUFFIX=
fi

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment dataiables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=acait
export APACHE_RUN_GROUP=acait
export APACHE_PID_FILE=/var/run/apache2/$SUFFIX/apache2.pid
export APACHE_RUN_DIR=/var/run/apache2/$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2/$SUFFIX
export APACHE_LOG_DIR=/var/log/apache2/$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

## If you would like to pass arguments to the web server, add them below
## to the APACHE_ARGUMENTS environment.
#export APACHE_ARGUMENTS=''

## Enable the debug mode for maintainer scripts.
## This will produce a verbose output on package installations of web server modules and web application
## installations which interact with Apache
#export APACHE2_MAINTSCRIPT_DEBUG=1
Loading

0 comments on commit 71bb4b0

Please sign in to comment.