2018-06-03 22:11:12 +00:00
|
|
|
|
# Pleroma-Docker (Unofficial)
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2019-01-19 22:49:06 +00:00
|
|
|
|
Note: There's a revive effort going on in #5.<br>
|
|
|
|
|
Check it out and try `develop` if you feel adventurous.
|
2018-12-28 01:00:30 +00:00
|
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
2018-04-08 20:49:07 +00:00
|
|
|
|
[Pleroma](https://pleroma.social/) is a selfhosted social network that uses OStatus/ActivityPub.
|
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
This repository dockerizes it for easier deployment.
|
|
|
|
|
|
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
|
|
```cpp
|
2018-12-28 01:05:31 +00:00
|
|
|
|
#include <LICENSE>
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This repository comes with ABSOLUTELY NO WARRANTY
|
|
|
|
|
*
|
|
|
|
|
* I am not responsible for burning servers, angry users, fedi drama,
|
2019-01-10 00:06:29 +00:00
|
|
|
|
* thermonuclear war, or you getting fired because your boss saw your NSFW posts.
|
|
|
|
|
* Please do some research if you have any concerns about included
|
|
|
|
|
* features or the software used by this script ***before*** using it.
|
|
|
|
|
*
|
2018-06-03 22:11:12 +00:00
|
|
|
|
* You are choosing to use this setup, and if you point the finger at me for
|
|
|
|
|
* messing up your instance, I will laugh at you.
|
|
|
|
|
*/
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
<hr>
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
## Alternatives
|
|
|
|
|
|
|
|
|
|
If this setup is a bit overwhelming there are a lot of other great dockerfiles
|
|
|
|
|
or guides from the community. A few are linked below. This list is not exhaustive and not ordered.
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
- [Angristan/dockerfiles/pleroma](https://github.com/Angristan/dockerfiles/tree/master/pleroma)
|
|
|
|
|
- [RX14/iscute.moe](https://github.com/RX14/kurisu.rx14.co.uk/blob/master/services/iscute.moe/pleroma/Dockerfile)
|
|
|
|
|
- [rysiek/docker-pleroma](https://git.pleroma.social/rysiek/docker-pleroma)
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-12-28 01:05:31 +00:00
|
|
|
|
## Docs
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2019-01-10 00:27:52 +00:00
|
|
|
|
### Prerequisites
|
|
|
|
|
|
2019-01-10 18:03:52 +00:00
|
|
|
|
- 500mb of free HDD space
|
2019-01-10 00:27:52 +00:00
|
|
|
|
- `m4` and `awk` in remotely recent versions
|
|
|
|
|
- `curl` or `wget` if you want smarter build caches and commands like `./pleroma mod`
|
|
|
|
|
- `jq` and `dialog` if you want to use `./pleroma mod`
|
|
|
|
|
- Bash 4.0+ (fancy scripting stuff)
|
|
|
|
|
- Docker 18.06.0+ and docker-compose 1.22.0-rc1+ (We need compose file format 3.7+ for `init:`)
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
### Installation
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
- Clone this repository
|
2019-01-10 00:27:52 +00:00
|
|
|
|
- Create a `config.exs` and `.env` file
|
2019-01-10 00:06:29 +00:00
|
|
|
|
- Run `./pleroma build` and `./pleroma up`
|
2018-04-08 20:49:07 +00:00
|
|
|
|
- Profit!
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
### Updates
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Run `./pleroma build` again and start the updated image with `./pleroma up`.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
You don't need to stop your pleroma server for either of those commands.
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
### Maintenance
|
2018-08-18 21:32:33 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Pleroma maintenance is usually done with mix tasks.
|
|
|
|
|
You can run these tasks in your running pleroma server using `./pleroma mix [task] [arguments...]`.
|
|
|
|
|
If you need to fix some bigger issues you can also spawn a shell with `./pleroma enter`.
|
2018-08-18 21:32:33 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
### Customization
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Add your customizations (and their folder structure) to `custom.d/`.
|
|
|
|
|
They will be mounted and symlinked into the right place when the container starts.
|
|
|
|
|
You can even replace/patch pleroma’s code with this, because the project is recompiled at startup if needed.
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
In general: Prepending `custom.d/` to pleroma’s customization guides should work all the time.<br>
|
|
|
|
|
Check them out in the official pleroma wiki.
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
For example: A custom thumbnail now goes into `custom.d/priv/static/instance/thumbnail.jpeg` instead of `priv/static/instance/thumbnail.jpeg`.
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
### Patches
|
2018-08-20 21:06:34 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Works exactly like customization, but we have a neat little helper here.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Use `./pleroma mod [regex]` to mod any file that ships with pleroma, without having to type the complete path.<br>
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
### Configuration
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
All the pleroma options that you put into your `*.secret.exs` now go into `config.exs`.
|
2018-06-04 12:28:31 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
`.env` stores config values that need to be known at orchestration time.<br>
|
|
|
|
|
They should be self-explaining but here's some bonus info on important ones:
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
#### Data Storage (`DOCKER_DATADIR`)
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
A folder that will be bind-mounted into the container.<br>
|
|
|
|
|
This is where pleroma and postgres will store their data.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
|
|
|
|
#### Database (`SCRIPT_DEPLOY_POSTGRES`)
|
|
|
|
|
|
|
|
|
|
Values: `true` / `false`
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
By default pleroma-docker deploys a postgresql container and links it to pleroma’s container as a zero-config data store.
|
|
|
|
|
If you already have a postgres database or want to host it on a physically different machine, set this value to `false`.
|
|
|
|
|
Make sure to edit the `config :pleroma, Pleroma.Repo` variables when doing that.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
|
|
|
|
#### Reverse Proxy (`SCRIPT_USE_PROXY`)
|
|
|
|
|
|
|
|
|
|
Values: `traefik` / `nginx` / `manual`
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Pleroma is usually run behind a reverse-proxy.<br>
|
2018-06-03 22:11:12 +00:00
|
|
|
|
Pleroma-docker gives you multiple options here.
|
|
|
|
|
|
|
|
|
|
##### Traefik
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
In traefik-mode we will generate a pleroma container with traefik-compatible labels.
|
|
|
|
|
These will be picked up at runtime to dynamically create a reverse-proxy configuration.
|
|
|
|
|
This should 'just work' if `watch=true` and `exposedByDefault=false` are set in the `[docker]` section of your `traefik.conf`.
|
|
|
|
|
SSL will also 'just work' once you add a matching `[[acme.domains]]` entry in there.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
|
|
|
|
##### NGINX
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
In nginx-mode we will generate a bare nginx container that is linked to pleroma.
|
|
|
|
|
The nginx container is absolutely unmodified and expects to be configured by you.
|
|
|
|
|
The nginx file in [Pleroma's Repository](https://git.pleroma.social/pleroma/pleroma/blob/develop/installation/pleroma.nginx) is a good starting point.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
|
|
|
|
We will mount your configs like this:
|
2019-01-10 00:06:29 +00:00
|
|
|
|
```txt
|
2018-06-03 22:11:12 +00:00
|
|
|
|
custom.d/server.nginx -> /etc/nginx/nginx.conf
|
|
|
|
|
custom.d/vhost.nginx -> /etc/nginx/conf.d/pleroma.conf
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To reach your pleroma container from inside nginx use `proxy_pass http://pleroma:4000;`.
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Set `SCRIPT_PORT_HTTP` and `SCRIPT_PORT_HTTPS` to the ports you want to listen on.<br>
|
2018-06-03 22:11:12 +00:00
|
|
|
|
Specify the ip to bind to in `SCRIPT_BIND_IP`. These values are required.
|
|
|
|
|
|
|
|
|
|
The container only listens on `SCRIPT_PORT_HTTPS` if `SCRIPT_ENABLE_SSL` is `true`.
|
|
|
|
|
|
|
|
|
|
##### Apache / httpd
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
Just like nginx-mode this starts an unmodified apache server that expects to be configured by you.<br>
|
|
|
|
|
Again [Pleroma's Config](https://git.pleroma.social/pleroma/pleroma/blob/develop/installation/pleroma-apache.conf) is a good starting point.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
|
|
|
|
We will mount your configs like this:
|
|
|
|
|
```
|
|
|
|
|
custom.d/server.httpd -> /usr/local/apache2/conf/httpd.conf
|
|
|
|
|
custom.d/vhost.httpd -> /usr/local/apache2/conf/extra/httpd-vhosts.conf
|
|
|
|
|
```
|
|
|
|
|
|
2018-06-04 12:25:01 +00:00
|
|
|
|
To reach your pleroma container from inside apache use `ProxyPass [loc] http://pleroma:4000/`.
|
2018-06-03 22:11:12 +00:00
|
|
|
|
|
|
|
|
|
Again setting `SCRIPT_PORT_HTTP`, `SCRIPT_PORT_HTTPS` and `SCRIPT_BIND_IP` is required.
|
|
|
|
|
|
|
|
|
|
The container only listens on `SCRIPT_PORT_HTTPS` if `SCRIPT_ENABLE_SSL` is `true`.
|
|
|
|
|
|
|
|
|
|
##### Manual
|
|
|
|
|
|
|
|
|
|
In manual mode we do not create any reverse proxy for you.
|
|
|
|
|
You'll have to figure something out on your own.
|
|
|
|
|
|
2019-01-10 00:06:29 +00:00
|
|
|
|
If `SCRIPT_BIND_IN_MANUAL` is `true` we will forward `pleroma:4000` to `${SCRIPT_BIND_IP}:${SCRIPT_PORT_HTTP}`.
|
|
|
|
|
|
|
|
|
|
**Pleroma's internal SSL implementation is currently not supported.**
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
#### SSL (`SCRIPT_ENABLE_SSL`)
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
Values: `true` / `false`
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
If you want to use SSL with your Apache or NGINX containers you'll need a
|
|
|
|
|
certificate. Certificates need to be placed into `custom.d` and will be
|
|
|
|
|
bind-mounted into the server's container at runtime.
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
We will mount your certs like this:
|
|
|
|
|
```
|
|
|
|
|
custom.d/ssl.crt -> /ssl/ssl.crt
|
|
|
|
|
custom.d/ssl.key -> /ssl/ssl.key
|
|
|
|
|
```
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
You can reference them in Apache like this:
|
|
|
|
|
```apache
|
|
|
|
|
<VirtualHost *:443>
|
|
|
|
|
SSLEngine on
|
|
|
|
|
SSLCertificateFile "/ssl/ssl.crt"
|
|
|
|
|
SSLCertificateKeyFile "/ssl/ssl.key"
|
|
|
|
|
</VirtualHost>
|
|
|
|
|
```
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-06-03 22:11:12 +00:00
|
|
|
|
And in NGINX like this:
|
|
|
|
|
```nginx
|
|
|
|
|
listen 443 ssl;
|
|
|
|
|
ssl_certificate /ssl/ssl.crt;
|
|
|
|
|
ssl_certificate_key /ssl/ssl.key;
|
|
|
|
|
```
|
2018-04-08 20:49:07 +00:00
|
|
|
|
|
2018-08-18 21:32:33 +00:00
|
|
|
|
In traefik-mode and manual-mode these files and the `SCRIPT_ENABLE_SSL` value are ignored.
|