Compare commits

...

3 commits

8 changed files with 146 additions and 19 deletions

46
Dockerfile.pleroma-source Normal file
View file

@ -0,0 +1,46 @@
FROM elixir:1.11.4-alpine
ARG PLEROMA_VER=develop
ARG UID=911
ARG GID=911
ENV MIX_ENV=prod
RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories \
&& apk update \
&& apk add git gcc g++ musl-dev make cmake file-dev \
exiftool imagemagick libmagic ncurses postgresql-client ffmpeg
RUN addgroup -g ${GID} pleroma \
&& adduser -h /pleroma -s /bin/false -D -G pleroma -u ${UID} pleroma
ARG DATA=/var/lib/pleroma
RUN mkdir -p /etc/pleroma \
&& chown -R pleroma /etc/pleroma \
&& mkdir -p ${DATA}/uploads \
&& mkdir -p ${DATA}/static \
&& chown -R pleroma ${DATA}
USER pleroma
WORKDIR /pleroma
RUN git clone -b develop https://git.pleroma.social/pleroma/pleroma.git /pleroma \
&& git checkout ${PLEROMA_VER}
USER root
COPY ./minica.pem /usr/local/share/ca-certificates/minica.crt
RUN update-ca-certificates
USER pleroma
RUN mix local.hex --force \
&& mix local.rebar --force \
&& mix deps.get --only prod \
&& mix deps.compile --only prod \
&& mix compile --only prod
COPY ./files/pleroma.exs config/prod.secret.exs
COPY ./files/pleroma_source_entrypoint.sh docker-entrypoint.sh
EXPOSE 4000
ENTRYPOINT ["/pleroma/docker-entrypoint.sh"]

View file

@ -10,8 +10,8 @@ mastodon is TODO.
add the following to your `/etc/hosts` add the following to your `/etc/hosts`
``` ```
127.0.0.1 pleroma.pubtester.local localhost 127.0.0.1 pleroma.pubtester.example.net localhost
127.0.0.1 pleroma2.pubtester.local localhost 127.0.0.1 pleroma2.pubtester.example.net localhost
``` ```
run run
@ -20,3 +20,20 @@ git clone ... && cd pubtester
./pleroma_setup.sh ./pleroma_setup.sh
docker-compose up -d pleroma_web pleroma2_web nginx docker-compose up -d pleroma_web pleroma2_web nginx
``` ```
then go to `https://pleroma.pubtester.example.net:20000/main/friends`
and also `https://pleroma2.pubtester.example.net:20000/main/friends`
## emit new minica certs
this is generally for myself: https://github.com/jsha/minica
`minica -domains 'pubtester.example.net,*.pubtester.example.net'`
## wipe everything
```
sudo rm -rfv ./data
./pleroma_setup.sh
```

View file

@ -6,14 +6,12 @@ services:
healthcheck: healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres'] test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes: volumes:
- ./data/pleroma/postgres14:/var/lib/postgresql/data - ./data/pleroma/postgres15:/var/lib/postgresql/data
environment: environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust' - 'POSTGRES_HOST_AUTH_METHOD=trust'
- 'POSTGRES_USER=pleroma' - 'POSTGRES_USER=pleroma'
- 'POSTGRES_PASSWORD=very_secure_pleroma_password' - 'POSTGRES_PASSWORD=very_secure_pleroma_password'
- 'POSTGRES_DB=pleroma' - 'POSTGRES_DB=pleroma'
#pleroma:
# image: git.pleroma.social:5050/pleroma/pleroma:release-2-4-1
pleroma_web: pleroma_web:
image: pleroma_selfbuilt image: pleroma_selfbuilt
@ -39,7 +37,7 @@ services:
- ./data/pleroma/static:/var/lib/pleroma/static - ./data/pleroma/static:/var/lib/pleroma/static
- ./files/pleroma.exs:/etc/pleroma/config.exs:ro - ./files/pleroma.exs:/etc/pleroma/config.exs:ro
environment: environment:
DOMAIN: pleroma.pubtester.local DOMAIN: pleroma.pubtester.example.net
INSTANCE_NAME: Pleroma/pubtester INSTANCE_NAME: Pleroma/pubtester
ADMIN_EMAIL: admin@example.com ADMIN_EMAIL: admin@example.com
NOTIFY_EMAIL: notify@example.com NOTIFY_EMAIL: notify@example.com
@ -55,13 +53,14 @@ services:
healthcheck: healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres'] test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes: volumes:
- ./data/pleroma2/postgres14:/var/lib/postgresql/data - ./data/pleroma2/postgres15:/var/lib/postgresql/data
environment: environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust' - 'POSTGRES_HOST_AUTH_METHOD=trust'
- 'POSTGRES_USER=pleroma' - 'POSTGRES_USER=pleroma'
- 'POSTGRES_PASSWORD=very_secure_pleroma_password' - 'POSTGRES_PASSWORD=very_secure_pleroma_password'
- 'POSTGRES_DB=pleroma' - 'POSTGRES_DB=pleroma'
pleroma2_web: pleroma2_web:
# use pleroma_source_selfbuilt if patching pleroma
image: pleroma_selfbuilt image: pleroma_selfbuilt
healthcheck: healthcheck:
test: test:
@ -74,8 +73,6 @@ services:
- '127.0.0.1:20710:4000' - '127.0.0.1:20710:4000'
build: build:
context: . context: .
# Feel free to remove or override this section
# See 'Build-time variables' in README.md
args: args:
- "UID=1000" - "UID=1000"
- "GID=1000" - "GID=1000"
@ -83,9 +80,12 @@ services:
volumes: volumes:
- ./data/pleroma2/uploads:/var/lib/pleroma/uploads - ./data/pleroma2/uploads:/var/lib/pleroma/uploads
- ./data/pleroma2/static:/var/lib/pleroma/static - ./data/pleroma2/static:/var/lib/pleroma/static
- ./files/pleroma.exs:/etc/pleroma/config.exs:ro - ./files/pleroma.exs:/pleroma/config/prod.secret.exs:ro
# dev patches
#- /home/luna/git/pleroma/lib/pleroma/formatter.ex:/pleroma/lib/pleroma/formatter.ex:ro
#- /home/luna/git/pleroma/deps/linkify/lib/linkify/parser.ex:/pleroma/deps/linkify/lib/linkify/parser.ex:ro
environment: environment:
DOMAIN: pleroma2.pubtester.local DOMAIN: pleroma2.pubtester.example.net
INSTANCE_NAME: Pleroma/pubtester2 INSTANCE_NAME: Pleroma/pubtester2
ADMIN_EMAIL: admin@example.com ADMIN_EMAIL: admin@example.com
NOTIFY_EMAIL: notify@example.com NOTIFY_EMAIL: notify@example.com
@ -163,12 +163,12 @@ services:
networks: networks:
default: default:
aliases: aliases:
- pleroma.pubtester.local - pleroma.pubtester.example.net
- pleroma2.pubtester.local - pleroma2.pubtester.example.net
volumes: volumes:
- ./files/nginx.conf:/etc/nginx/nginx.conf:ro - ./files/nginx.conf:/etc/nginx/nginx.conf:ro
- ./pubtester.local/cert.pem:/etc/nginx/cert.pem:ro - ./pubtester.example.net/cert.pem:/etc/nginx/cert.pem:ro
- ./pubtester.local/key.pem:/etc/nginx/key.pem:ro - ./pubtester.example.net/key.pem:/etc/nginx/key.pem:ro
ports: ports:
- '127.0.0.1:20000:443' - '127.0.0.1:20000:443'
depends_on: depends_on:

View file

@ -36,7 +36,7 @@ http {
# root /mnt/none; # root /mnt/none;
# index index.html index.htm; # index index.html index.htm;
# server_name mastodon.pubtester.local; # server_name mastodon.pubtester.example.net;
# absolute_redirect off; # absolute_redirect off;
# server_name_in_redirect off; # server_name_in_redirect off;
@ -73,7 +73,7 @@ http {
root /mnt/none; root /mnt/none;
index index.html index.htm; index index.html index.htm;
server_name pleroma.pubtester.local; server_name pleroma.pubtester.example.net;
absolute_redirect off; absolute_redirect off;
server_name_in_redirect off; server_name_in_redirect off;
@ -98,7 +98,7 @@ http {
root /mnt/none; root /mnt/none;
index index.html index.htm; index index.html index.htm;
server_name pleroma2.pubtester.local; server_name pleroma2.pubtester.example.net;
absolute_redirect off; absolute_redirect off;
server_name_in_redirect off; server_name_in_redirect off;

View file

@ -0,0 +1,14 @@
#!/bin/ash
set -eux
echo "-- Waiting for database..."
while ! pg_isready -U ${DB_USER:-pleroma} -d postgres://${DB_HOST:-db}:${DB_PORT:-5432}/${DB_NAME:-pleroma} -t 1; do
sleep 1s
done
echo "-- Running migrations..."
mix ecto.migrate
echo "-- Starting!"
mix phx.server

View file

@ -2,9 +2,10 @@
# #
# setup pleroma db # setup pleroma db
set -eux
docker-compose up -d pleroma_db docker-compose up -d pleroma_db
docker-compose up -d pleroma2_db docker-compose up -d pleroma2_db
sleep 10 sleep 10 # waiting for databases to warm up
docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS citext;" docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS citext;"
docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" docker-compose exec -i pleroma_db psql -U pleroma -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
docker-compose exec -i pleroma_db psql -U pleroma -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";' docker-compose exec -i pleroma_db psql -U pleroma -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'
@ -14,3 +15,4 @@ docker-compose exec -i pleroma2_db psql -U pleroma -c 'CREATE EXTENSION IF NOT E
docker-compose down docker-compose down
docker buildx build -t pleroma_selfbuilt -f ./Dockerfile.pleroma . docker buildx build -t pleroma_selfbuilt -f ./Dockerfile.pleroma .
docker buildx build -t pleroma_source_selfbuilt -f ./Dockerfile.pleroma-source .

View file

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDXzCCAkegAwIBAgIIBFIfZ3oH+twwDQYJKoZIhvcNAQELBQAwIDEeMBwGA1UE
AxMVbWluaWNhIHJvb3QgY2EgMmY2YmZlMB4XDTIzMDEyMjIxMTEwMVoXDTI1MDIy
MTIxMTEwMVowIDEeMBwGA1UEAxMVcHVidGVzdGVyLmV4YW1wbGUubmV0MIIBIjAN
BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwRVaBdqT1/VamwA7pAA37bOG9GAW
zPXtB6WFg7GdGIhzXuq/qdjoO0HLHNoHP3uqRGrJvA0nJdnTs1gaNBUiNP6303LG
OHlIaa5B7tByAW/xtji6DuEhVnibiK3jSP4b6m5A6FDgr8qbjJMzHkrHYa3cN4Im
m7fJmHFyKpa6L2CXp+I+DqJt8FJtKfr1sYXkMr9QJdT6IqJ2ZGpH8GFYMoa2m9yz
uvBb7+LOm4v2CLLxl8ZJpwB7M/n+Ahf53s0gu0jjhkhSLig2EUsl/XFa0yYu7h9z
ZNz4wb/Lrgq5Dcc6JkVMNBR9GBx9VaxITcbNcL9r0vF+s3GkRHDNjddvAwIDAQAB
o4GcMIGZMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFj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