This repository has been archived on 2023-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
takahe/docs/installation.rst

148 lines
5.8 KiB
ReStructuredText
Raw Normal View History

Installation
============
We recommend running using the Docker/OCI image; this contains all of the
necessary dependencies and static file handling preconfigured for you.
All configuration is done via either environment variables, or online through
the web interface.
Prerequisites
-------------
* SSL support (Takahē *requires* HTTPS)
2022-11-19 18:36:51 +01:00
* Something that can run Docker/OCI images
* A PostgreSQL 14 (or above) database
2022-11-23 21:05:14 +01:00
* Hosting/reverse proxy that passes the ``HOST`` header down to Takahē
* One of these to store uploaded images and media:
2022-11-20 06:36:54 +01:00
* Amazon S3
* Google Cloud Storage
* Writable local directory (must be accessible by all running copies!)
2022-11-19 18:36:51 +01:00
Note that ActivityPub is a chatty protocol that has a lot of background
2022-11-27 08:39:28 +01:00
activity, so you will need to run *background tasks*, in
2022-11-19 18:36:51 +01:00
order to fetch profiles, retry delivery of posts, and more.
2022-11-27 08:39:28 +01:00
Ideally, you would choose a platform where you can run our worker process in
the background continuously, but for small installations we have a URL you can
call periodically instead - see "What To Run", below.
2022-11-19 18:36:51 +01:00
2022-11-23 21:05:14 +01:00
The flagship Takahē instance, `takahe.social <https://takahe.social>`_, runs
2022-11-19 18:36:51 +01:00
inside of Kubernetes, with one Deployment for the webserver and one for the
Stator runner.
What To Run
-----------
2022-11-26 22:22:37 +01:00
You need to run at least one copy of the
`Docker image <https://hub.docker.com/r/jointakahe/takahe>`_ with no extra
arguments, in order to serve web traffic.
2022-11-19 18:36:51 +01:00
2022-11-26 22:22:37 +01:00
The image has required environment variables before it will boot, and this is
the only way to configure it - see below.
2022-11-19 18:36:51 +01:00
2022-11-26 22:22:37 +01:00
You also need to ensure Stator, our background task system, runs regularly.
You can do this in one of two ways:
* Run another copy of image with the arguments ``python manage.py runstator``,
which will run a background worker continuously.
* Call the URL ``/.stator/?token=abc`` periodically (once a minute or more).
The token value must be the same as you set in ``TAKAHE_STATOR_TOKEN``.
The background worker will have a lot more throughput, but you can opt for
either for a small installation. If Stator gets backed up, you can either
run more workers or call the URL more often to ensure it gets more throughput.
2022-11-19 18:36:51 +01:00
2022-11-27 22:04:43 +01:00
While you can run Takahē directly from a checkout if you like (rather than
having to use the Docker image), we're not
2022-11-24 19:20:45 +01:00
officially supporting that right now, as it increases our support burden by
having to deal with lots of OS and library versions. It's a standard Django
app, though, so if you know what you're doing, have at it - just expect us to
push back if you file tickets about things not working on your OS!
Environment Variables
---------------------
All of these variables are *required* for a working installation, and should
be provided from the first boot.
* ``TAKAHE_DATABASE_SERVER`` should be a database DSN for your database (you can use
2022-11-27 22:04:43 +01:00
the standard ``PGHOST``, ``PGUSER``, etc. variables instead if you want)
2022-11-19 01:24:43 +01:00
* ``TAKAHE_SECRET_KEY`` must be a fixed, random value (it's used for internal
cryptography). Don't change this unless you want to invalidate all sessions.
* ``TAKAHE_MEDIA_BACKEND`` must be a URI starting with ``local://``, ``s3://`` or ``gcs://``.
2022-11-27 22:04:43 +01:00
* If it is set to ``local://``, you must also provide ``TAKAHE_MEDIA_ROOT``,
the path to the local media directory, and ``TAKAHE_MEDIA_URL``, a
fully-qualified URL prefix that serves that directory.
2022-11-27 22:04:43 +01:00
* If it is set to ``gcs://``, it must be in the form ``gcs://bucket-name``
(note the two slashes if you just want a bucket name)
2022-11-27 22:04:43 +01:00
* If it is set to ``s3://``, it must be in the form ``s3://access-key:secret-key@endpoint-url/bucket-name``
* ``TAKAHE_MAIN_DOMAIN`` should be the domain name (without ``https://``) that
will be used for default links (such as in emails). It does *not* need to be
the same as any domain you are hosting user accounts on.
* ``TAKAHE_EMAIL_SERVER`` should be set to an ``smtp://`` or ``sendgrid://`` URI
* If you are using SMTP, it is ``smtp://username:password@host:port/``. You
can also put ``?tls=true`` or ``?ssl=true`` on the end to enable encryption.
* If you are using SendGrid, you should set the URI to ``sendgrid://api-key``
* ``TAKAHE_EMAIL_FROM`` is the email address that emails from the system will
appear to come from.
* ``TAKAHE_AUTO_ADMIN_EMAIL`` should be an email address that you would like to
be automatically promoted to administrator when it signs up. You only need
this for initial setup, and can unset it after that if you like.
* If you don't want to run Stator as a background process but as a view,
set ``TAKAHE_STATOR_TOKEN`` to a random string that you are using to
protect it; you'll use this when setting up the URL to be called.
2022-11-19 01:24:43 +01:00
* If your installation is behind a HTTPS endpoint that is proxying it, set
``TAKAHE_USE_PROXY_HEADERS`` to ``true``. (The HTTPS proxy header must be called
``X-Forwarded-Proto``).
2022-11-19 01:24:43 +01:00
* If you want to receive emails about internal site errors, set
``TAKAHE_ERROR_EMAILS`` to a comma-separated list of email addresses that
should get them.
Making An Admin Account
-----------------------
Once the webserver is up and working, go to the "create account" flow and
create a new account using the email you specified in
``TAKAHE_AUTO_ADMIN_EMAIL``.
Once you set your password using the link emailed to you, you will have an
admin account.
If your email settings have a problem and you don't get the email, don't worry;
fix them and then follow the "reset my password" flow on the login screen, and
you'll get another password reset email that you can use.
2022-11-19 01:24:43 +01:00
2022-11-19 18:36:51 +01:00
If you have shell access to the Docker image and would rather use that, you
can run ``python3 manage.py createsuperuser`` instead and follow the prompts.
2022-11-19 01:24:43 +01:00
Adding A Domain
---------------
When you login you'll be greeted with the "make an identity" screen, but you
won't be able to as you will have no domains yet.
2022-11-19 18:36:51 +01:00
You should select the "Domains" link in the sidebar and create one, and then
you will be able to make your first identity.