# Patchwork configuration files
patchwork/settings/production.py
+
+# docker-compose configuration files
+/.env
-# the version of docker-compose shipped in ubuntu 16.04 is
-# 1.5.2, which doesn't support version 2 syntax. Yay!
-# also, v1 doesn't support explicit build args, so if you're not
-# uid 1000, you will either need to manually hack the Dockerfile
-# or upgrade to v2 and use the build-arg to override it.
+version: "3"
+services:
+ db:
+ image: postgres:9.6
+ volumes:
+ - ./tools/docker/db/postdata:/var/lib/postgresql/data
+ environment:
+ - POSTGRES_PASSWORD=password
-db:
- image: postgres:9.6
- environment:
- - POSTGRES_PASSWORD=password
- volumes:
- - ./tools/docker/db/postdata:/var/lib/postgresql/data
-
-web:
- build: .
- dockerfile: ./tools/docker/Dockerfile
- command: python3 manage.py runserver 0.0.0.0:8000
- volumes:
- - .:/home/patchwork/patchwork/
- ports:
- - "8000:8000"
- links:
- - db
- environment:
- - PGPASSWORD=password
- - PW_TEST_DB_HOST=db
- - PW_TEST_DB_PORT=5432
- - PW_TEST_DB_TYPE=postgres
- - PW_TEST_DB_USER=postgres
- - PW_TEST_DB_PASS=password
+ web:
+ build:
+ context: .
+ dockerfile: ./tools/docker/Dockerfile
+ args:
+ - UID
+ command: python3 manage.py runserver 0.0.0.0:8000
+ volumes:
+ - .:/home/patchwork/patchwork/
+ ports:
+ - "8000:8000"
+ # TODO(stephenfin): links are deprecated and should be replaced
+ # with user-defined networks
+ links:
+ - db
+ environment:
+ - UID
+ - PGPASSWORD=password
+ - PW_TEST_DB_HOST=db
+ - PW_TEST_DB_PORT=5432
+ - PW_TEST_DB_TYPE=postgres
+ - PW_TEST_DB_USER=postgres
+ - PW_TEST_DB_PASS=password
-# the version of docker-compose shipped in ubuntu 16.04 is
-# 1.5.2, which doesn't support version 2 syntax. Yay!
-# also, v1 doesn't support explicit build args, so if you're not
-# uid 1000, you will either need to manually hack the Dockerfile
-# or upgrade to v2 and use the build-arg to override it.
+version: "3"
+services:
+ db:
+ image: mysql:5.7
+ volumes:
+ - ./tools/docker/db/data:/var/lib/mysql
+ environment:
+ - MYSQL_ROOT_PASSWORD=password
+ - MYSQL_USER=patchwork
+ - MYSQL_PASSWORD=password
-db:
- image: mysql:5.7
- volumes:
- - ./tools/docker/db/data:/var/lib/mysql
- environment:
- - MYSQL_ROOT_PASSWORD=password
- - MYSQL_USER=patchwork
- - MYSQL_PASSWORD=password
-
-web:
- build: .
- dockerfile: ./tools/docker/Dockerfile
- command: python3 manage.py runserver 0.0.0.0:8000
- volumes:
- - .:/home/patchwork/patchwork/
- ports:
- - "8000:8000"
- links:
- - db
- environment:
- - PW_TEST_DB_HOST=db
- - PW_TEST_DB_PORT=3306
+ web:
+ build:
+ context: .
+ dockerfile: ./tools/docker/Dockerfile
+ args:
+ - UID
+ command: python3 manage.py runserver 0.0.0.0:8000
+ volumes:
+ - .:/home/patchwork/patchwork/
+ ports:
+ - "8000:8000"
+ # TODO(stephenfin): links are deprecated and should be replaced
+ # with user-defined networks
+ links:
+ - db
+ environment:
+ - UID
+ - PW_TEST_DB_HOST=db
+ - PW_TEST_DB_PORT=3306
development environment. This is the preferred installation method. To
configure Patchwork using Docker:
-1. Install `docker`_ and `docker-compose`_.
+#. Install `docker`_ and `docker-compose`_.
-2. Build the images. This will download over 200MB from the internet:
+#. Create a ``.env`` file in the root directory of the project and store your
+ ``UID`` attribute there.
+
+ .. code-block:: shell
+
+ $ echo "UID=$UID" > .env
+
+#. Build the images. This will download over 200MB from the internet:
.. code-block:: shell
$ docker-compose build
-3. Run `docker-compose up`:
+#. Run ``docker-compose up``:
.. code-block:: shell
If you see an error like the below::
- py.error.EACCES: [Permission denied]: open('/home/patchwork/patchwork/.tox/py27-django18/.tox-config1', 'w')
-
- your host user account is likely using a different UID to the one hardcoded
- in the Dockerfile. You can confirm this like so:
+ You must define UID in .env
- .. code-block:: shell
-
- $ echo $UID
- 1234
-
- If this is anything other than `1000`, you must must modify the `Dockerfile`
- found in `tools/docker` to use your UID and then rebuild:
-
- .. code-block:: shell
+ Ensure you have created a ``.env`` file in the root of your project
+ directory and stored the ``UID`` attribute there. For more information on
+ why this is necessary, refer to this `docker-compose issue`__.
- $ sed -i "/ARG UID=/c\ARG UID=$(echo $UID)" tools/docker/Dockerfile
- $ docker-compose build web
-
- This change must be retained in the event that you rebuild the container.
- You can "hide" the change from Git like so:
-
- .. code-block:: shell
-
- $ git update-index --assume-unchanged tools/docker/Dockerfile
- $ git update-index --skip-worktree tools/docker/Dockerfile
-
- This should be resolved in a future release when we support docker-compose
- 2.1 syntax in `docker-compose.yml`.
+ __ https://github.com/docker/compose/issues/2380
.. _docker: https://docs.docker.com/compose/install/
.. _docker-compose: https://docs.docker.com/engine/installation/linux/
+
Manual Installation
-------------------
(.venv)$ ./manage.py createsuperuser
+
Import Mailing List Archives
----------------------------
__ http://blog.behnel.de/posts/indexp118.html
+
Django Debug Toolbar
--------------------
developing on a different machine, you should configure an SSH tunnel such
that, for example, `localhost:8000` points to `[DEV_MACHINE_IP]:8000`.
+
.. _dev-envvar:
Environment Variables
FROM ubuntu:17.10
-ARG UID=1000
+ARG UID
ARG TZ="Australia/Canberra"
+RUN echo $UID
+RUN [ -n "$UID" ] || { echo "You must define UID in .env" 1>&2; exit 1; }
+
ENV PROJECT_HOME /home/patchwork/patchwork
ENV db_user root