Skip to content

Commit

Permalink
Update docker-compose and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgodwin committed Nov 27, 2022
1 parent 0f77f0b commit bc54e18
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 29 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,11 @@ image:
docs:
cd docs/ && make html

compose_build:
docker-compose -f docker/docker-compose.yml build

compose_up:
docker-compose -f docker/docker-compose.yml up

compose_down:
docker-compose -f docker/docker-compose.yml down
12 changes: 8 additions & 4 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ x-takahe-common:

image: takahe:latest
environment:
TAKAHE_DATABASE_URL: "postgres://postgres:insecure_password@db/takahe"
TAKAHE_DEBUG: true
TAKAHE_DATABASE_SERVER: "postgres://postgres:insecure_password@db/takahe"
TAKAHE_DEBUG: "true"
TAKAHE_SECRET_KEY: "insecure_secret"
TAKAHE_CSRF_TRUSTED_ORIGINS: '["http://127.0.0.1:8000", "https://127.0.0.1:8000"]'
TAKAHE_USE_PROXY_HEADERS: true
TAKAHE_USE_PROXY_HEADERS: "true"
TAKAHE_EMAIL_BACKEND: "console://console"
TAKAHE_MAIN_DOMAIN: "example.com"
TAKAHE_ENVIRONMENT: "development"
Expand All @@ -31,7 +31,7 @@ x-takahe-common:

services:
db:
image: postgres:15-alpine
image: docker.io/postgres:15-alpine
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
Expand All @@ -49,6 +49,10 @@ services:
ports:
- "8000:8000"

stator:
<<: *takahe-common
command: ["/takahe/manage.py", "runstator"]

setup:
<<: *takahe-common
command: ["/takahe/manage.py", "migrate"]
Expand Down
63 changes: 38 additions & 25 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,42 @@ and local posting/follow functionality; to test ActivityPub itself and follow
other people, your installation **must be accessible from the internet**;
doing that securely is different enough per person that it is not covered here.

Using Docker Compose is the fastest way to get up and running, and you will
still be able to make web changes and have them appear in real-time. Direct
installation is recommended for more advanced developers or those wishing to
use a PostgreSQL they already have.

These instructions are not suitable for running a production copy; for that,
see :doc:`installation`.

Docker
~~~~~~

The docker build process will take care of much of the above, but you just have
to be sure that you're executing it from the project root.

First, you need to build your image::

docker compose -f docker/docker-compose.yml build

Then start the ``compose`` session::

docker compose -f docker/docker-compose.yml up

At this point, you should be able to see the Web UI at http://localhost:8000

Once your session is up and running, you can make yourself a superuser account::

docker compose -f docker/docker-compose.yml exec web manage.py createsuperuser

And you can run the tests inside your container::

docker compose -f docker/docker-compose.yml exec web pytest

If you want to change the settings that Takahē is using, you can edit them
near the top of the docker-compose file; the default set are designed for a
local installation, though.


Direct installation
~~~~~~~~~~~~~~~~~~~
Expand All @@ -48,7 +84,7 @@ Then install the development requirements::

pip install -r requirements-dev.txt

and enable the git commit hooks to do auto-formatting and linting
Enable the git commit hooks to do auto-formatting and linting
(if you don't do this, our CI system will reject your PRs until they match)::

pre-commit install
Expand All @@ -73,30 +109,7 @@ And you can run the tests with pytest::

pytest


Docker
~~~~~~

The docker build process will take care of much of the above, but you just have
to be sure that you're executing it from the project root.

First, you need to build your image::

docker compose -f docker/docker-compose.yml build

Then start the `compose` session::

docker compose -f docker/docker-compose.yml up

At this point, you will be able to see the Web UI at http://localhost:8000

Once your session is up and running, you can make yourself a superuser account::

docker compose -f docker/docker-compose.yml exec web manage.py createsuperuser

And you can run the tests inside your container::

docker compose -f docker/docker-compose.yml exec web pytest
If you want to edit settings, you can edit the ``.env`` file.


Coding Guidelines
Expand Down

0 comments on commit bc54e18

Please sign in to comment.