Skip to content

Installation

Lukas Yelle edited this page Mar 1, 2018 · 4 revisions

PawPrints uses Docker and Docker Compose to run the application and its dependencies inside containers. Therefore, you must have Docker and Docker Compose installed on your machine in order to run the app.

Install Docker/Docker Compose

Linux

You should install Docker using your distro's package manager.

Ubuntu: https://docs.docker.com/install/linux/docker-ce/ubuntu/

Fedora: https://docs.docker.com/install/linux/docker-ce/fedora/

You can install Docker Compose using your distro's package manager, but it is usually a few versions behind, the following is the recommended way to install Docker Compose.

Grab the current release from Github:

sudo curl -L https://github.com/docker/compose/releases/download/1.19.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose

Set Permissions:

sudo chmod +x /usr/local/bin/docker-compose

Verify that it was installed successfully:

docker-compose --version

Should output something like the following (Your output may vary depending on the version installed):

docker-compose version 1.19.0, build 9e633ef

Get the Code and Set Environment Variables

Clone the repository if you have not already done so

HTTPS: git clone https://github.com/ritstudentgovernment/PawPrints.git

SSH:

git clone [email protected]:ritstudentgovernment/PawPrints.git

Set the environment variables by copying the template.env file.

cp template.env .env

Then set the variables in the .env file, the defaults should be fine and generally don't need to be changed if working in development.

Build/Run Containers

When running the containers for the first time, they have to be built which takes a few minutes. To get the app up and running, simply run

docker-compose up or docker-compose up -d (run in the background)

This command will build and then run the containers. Be aware that the build might take a few minutes.

If you are not running the up command in the background, you should see something similar to the following once the app is up and running:

huey_worker_1  | + queue_task_petition_responded
huey_worker_1  | + queue_task_petition_reached
huey_worker_1  | + queue_task_petition_received
huey_worker_1  | + queue_task_petition_needs_approval
huey_worker_1  | + queue_task_publish_petition_task
web_1          | Operations to perform:
web_1          |   Apply all migrations: admin, auth, contenttypes, petitions, profile, sessions
worker_1       | 2018-02-28 21:04:03,182 - INFO - runworker - Using single-threaded worker.
worker_1       | 2018-02-28 21:04:03,182 - INFO - runworker - Running worker against channel layer default (asgi_redis.core.RedisChannelLayer)
worker_1       | 2018-02-28 21:04:03,183 - INFO - worker - Listening on channels http.request, websocket.connect, websocket.disconnect, websocket.receive
web_1          | Running migrations:
web_1          |   No migrations to apply.
web_1          | 2018-02-28 21:04:04,088 INFO     Raven is not configured (logging is disabled). Please see the documentation for more information.
web_1          | 2018-02-28 21:04:04,115 INFO     Starting server at tcp:port=8000:interface=0.0.0.0, channel layer pawprints.asgi:channel_layer.
web_1          | 2018-02-28 21:04:04,116 INFO     HTTP/2 support not enabled (install the http2 and tls Twisted extras)
web_1          | 2018-02-28 21:04:04,116 INFO     Using busy-loop synchronous mode on channel layer
web_1          | 2018-02-28 21:04:04,116 INFO     Listening on endpoint tcp:port=8000:interface=0.0.0.0

At this point, you can view the app at http://localhost:8000

PostgreSQL and Redis Volumes

In order to persist data in the PostgreSQL and Redis containers, a volume is specified at /pawprintsdata . This means that Docker will create a directory on your machine at /pawprintsdata this will contain all the data for PostgreSQL and Redis.

Another thing to note is that the DB_USER, DB_PASSWORD, and DB_NAME environment variables specified in the .env file, generate a default postgres user with password and table that PawPrints will use. They will only be generated the first time the container is built. In order to change them, you need to delete the volume at /pawprintsdata on your machine then rebuild the postgres container.