
12 changed files with 319 additions and 178 deletions
@ -1,26 +1,50 @@
@@ -1,26 +1,50 @@
|
||||
### Docker settings ### |
||||
|
||||
# The docker network to bind to. |
||||
# (Useful for reverse-proxies outside of this compose). |
||||
# (Defaults to "pleroma_docker_1") |
||||
DOCKER_NETWORK= |
||||
|
||||
# The directory where all containers store their data. |
||||
# Can be a relative path, "~/...", or absolute. |
||||
DOCKER_DATADIR= |
||||
|
||||
# Database settings |
||||
### Database settings ### |
||||
POSTGRES_DB= |
||||
POSTGRES_USER= |
||||
POSTGRES_PASSWORD= |
||||
|
||||
# Pleroma Settings |
||||
### Pleroma Settings ### |
||||
|
||||
# The env to use |
||||
MIX_ENV= |
||||
|
||||
# The git tag or branch to check out on build |
||||
PLEROMA_VERSION= |
||||
|
||||
# The domain/scheme/port where pleroma will be hosted |
||||
PLEROMA_URL= |
||||
PLEROMA_SCHEME= |
||||
PLEROMA_PORT= |
||||
|
||||
# The seed for your secret keys |
||||
# (Enter something as random as possible) |
||||
PLEROMA_SECRET_KEY_BASE= |
||||
|
||||
# The name of your instance |
||||
PLEROMA_NAME= |
||||
|
||||
# Your contact info |
||||
PLEROMA_ADMIN_EMAIL= |
||||
|
||||
# User settings |
||||
PLEROMA_USER_LIMIT= |
||||
PLEROMA_REGISTRATIONS_OPEN= |
||||
|
||||
# Media proxy |
||||
PLEROMA_MEDIA_PROXY_ENABLED= |
||||
PLEROMA_MEDIA_PROXY_REDIRECT_ON_FAILURE= |
||||
PLEROMA_MEDIA_PROXY_URL= |
||||
|
||||
# DB |
||||
PLEROMA_DB_POOL_SIZE= |
||||
|
@ -1,2 +1,73 @@
@@ -1,2 +1,73 @@
|
||||
data |
||||
.env |
||||
custom.d/ |
||||
!custom.d/.gitkeep |
||||
docker-compose.yml |
||||
|
||||
# Created by https://www.gitignore.io/api/osx,linux,windows |
||||
|
||||
### Linux ### |
||||
*~ |
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file |
||||
.fuse_hidden* |
||||
|
||||
# KDE directory preferences |
||||
.directory |
||||
|
||||
# Linux trash folder which might appear on any partition or disk |
||||
.Trash-* |
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed |
||||
.nfs* |
||||
|
||||
### OSX ### |
||||
*.DS_Store |
||||
.AppleDouble |
||||
.LSOverride |
||||
|
||||
# Icon must end with two \r |
||||
Icon |
||||
|
||||
# Thumbnails |
||||
._* |
||||
|
||||
# Files that might appear in the root of a volume |
||||
.DocumentRevisions-V100 |
||||
.fseventsd |
||||
.Spotlight-V100 |
||||
.TemporaryItems |
||||
.Trashes |
||||
.VolumeIcon.icns |
||||
.com.apple.timemachine.donotpresent |
||||
|
||||
# Directories potentially created on remote AFP share |
||||
.AppleDB |
||||
.AppleDesktop |
||||
Network Trash Folder |
||||
Temporary Items |
||||
.apdisk |
||||
|
||||
### Windows ### |
||||
# Windows thumbnail cache files |
||||
Thumbs.db |
||||
ehthumbs.db |
||||
ehthumbs_vista.db |
||||
|
||||
# Folder config file |
||||
Desktop.ini |
||||
|
||||
# Recycle Bin used on file shares |
||||
$RECYCLE.BIN/ |
||||
|
||||
# Windows Installer files |
||||
*.cab |
||||
*.msi |
||||
*.msm |
||||
*.msp |
||||
|
||||
# Windows shortcuts |
||||
*.lnk |
||||
|
||||
|
||||
# End of https://www.gitignore.io/api/osx,linux,windows |
||||
|
@ -1,6 +0,0 @@
@@ -1,6 +0,0 @@
|
||||
[submodule "pleroma"] |
||||
path = pleroma |
||||
url = git@git.pleroma.social:pleroma/pleroma.git |
||||
[submodule "camo"] |
||||
path = camo |
||||
url = https://github.com/atmos/camo.git |
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
# Pleroma-Docker |
||||
|
||||
[Pleroma](https://pleroma.social/) is a selfhosted social network that uses OStatus/ActivityPub. |
||||
|
||||
This repository is my attempt to dockerize it for easier deployment. |
||||
|
||||
## Features |
||||
|
||||
- 100% generic |
||||
- Everything is customizable |
||||
- Everything is configurable through `.env` files |
||||
- Zero special host dependencies |
||||
- "It just works" |
||||
|
||||
## Assumptions |
||||
|
||||
This repo assumes that you're using Træfik as your auto-configuring reverse proxy. |
||||
|
||||
## Tutorial |
||||
|
||||
- Make sure that `m4` and `docker-compose` are installed |
||||
- Check out this repo |
||||
- Create your env file (`cp .env.dist .env`) |
||||
- Edit the env values |
||||
- Run `./pleroma build` |
||||
- Run `./pleroma run` |
||||
- ... |
||||
- Profit! |
||||
|
||||
## Building an image |
||||
|
||||
Since this setup injects code into pleroma that moves it's configuration into the environment (ref ["The Twelve-Factor App"](https://12factor.net/)), the image is 100% reusable and can be shared/replicated across multiple hosts. To do that just run `./pleroma build` as usual and then tag your image to whatever you want. Just make sure to start the container with `env_file:` or all required `-e` pairs. |
||||
|
||||
## Customizing Pleroma |
||||
|
||||
Just 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. |
||||
|
||||
In general: Prepending `custom.d` to pleroma's customization guides should work all the time.<br> |
||||
Check them out in the [official pleroma wiki](https://git.pleroma.social/pleroma/pleroma/wikis/home). |
||||
|
||||
Here are a few customization examples: |
||||
|
||||
- I want to have a custom thumbnail |
||||
- Save it in `custom.d/priv/static/instance/thumbnail.jpeg` |
||||
|
||||
- I want to change the `config.json`. |
||||
- Just use [the template](https://git.pleroma.social/pleroma/pleroma/blob/develop/priv/static/static/config.json) and save it in `custom.d/priv/static/static/config.json` |
||||
|
||||
- I want to change the background |
||||
- Throw an image into `custom.d/priv/static/static` and then edit the config from above |
||||
|
||||
- I want a custom logo |
||||
- See above |
||||
|
||||
- I need blobs. Give me emojis. |
||||
- Save them in `custom.d/priv/static/emoji`. Then create and/or edit `custom.d/config/custom_emoji.txt`. |
||||
|
||||
- I want custom ToS |
||||
- Throw a HTML document to `priv/static/static/terms-of-service.html` |
||||
|
||||
You get the gist.<br> |
||||
Pretty basic stuff. |
@ -0,0 +1,108 @@
@@ -0,0 +1,108 @@
|
||||
#!/bin/bash |
||||
|
||||
set -e |
||||
|
||||
function log_generic { # $1: color, $2: prefix, $3: message # |
||||
echo -e "[$(tput setaf $1)$(tput bold)$2$(tput sgr0)] $3" |
||||
} |
||||
|
||||
function log_error { # $1: message # |
||||
log_generic 1 ERR "$1" |
||||
} |
||||
|
||||
function log_ok { # $1: message # |
||||
log_generic 2 "OK " "$1" |
||||
} |
||||
|
||||
function log_info { # $1: message # |
||||
log_generic 4 INF "$1" |
||||
} |
||||
|
||||
function print_help { |
||||
echo " |
||||
Pleroma Maintenance Script |
||||
|
||||
Usage: |
||||
$0 [action] [flags] |
||||
|
||||
Actions: |
||||
start Start pleroma and sibling services |
||||
stop Stop pleroma and sibling services |
||||
restart Executes #stop and #start respectively. |
||||
logs Show the current container logs |
||||
enter Enter the pleroma container for debugging/maintenance |
||||
" |
||||
} |
||||
|
||||
function run_dockerized { |
||||
log_info "Stopping existing containers (if any)" |
||||
docker-compose down |
||||
|
||||
log_info "Rebuilding images" |
||||
docker-compose build |
||||
|
||||
log_info "Running action '$1'" |
||||
docker-compose run server $1 |
||||
|
||||
log_info "Cleaning up.." |
||||
docker-compose down |
||||
} |
||||
|
||||
function action__start { |
||||
log_info "Booting pleroma" |
||||
docker-compose up --remove-orphans -d |
||||
log_ok "Done" |
||||
} |
||||
|
||||
function action__stop { |
||||
log_info "Stopping pleroma" |
||||
docker-compose down |
||||
log_ok "Done" |
||||
} |
||||
|
||||
function action__logs { |
||||
docker-compose logs -f |
||||
} |
||||
|
||||
function action__build { |
||||
docker-compose build |
||||
} |
||||
|
||||
function action__enter { |
||||
docker-compose exec server ash |
||||
} |
||||
|
||||
function prepare { |
||||
log_info "Preparing script" |
||||
m4 docker-compose.m4 > docker-compose.yml |
||||
} |
||||
|
||||
function cleanup { |
||||
log_info "Cleaning up" |
||||
rm docker-compose.yml |
||||
} |
||||
|
||||
trap "cleanup" INT TERM EXIT |
||||
|
||||
if [[ -z "$1" ]]; then |
||||
log_error "No action provided." |
||||
print_help |
||||
exit 1 |
||||
fi |
||||
|
||||
prepare |
||||
|
||||
case "$1" in |
||||
build) action__build;; |
||||
start) action__start;; |
||||
stop) action__stop;; |
||||
restart) action__start; action__stop; ;; |
||||
logs) action__logs;; |
||||
enter) action__enter;; |
||||
*) |
||||
log_error "The action '$1' is invalid." |
||||
print_help |
||||
exit 1 |
||||
;; |
||||
esac |
||||
shift |
@ -1,12 +1,25 @@
@@ -1,12 +1,25 @@
|
||||
FROM elixir:1.6-alpine |
||||
|
||||
RUN apk add --no-cache --virtual .build alpine-sdk git |
||||
WORKDIR /pleroma |
||||
|
||||
# Prepare system |
||||
RUN apk add --no-cache --virtual .build alpine-sdk git rsync |
||||
|
||||
# Perform a clone that can be cached |
||||
RUN git clone https://git.pleroma.social/pleroma/pleroma.git . |
||||
|
||||
# Prepare pleroma |
||||
ADD ./docker-config.exs /docker-config.exs |
||||
ARG PLEROMA_VERSION |
||||
RUN \ |
||||
git checkout $PLEROMA_VERSION && \ |
||||
git pull --rebase --autostash && \ |
||||
ln -s /docker-config.exs config/prod.secret.exs && \ |
||||
ln -s /docker-config.exs config/dev.secret.exs |
||||
|
||||
# Register entrypoint |
||||
ADD ./entrypoint.ash / |
||||
RUN chmod +x /entrypoint.ash |
||||
ENTRYPOINT ["/entrypoint.ash"] |
||||
CMD ["run"] |
||||
CMD ["/entrypoint.ash"] |
||||
|
||||
EXPOSE 4000 |
||||
|
@ -1,109 +0,0 @@
@@ -1,109 +0,0 @@
|
||||
#!/bin/bash |
||||
|
||||
set -e |
||||
|
||||
function log_generic { # $1: color, $2: prefix, $3: message # |
||||
echo -e "[$(tput setaf $1)$(tput bold)$2$(tput sgr0)] $3" |
||||
} |
||||
|
||||
function log_error { # $1: message # |
||||
log_generic 1 ERR "$1" |
||||
} |
||||
|
||||
function log_ok { # $1: message # |
||||
log_generic 2 "OK " "$1" |
||||
} |
||||
|
||||
function log_info { # $1: message # |
||||
log_generic 4 INF "$1" |
||||
} |
||||
|
||||
function print_help { |
||||
echo " |
||||
Pleroma Maintenance Script |
||||
|
||||
Usage: |
||||
$0 [action] [flags] |
||||
|
||||
Actions: |
||||
build Build the pleroma container and all dependencies |
||||
configure Runs the interactive configuration script |
||||
run Start pleroma and sibling services |
||||
stop Stop pleroma and sibling services |
||||
logs Show the current container logs |
||||
" |
||||
} |
||||
|
||||
function run_dockerized { |
||||
log_info "Stopping existing containers (if any)" |
||||
docker-compose down |
||||
|
||||
log_info "Rebuilding images" |
||||
docker-compose build |
||||
|
||||
log_info "Running action '$1'" |
||||
docker-compose run server $1 |
||||
|
||||
log_info "Cleaning up.." |
||||
docker-compose down |
||||
} |
||||
|
||||
function action__build { |
||||
run_dockerized "build" |
||||
log_ok "Done" |
||||
} |
||||
|
||||
function action__configure { |
||||
run_dockerized "configure" |
||||
log_ok "Done" |
||||
} |
||||
|
||||
function action__run { |
||||
log_info "Booting pleroma" |
||||
docker-compose up --remove-orphans -d |
||||
log_ok "Done" |
||||
} |
||||
|
||||
function action__stop { |
||||
log_info "Stopping pleroma" |
||||
docker-compose down |
||||
log_ok "Done" |
||||
} |
||||
|
||||
function action__logs { |
||||
docker-compose logs -f |
||||
} |
||||
|
||||
function prepare { |
||||
log_info "Preparing script" |
||||
m4 docker-compose.m4 > docker-compose.yml |
||||
} |
||||
|
||||
function cleanup { |
||||
log_info "Cleaning up" |
||||
rm docker-compose.yml |
||||
} |
||||
|
||||
trap "cleanup" INT TERM EXIT |
||||
|
||||
if [[ -z "$1" ]]; then |
||||
log_error "No action provided." |
||||
print_help |
||||
exit 1 |
||||
fi |
||||
|
||||
prepare |
||||
|
||||
case "$1" in |
||||
build) action__build;; |
||||
configure) action__configure;; |
||||
run) action__run;; |
||||
stop) action__stop;; |
||||
logs) action__logs;; |
||||
*) |
||||
log_error "The action '$1' is invalid." |
||||
print_help |
||||
exit 1 |
||||
;; |
||||
esac |
||||
shift |
Loading…
Reference in new issue