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
Showing
8 changed files
with
368 additions
and
5 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,167 @@ | ||
# In an ideal world, this file would simply import the .gitignore | ||
# file and basically be done. However, sadly that doesn't work for | ||
# a variety of reasons: | ||
# 1) You can't import one .ignore file into another | ||
# 2) The .dockerignore file has slightly different syntax than .gitignore. | ||
# https://zzz.buzz/2018/05/23/differences-of-rules-between-gitignore-and-dockerignore/ | ||
# For now I'm going to assume that there are no problems and simply | ||
# $(cat .gitignore >> .dockerignore) | ||
|
||
# The .git directory | ||
.git/ | ||
|
||
# Created by https://www.gitignore.io/api/python | ||
# Edit at https://www.gitignore.io/?templates=python | ||
|
||
### Python ### | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
### Python Patch ### | ||
.venv/ | ||
|
||
# End of https://www.gitignore.io/api/python | ||
|
||
# Other Virtual Envs. | ||
.venv*/ | ||
|
||
# Development Configuration | ||
config/ | ||
internal.db | ||
|
||
# Created by https://www.gitignore.io/api/vim | ||
# Edit at https://www.gitignore.io/?templates=vim | ||
|
||
### Vim ### | ||
# Swap | ||
[._]*.s[a-v][a-z] | ||
[._]*.sw[a-p] | ||
[._]s[a-rt-v][a-z] | ||
[._]ss[a-gi-z] | ||
[._]sw[a-p] | ||
|
||
# Session | ||
Session.vim | ||
|
||
# Temporary | ||
.netrwhist | ||
*~ | ||
# Auto-generated tag files | ||
tags | ||
# Persistent undo | ||
[._]*.un~ | ||
|
||
# End of https://www.gitignore.io/api/vim |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<VirtualHost *:80> | ||
ServerName trendlines | ||
|
||
LoadModule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so | ||
|
||
WSGIDaemonProcess trendlines user=www-data group=www-data | ||
WSGIScriptAlias / /var/www/wsgi.py | ||
<Location /> | ||
WSGIProcessGroup trendlines | ||
</Location> | ||
|
||
# Expose the logs to StdOut and StdErr so that docker | ||
# can read them. | ||
ErrorLog /proc/self/fd/1 | ||
LogLevel info | ||
CustomLog /proc/self/fd/2 combined | ||
</VirtualHost> |
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,7 @@ | ||
#!/usr/local/bin/python3 | ||
import os | ||
|
||
from trendlines import create_app | ||
|
||
os.environ['TRENDLINES_CONFIG_FILE'] = "/data/trendlines.cfg" | ||
application = create_app() |
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,56 @@ | ||
FROM python:3.7.1-slim-stretch | ||
|
||
LABEL maintainer="doug.thor@gmail.com" | ||
|
||
ENV WSGI_VERSION="4.6.5" | ||
|
||
# Install Requirements | ||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
apache2 \ | ||
apache2-dev \ | ||
make \ | ||
wget \ | ||
# Install mod_wsgi from source for our specific python version | ||
&& wget \ | ||
-O mod_wsgi-$WSGI_VERSION.tar.gz \ | ||
"https://github.com/GrahamDumpleton/mod_wsgi/archive/$WSGI_VERSION.tar.gz" \ | ||
&& tar -xzf mod_wsgi-$WSGI_VERSION.tar.gz \ | ||
&& cd mod_wsgi-$WSGI_VERSION \ | ||
&& ./configure \ | ||
&& make \ | ||
&& make install \ | ||
&& cd / \ | ||
# Cleanup | ||
&& rm -rf mod_wsgi-$WSGI_VERSION* \ | ||
&& apt-get remove -y apache2-dev wget make \ | ||
&& apt-get clean \ | ||
&& apt-get autoremove -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
EXPOSE 80 | ||
|
||
# Run apache in the foreground | ||
CMD ["apache2ctl", "-D", "FOREGROUND", "-e", "INFO"] | ||
|
||
### Now that the base stuff is done with, actually install the app. | ||
COPY requirements.txt /requirements.txt | ||
RUN pip install \ | ||
-r /requirements.txt \ | ||
&& rm /requirements.txt | ||
|
||
# I hate that I copy over everything. | ||
COPY . /trendlines | ||
COPY apache/trendlines.conf /etc/apache2/sites-available/trendlines.conf | ||
COPY apache/wsgi.py /var/www/wsgi.py | ||
COPY docker/trendlines.cfg /data/trendlines.cfg | ||
|
||
# TODO: Replace with install from pypi? Not if I want things built off master. | ||
RUN pip install -e /trendlines | ||
|
||
RUN a2ensite trendlines \ | ||
&& a2dissite 000-default.conf \ | ||
&& chown -R www-data:www-data /data | ||
|
||
|
||
# vim: tabstop=4 shiftwidth=4 expandtab filetype=dockerfile |
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,16 @@ | ||
# Need version >= 3.2 because of how we define our volumes | ||
version: "3.2" | ||
services: | ||
trendlines: | ||
image: dougthor42/trendlines:latest | ||
restart: always | ||
ports: | ||
- 80:80 | ||
volumes: | ||
- type: bind | ||
# Host location. This can be anywhere on your file system. | ||
source: /var/www/trendlines | ||
# Within the container. The /data directory holds both the internal | ||
# database file (if you're using SQLite) and the configuration file | ||
# `trendlines.cfg`. | ||
target: /data |
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,9 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Configuration specific to running in a docker container. | ||
""" | ||
DEBUG = False | ||
|
||
DATABASE = "/data/internal.db" | ||
|
||
# vim: filetype=python |
Oops, something went wrong.