Compare commits
15 Commits
healthchec
...
a80d553d09
Author | SHA1 | Date | |
---|---|---|---|
|
a80d553d09 | ||
|
298b6a3acc | ||
|
c8411e848c | ||
|
7995f16a68 | ||
|
9398a1b816 | ||
|
caf0252937 | ||
|
c1a919f228 | ||
|
f0dde31dee | ||
|
3e6bababac | ||
|
139cbf402b | ||
|
568f3a67f5 | ||
|
b20f3875b9 | ||
|
011bce7840 | ||
|
6f4747304a | ||
|
d417805d53 |
@@ -1,2 +1,3 @@
|
||||
data/
|
||||
cache/
|
||||
emoji/
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# Pleroma tag, commit, or branch to build
|
||||
PLEROMA_VERSION=master
|
||||
PLEROMA_VERSION=stable
|
||||
|
||||
# The directory where the containers store their stuff
|
||||
# Can be an absolute or relative path
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
data/
|
||||
cache/
|
||||
emoji/
|
||||
custom.d/
|
||||
!custom.d/.gitkeep
|
||||
config.exs
|
||||
|
25
Dockerfile
25
Dockerfile
@@ -1,4 +1,4 @@
|
||||
FROM alpine:3.10
|
||||
FROM alpine:3.12
|
||||
|
||||
ARG __VIA_SCRIPT
|
||||
RUN \
|
||||
@@ -25,12 +25,11 @@ RUN \
|
||||
git curl rsync postgresql-client \
|
||||
&& \
|
||||
apk add --no-cache --virtual .sdk \
|
||||
build-base \
|
||||
build-base cmake file-dev \
|
||||
&& \
|
||||
apk add --no-cache --virtual .runtime \
|
||||
imagemagick \
|
||||
elixir erlang erlang-runtime-tools \
|
||||
erlang-xmerl erlang-ssl erlang-ssh erlang-eldap erlang-mnesia
|
||||
elixir erlang erlang-dev
|
||||
|
||||
# Add entrypoint
|
||||
COPY ./entrypoint.sh /
|
||||
@@ -51,10 +50,17 @@ USER pleroma
|
||||
WORKDIR /home/pleroma
|
||||
|
||||
# Get pleroma sources
|
||||
#
|
||||
# Also make sure that instance/static/emoji exists.
|
||||
# Pleroma does not ship with an `instance` folder by default, causing docker to create `instance/static` for us at launch.
|
||||
# In itself that wouldn't be much of an issue, but said folder(s) are created as root:pleroma with 2755.
|
||||
# This breaks the custom.d step in entrypoint.sh which relies on writing there (See #10).
|
||||
#
|
||||
ARG PLEROMA_GIT_REPO
|
||||
RUN \
|
||||
echo "#> Getting pleroma sources from $PLEROMA_GIT_REPO..." 1>&2 && \
|
||||
git clone --progress $PLEROMA_GIT_REPO ./pleroma
|
||||
git clone --progress $PLEROMA_GIT_REPO ./pleroma && \
|
||||
mkdir -p ./pleroma/instance/static/emoji
|
||||
|
||||
WORKDIR /home/pleroma/pleroma
|
||||
|
||||
@@ -79,3 +85,12 @@ RUN \
|
||||
cp ./config/dev.exs ./config/prod.secret.exs && \
|
||||
BUILDTIME=1 /entrypoint.sh && \
|
||||
rm ./config/prod.secret.exs
|
||||
|
||||
# Register healthcheck
|
||||
# You might need to change these values on slow or busy servers.
|
||||
HEALTHCHECK \
|
||||
--interval=10s \
|
||||
--start-period=50s \
|
||||
--timeout=4s \
|
||||
--retries=3 \
|
||||
CMD curl -sSLf http://localhost:4000/api/pleroma/healthcheck || exit 1
|
||||
|
66
README.md
66
README.md
@@ -26,10 +26,15 @@ This repository dockerizes it for easier deployment.
|
||||
|
||||
## In the Wild
|
||||
|
||||
My own instance is managed by this script.<br>
|
||||
Take a look at [hosted/pleroma](https://glitch.sh/hosted/pleroma) if you get stuck or need some inspiration.
|
||||
`cofe.rocks` is always managed by this script.<br/>
|
||||
Take a look at [hosted/pleroma](/hosted/pleroma) if you get stuck or need some inspiration.
|
||||
|
||||
Does your instance use pleroma-docker?<br>
|
||||
Additionally it's known to run on (in no particular order):
|
||||
- social.interhop.org
|
||||
- social.technodruide.ca
|
||||
- toot.poto.cafe
|
||||
|
||||
Does your instance use pleroma-docker?<br/>
|
||||
Let me know and I'll add you to this list.
|
||||
|
||||
## Docs
|
||||
@@ -37,7 +42,7 @@ Let me know and I'll add you to this list.
|
||||
These docs assume that you have at least a basic understanding
|
||||
of the pleroma installation process and common docker commands.
|
||||
|
||||
If you have questions about Pleroma head over to https://docs.pleroma.social/.<br>
|
||||
If you have questions about Pleroma head over to https://docs.pleroma.social/.
|
||||
For help with docker check out https://docs.docker.com/.
|
||||
|
||||
For other problems related to this script, contact me or open an issue :)
|
||||
@@ -58,61 +63,54 @@ For other problems related to this script, contact me or open an issue :)
|
||||
- [Configure a reverse-proxy](#my-instance-is-up-how-do-i-reach-it)
|
||||
- Profit!
|
||||
|
||||
Hint:<br>
|
||||
You can also use normal `docker-compose` commands to maintain your setup.<br>
|
||||
Hint:
|
||||
You can also use normal `docker-compose` commands to maintain your setup.<br/>
|
||||
The only command that you cannot use is `docker-compose build` due to build caching.
|
||||
|
||||
### Configuration
|
||||
|
||||
All the pleroma options that you usually put into your `*.secret.exs` now go into `config.exs`.
|
||||
|
||||
`.env` stores config values that need to be known at orchestration/build time.<br>
|
||||
All the pleroma options that you usually put into your `*.secret.exs` now go into `config.exs`.<br/>
|
||||
`.env` stores config values that need to be known at orchestration/build time.<br/>
|
||||
Documentation for the possible values is inside of that file.
|
||||
|
||||
### Updates
|
||||
|
||||
Run `./pleroma.sh build` again and start the updated image with `./pleroma.sh up`.
|
||||
|
||||
Run `./pleroma.sh build` again and start the updated image with `./pleroma.sh up`.<br/>
|
||||
You don't need to stop your pleroma server for either of those commands.
|
||||
|
||||
### Maintenance
|
||||
|
||||
Pleroma maintenance is usually done with mix tasks.
|
||||
|
||||
You can run these tasks in your running pleroma server using `./pleroma.sh mix [task] [arguments...]`.
|
||||
|
||||
For example: `./pleroma.sh mix pleroma.user new sn0w ...`
|
||||
|
||||
Pleroma maintenance is usually done with mix tasks.<br/>
|
||||
You can run these tasks in your running pleroma server using `./pleroma.sh mix [task] [arguments...]`.<br/>
|
||||
For example: `./pleroma.sh mix pleroma.user new sn0w ...`<br/>
|
||||
If you need to fix bigger problems you can also spawn a shell with `./pleroma.sh enter`.
|
||||
|
||||
### Customization
|
||||
|
||||
Add your customizations (and their folder structure) to `custom.d/`.<br>
|
||||
They will be copied into the right place when the container starts.<br>
|
||||
You can even replace/patch pleroma’s code with this,
|
||||
because the project is recompiled at startup if needed.
|
||||
Add your customizations (and their folder structure) to `custom.d/`.<br/>
|
||||
They will be copied into the right place when the container starts.<br/>
|
||||
You can even replace/patch pleroma’s code with this, because the project is recompiled at startup if needed.
|
||||
|
||||
In general: Prepending `custom.d/` to pleroma’s customization guides should work all the time.<br>
|
||||
In general: Prepending `custom.d/` to pleroma’s customization guides should work all the time.<br/>
|
||||
Check them out in the [pleroma documentation](https://docs.pleroma.social/small_customizations.html#content).
|
||||
|
||||
For example: A custom thumbnail now goes into `custom.d/` + `priv/static/instance/thumbnail.jpeg`.
|
||||
For example: A custom thumbnail now goes into `custom.d/` + `instance/static/instance/thumbnail.jpeg`.
|
||||
|
||||
### Patches
|
||||
|
||||
Works exactly like customization, but we have a neat little helper here.
|
||||
|
||||
Works exactly like customization, but we have a neat little helper here.<br/>
|
||||
Use `./pleroma.sh mod [regex]` to mod any file that ships with pleroma, without having to type the complete path.
|
||||
|
||||
### My instance is up, how do I reach it?
|
||||
|
||||
To reach Gopher or SSH, just uncomment the port-forward in your `docker-compose.yml`.
|
||||
|
||||
To reach HTTP you will have to configure a "reverse-proxy".
|
||||
Older versions of this project contained a huge amount of scripting to support all kinds of reverse-proxy setups.
|
||||
This newer version tries to focus only on providing good pleroma tooling.
|
||||
To reach HTTP you will have to configure a "reverse-proxy".<br/>
|
||||
Older versions of this project contained a huge amount of scripting to support all kinds of reverse-proxy setups.<br/>
|
||||
This newer version tries to focus only on providing good pleroma tooling.<br/>
|
||||
That makes the whole process a bit more manual, but also more flexible.
|
||||
|
||||
You can use Caddy, Traefik, Apache, nginx, or whatever else you come up with.<br>
|
||||
You can use Caddy, Traefik, Apache, nginx, or whatever else you come up with.<br/>
|
||||
Just modify your `docker-compose.yml` accordingly.
|
||||
|
||||
One example would be to add an [nginx server](https://hub.docker.com/_/nginx) to your `docker-compose.yml`:
|
||||
@@ -136,18 +134,18 @@ Then take a look at [the pleroma nginx example](https://git.pleroma.social/plero
|
||||
|
||||
Using apache would work in a very similar way (see [Apache Docker Docs](https://hub.docker.com/_/httpd) and [the pleroma apache example](https://git.pleroma.social/pleroma/pleroma/blob/develop/installation/pleroma-apache.conf)).
|
||||
|
||||
The target that you proxy to is called `http://server:4000/`.<br>
|
||||
The target that you proxy to is called `http://server:4000/`.<br/>
|
||||
This will work automagically when the proxy also lives inside of docker.
|
||||
|
||||
If you need help with this, or if you think that this needs more documentation, please let me know.
|
||||
|
||||
Something that cofe.rocks uses is simple port-forwarding of the `server` container to the host's `127.0.0.1`.
|
||||
From there on, the natively installed nginx server acts as a proxy to the open internet.
|
||||
You can take a look at cofe's [compose yaml](https://glitch.sh/hosted/pleroma/src/branch/master/docker-compose.yml#L37) and [proxy config](https://glitch.sh/hosted/pleroma/src/branch/master/proxy.xconf) if that setup sounds interesting.
|
||||
Something that cofe.rocks uses is simple port-forwarding of the `server` container to the host's `127.0.0.1`.<br/>
|
||||
From there on, the natively installed nginx server acts as a proxy to the open internet.<br/>
|
||||
You can take a look at cofe's [compose yaml](/hosted/pleroma/src/branch/master/docker-compose.yml) and [proxy config](/hosted/pleroma/src/branch/master/proxy.xconf) if that setup sounds interesting.
|
||||
|
||||
### Attribution
|
||||
|
||||
Thanks to [Angristan](https://github.com/Angristan/dockerfiles/tree/master/pleroma) and [RX14](https://github.com/RX14/kurisu.rx14.co.uk/blob/master/services/iscute.moe/pleroma/Dockerfile) for their dockerfiles, which served as an inspiration for the early versions of this script.
|
||||
|
||||
The current version is based on the [offical install instructions](https://docs.pleroma.social/alpine_linux_en.html).<br>
|
||||
The current version is based on the [offical install instructions](https://docs.pleroma.social/alpine_linux_en.html).
|
||||
Thanks to all people who contributed to those.
|
||||
|
@@ -30,6 +30,9 @@ config :pleroma, Pleroma.Repo,
|
||||
# You should not change this.
|
||||
config :pleroma, Pleroma.Uploaders.Local, uploads: "/uploads"
|
||||
|
||||
config :pleroma, :instance,
|
||||
healthcheck: true
|
||||
|
||||
#
|
||||
# vvv Your awesome config options go here vvv
|
||||
#
|
||||
|
@@ -46,4 +46,5 @@ services:
|
||||
- ./custom.d:/custom.d:ro
|
||||
- ./config.exs:/home/pleroma/pleroma/config/prod.secret.exs:ro
|
||||
- ./config.exs:/home/pleroma/pleroma/config/dev.secret.exs:ro
|
||||
- ./emoji:/home/pleroma/pleroma/instance/static/emoji
|
||||
- $DOCKER_DATADIR/uploads:/uploads
|
||||
|
@@ -1,2 +1,3 @@
|
||||
CREATE EXTENSION IF NOT EXISTS citext;
|
||||
CREATE EXTENSION IF NOT EXISTS pg_trgm;
|
||||
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
|
||||
|
11
pleroma.sh
11
pleroma.sh
@@ -196,6 +196,15 @@ action__restart() {
|
||||
}
|
||||
|
||||
action__start() {
|
||||
if [[ ! -d ./data/uploads ]] || [[ ! -d ./emoji ]]; then
|
||||
if [[ "$(id -u)" != "$DOCKER_UID" ]]; then
|
||||
echo "Please create the folders ./data/uploads and ./emoji, and chown them to $DOCKER_UID"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p ./data/uploads ./emoji
|
||||
fi
|
||||
|
||||
docker_compose up --remove-orphans -d
|
||||
}
|
||||
|
||||
@@ -302,7 +311,7 @@ Actions:
|
||||
----------------------------
|
||||
|
||||
You can report bugs or contribute to this project at:
|
||||
https://glitch.sh/sn0w/pleroma-docker
|
||||
https://memleak.eu/sn0w/pleroma-docker
|
||||
"
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user