-
Notifications
You must be signed in to change notification settings - Fork 87
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
1 parent
26386b4
commit 7cc9b96
Showing
11 changed files
with
273 additions
and
19 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,7 @@ | ||
.git | ||
htdocs/media/logo | ||
mygpo/settings_prod.py | ||
*.pyc | ||
*/*.pyc | ||
*/*/*.pyc | ||
*/*/*/*.pyc |
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,41 @@ | ||
FROM ubuntu:14.04 | ||
MAINTAINER Stefan Kögl <stefan@skoegl.net> | ||
|
||
# use bash instead of built-in sh, because it does not support "source" during build | ||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh | ||
|
||
# install all packaged dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
python2.7 \ | ||
python2.7-dev \ | ||
python-virtualenv \ | ||
libpq-dev \ | ||
libjpeg-dev \ | ||
zlib1g-dev \ | ||
libwebp-dev | ||
|
||
# create log directories | ||
RUN mkdir -p /var/log/gunicorn | ||
|
||
# copy source | ||
COPY . /srv/mygpo | ||
WORKDIR /srv/mygpo | ||
|
||
# run everything in a virtualenv | ||
RUN virtualenv venv | ||
RUN source venv/bin/activate | ||
|
||
# install all runtime dependencies | ||
RUN pip install \ | ||
-r /srv/mygpo/requirements.txt \ | ||
-r /srv/mygpo/requirements-setup.txt | ||
|
||
# set up missing environment variables | ||
ENTRYPOINT ["/srv/mygpo/bin/docker-env.sh"] | ||
|
||
# default launch command | ||
CMD ["gunicorn", "mygpo.wsgi:application", "-c", "gunicorn.conf.py"] | ||
|
||
# HTTP port | ||
EXPOSE 8000 |
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 @@ | ||
#!/bin/bash | ||
# Docker doesn't have a great way to set environment variables at startup. | ||
# This scripts will set up some defaults. | ||
|
||
# if a DATABSE_URL is provided from outside, use it | ||
if [[ -z "$DATABASE_URL" ]]; then | ||
# otherwise construct one using a linked "db" container | ||
export DATABASE_URL="postgres://mygpo:mygpo@${DB_PORT_5432_TCP_ADDR}:5432/mygpo" | ||
fi | ||
|
||
# if not SECRET_KEY is provided from outside, create a random one | ||
if [[ -z "$SECRET_KEY" ]]; then | ||
export SECRET_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | ||
fi | ||
|
||
# Execute the commands passed to this script | ||
exec "$@" |
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 @@ | ||
CREATE USER mygpo WITH PASSWORD 'mygpo'; | ||
ALTER USER mygpo CREATEDB; -- required for creating test database | ||
CREATE DATABASE mygpo; | ||
CREATE DATABASE test_mygpo; | ||
GRANT ALL PRIVILEGES ON DATABASE mygpo to mygpo; | ||
GRANT ALL PRIVILEGES ON DATABASE test_mygpo to mygpo; | ||
ALTER DATABASE mygpo OWNER TO mygpo; | ||
ALTER DATABASE test_mygpo OWNER TO mygpo; | ||
ALTER ROLE mygpo SET statement_timeout = 5000; |
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
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,106 @@ | ||
Configuration | ||
============= | ||
|
||
Configuration can be done through the following environment variables. | ||
|
||
``DEBUG`` | ||
--------- | ||
Debug mode shows error pages, enables debug output, etc. | ||
|
||
|
||
``DATABASE_URL`` | ||
---------------- | ||
DB connection string in the form of ``postgres://USER:PASSWORD@HOST:PORT/NAME`` | ||
|
||
|
||
``ACCOUNT_ACTIVATION_DAYS`` | ||
--------------------------- | ||
Number of days that newly registered users have time to activate their account. | ||
|
||
|
||
``DEFAULT_FROM_EMAIL`` | ||
---------------------- | ||
Default sender address for outgoing emails. See `Django documentation | ||
<https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-DEFAULT_FROM_EMAIL>`__. | ||
|
||
|
||
``SECRET_KEY`` | ||
-------------- | ||
See `Django documentation | ||
<https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-SECRET_KEY>`__. | ||
|
||
|
||
``GOOGLE_ANALYTICS_PROPERTY_ID`` | ||
-------------------------------- | ||
Setting a Google Analytics Property ID activates GA integration. | ||
|
||
|
||
``DIRECTORY_EXCLUDED_TAGS`` | ||
--------------------------- | ||
A comma-separated list of tags that are excluded from the directory. | ||
|
||
|
||
``FLICKR_API_KEY`` | ||
------------------ | ||
Setting a Flickr API key activates Flickr integration. | ||
|
||
|
||
``MAINTENANCE`` | ||
--------------- | ||
Switches the site into a maintenance mode. | ||
|
||
|
||
* ``PODCAST_SLUG_SUBSCRIBER_LIMIT`` | ||
|
||
* ``MIN_SUBSCRIBERS_CATEGORY``: minimum number of subscribers that a podcast | ||
needs to "push" one of its categories to the top | ||
|
||
* ``API_ACTIONS_MAX_NONBG``: maximum number of episode actions that the API | ||
processes immediatelly before returning the response. Larger requests will | ||
be handled in background. | ||
|
||
* ``ADSENSE_CLIENT`` | ||
|
||
* ``ADSENSE_SLOT_BOTTOM`` | ||
|
||
* ``STAFF_TOKEN``: enabled access to staff-only areas with ?staff=<STAFF_TOKEN> | ||
|
||
* ``FLATTR_KEY`` | ||
|
||
* ``FLATTR_SECRET`` | ||
|
||
* ``FLATTR_MYGPO_THING``: Flattr thing of the webservice. Will be flattr'd | ||
when a user sets the "Auto-Flattr gpodder.net" option | ||
|
||
* ``USER_AGENT``: The User-Agent string used for outgoing HTTP requests | ||
|
||
* ``DEFAULT_BASE_URL``: Base URL of the website that is used if the actually | ||
used parameters is not available. Request handlers, for example, can access | ||
the requested domain. Code that runs in background can not do this, and | ||
therefore requires a default value. This should be set to something like | ||
``http://example.com`` | ||
|
||
* ``BROKER_URL`` Celery Broker URL | ||
|
||
* ``CELERY_RESULT_BACKEND`` | ||
|
||
* ``CELERY_SEND_TASK_ERROR_EMAILS`` | ||
|
||
* ``SERVER_EMAIL`` | ||
|
||
* ``GOOGLE_CLIENT_ID`` | ||
|
||
* ``GOOGLE_CLIENT_SECRET`` | ||
|
||
* ``SUPPORT_URL``: URL where users of the site can get support | ||
|
||
* ``ELASTICSEARCH_SERVER`` | ||
|
||
* ``ELASTICSEARCH_INDEX`` | ||
|
||
* ``ELASTICSEARCH_TIMEOUT`` | ||
|
||
* ``ACTIVATION_VALID_DAYS`` time for how long an activation is valid; after | ||
that, an unactivated user will be deleted | ||
|
||
* ``INTERNAL_IPS`` |
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,40 @@ | ||
Using Docker | ||
============ | ||
|
||
mygpo can be run using `Docker <https://docker.com/>`_. | ||
|
||
|
||
Database | ||
-------- | ||
|
||
The image requires a PostgreSQL server, specified either via | ||
|
||
* a `linked container <https://docs.docker.com/userguide/dockerlinks/>`_ | ||
called ``db`` containing a server with a database called ``mygpo``, a user | ||
called ``mygpo`` with a password ``mygpo``. | ||
* A ``DATABASE_URL`` environment variable (eg | ||
``postgres://USER:PASSWORD@HOST:PORT/NAME``) | ||
|
||
|
||
Elasticsearch | ||
------------- | ||
|
||
|
||
Redis | ||
----- | ||
|
||
|
||
Web Frontend | ||
------------ | ||
|
||
The image exposes the web interface on port 8000. | ||
|
||
|
||
Celery Worker | ||
------------- | ||
|
||
|
||
Celery Heartbeat | ||
---------------- | ||
|
||
|
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 @@ | ||
Operation Documentation | ||
======================= | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
configuration | ||
docker |
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