# Pleroma

A light weight, general ActivityPub server. Think Twitter/Mastodon without the additional hardware needs.

## Inspiration / Further Reading

- [https://pleroma.social/](https://pleroma.social/)
- [https://git.pleroma.social/pleroma/pleroma](https://git.pleroma.social/pleroma/pleroma)

## Prep Install

``` bash

# Prep
mkdir -p /var/pleroma/config /var/pleroma/uploads
cd /var/pleroma
touch config/generated_config.exs
touch config/setup_db.psql

# Ensure we pull the right pleroma image for the board
ARCH=`arch`
if [ $ARCH == "aarch64" ]
then
    ARCH="arm64v8"
else
    ARCH="arm32v7"
fi

# Generate config / setup_db.psql
docker run --rm -it \
    -v ${PWD}/config/generated_config.exs:/app/pleroma/config/generated_config.exs \
    -v ${PWD}/config/setup_db.psql:/app/pleroma/config/setup_db.psql \
    --entrypoint /bin/bash \
    registry.lollipopcloud.solutions/$ARCH/pleroma:latest \
    -l -c "cd /app/pleroma && source ~/.bash_profile && mix pleroma.instance gen --force"

# Generate VAPID key needed by mastodon UI
docker run --rm -it \
    -v ${PWD}/config/generated_config.exs:/app/pleroma/config/generated_config.exs \
    -v ${PWD}/config/setup_db.psql:/app/pleroma/config/setup_db.psql \
    --entrypoint /bin/bash \
    registry.lollipopcloud.solutions/$ARCH/pleroma:latest \
    -l -c "cd /app/pleroma && source ~/.bash_profile && mix web_push.gen.keypair"

# Tweak config and setup database
nano -w config/generated_config.exs
mv config/generated_config.exs config/prod.secret.exs
sudo su postgres -c 'psql -f config/setup_db.psql'

```

## Install / Run

``` bash

cat > /root/pleroma.sh <<EOF
#!/bin/bash

ARCH=\`arch\`
if [ \$ARCH == "aarch64" ]
then
    ARCH="arm64v8"
else
    ARCH="arm32v7"
fi

docker pull registry.lollipopcloud.solutions/\$ARCH/pleroma:latest
docker rm -f pleroma

# If customizing the following example volumes should guide the way
#    -v /var/pleroma/custom.d/priv/static/instance:/app/pleroma/priv/static/instance \
#    -v /var/pleroma/custom.d/priv/static/favicon.png:/app/pleroma/priv/static/favicon.png \
#    -v /var/pleroma/custom.d/priv/static/static/black_background.jpg:/app/pleroma/priv/static/static/black_background.jpg \
#    -v /var/pleroma/custom.d/priv/static/static/config.json:/app/pleroma/priv/static/static/config.json \
#    -v /var/pleroma/custom.d/priv/static/static/logo.png:/app/pleroma/priv/static/static/logo.png \
#    -v /var/pleroma/uploads:/app/pleroma/uploads \
#    -v /var/pleroma/config/prod.secret.exs:/app/pleroma/config/prod.secret.exs \

docker run \\
    --name pleroma \\
    --restart unless-stopped \\
    --net docker-private \\
    --ip 172.30.12.22 \\
    -e TZ=UTC \\
    -e DEBUG=1 \\
    -v /var/pleroma/uploads:/app/pleroma/uploads \\
    -v /var/pleroma/config/prod.secret.exs:/app/pleroma/config/prod.secret.exs \\
    registry.lollipopcloud.solutions/\$ARCH/pleroma:latest

EOF

```

Simply execute ```/root/pleroma.sh``` to update/run Pleroma.
