Compare commits

...

3 commits

9 changed files with 117 additions and 32 deletions

View file

@ -2,12 +2,10 @@
mkdir ./uploads ./static ./config -p
chown -R 911:911 ./uploads
if [ ! -f ./script_config.sh ]; then
cp ./script_config_sample.sh ./script_config.sh
fi
source ./script_config.sh
podman pod create \
--name rebased-pod \
-p 5000:5000
-p $PORT:5000

View file

@ -2,13 +2,5 @@
source ./script_config.sh
if [ ! -d ./build ]; then
git clone https://gitlab.com/soapbox-pub/rebased.git ./build
cd ./build
else
cd ./build
git pull
fi
podman build -f Dockerfile --build-arg="BUILD_DATE=$DATE" --build-arg="VCS_REF=$REBASED_VER" -t $REBASED_IMG
podman build -f Containerfile --build-arg="BUILD_DATE=$DATE" --build-arg="VCS_REF=$REBASED_VER" -t $REBASED_IMG

View file

@ -6,28 +6,20 @@ touch ./config/prod.secret.exs
echo Stopping old 'rebased-web' container...
podman stop rebased-web
podman rm rebased-web
chmod -R 777 uploads
echo Creating new 'rebased-web' container...
if [ ! -f ./config/prod.secret.exs ]; then
$conf=""
fi
podman run -d \
--name rebased-web \
--pod rebased-pod \
-e DB_USER=$PG_USER \
-e DB_PASS=$PG_PASS \
-e DB_NAME=$PG_NAME \
-e DB_HOST=$PG_HOST \
-v ./uploads:/var/lib/pleroma/uploads:z \
-v ./static:/var/lib/pleroma/static:z \
-v ./config:/config:rw \
-v ./config:/var/lib/pleroma/config \
-v ./config/prod.secret.exs:/var/lib/pleroma/config.exs \
-e DOMAIN=social.example.com \
-e INSTANCE_NAME=rebased \
-e ADMIN_EMAIL=admin@example.com \
-e NOTIFY_EMAIL=notify@example.com \
-e DB_USER=rebased \
-e DB_PASS=rebased \
-e DB_NAME=rebased \
-e DB_HOST=localhost \
-e POSTGRES_HOST=localhost \
$REBASED_IMG

View file

@ -2,7 +2,10 @@
source ./script_config.sh
podman exec -it --user=0 --privileged rebased-web /opt/pleroma/bin/pleroma_ctl instance gen
echo "Check files in config - if all looks good rename generated_config.exs to prod.secret.exs"
podman exec -it --user=0 rebased-web /opt/pleroma/bin/pleroma_ctl instance gen
podman exec rebased-web cat /src/config/generated_config.exs > ./config/prod.secret.exs
echo .
echo =========================
echo "Check ./config/prod.secret.exs and if all looks OK, restart rebased-web container"

14
50-create-user.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
admin=""
echo "Username:"
read -r user
echo "Email:"
read -r email
echo "Make Admin? (y/N)"
read -r makeadmin
if [[ $makeadmin == "y" ]]; then
admin="--admin"
fi
podman exec -it rebased-web /opt/pleroma/bin/pleroma_ctl user new $user $email $admin
echo Done.

71
Containerfile Normal file
View file

@ -0,0 +1,71 @@
FROM elixir:1.14.1-alpine as build
ARG MIX_ENV=prod \
OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft slack github keycloak:ueberauth_keycloak_strategy"
WORKDIR /src
RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories
RUN apk update &&\
apk add git bash gcc g++ musl-dev make cmake file-dev \
exiftool imagemagick libmagic ncurses postgresql-client ffmpeg
RUN git clone https://gitlab.com/soapbox-pub/rebased.git /src
RUN mix local.hex --force &&\
mix local.rebar --force
RUN cd /src &&\
mix deps.get --only prod &&\
mkdir release &&\
mix release --path release
ARG BUILD_DATE
ARG VCS_REF
ENV TZ="Etc/UTC"
LABEL maintainer="hello@soapbox.pub" \
org.opencontainers.image.title="rebased" \
org.opencontainers.image.description="Rebased" \
org.opencontainers.image.authors="hello@soapbox.pub" \
org.opencontainers.image.vendor="soapbox.pub" \
org.opencontainers.image.documentation="https://gitlab.com/soapbox-pub/rebased" \
org.opencontainers.image.licenses="AGPL-3.0" \
org.opencontainers.image.url="https://soapbox.pub" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE
ARG HOME=/opt/pleroma
ARG DATA=/var/lib/pleroma
RUN apk add curl ca-certificates imagemagick libmagic ffmpeg postgresql-client elixir
RUN git clone https://github.com/facebookresearch/fastText.git ./fasttext &&\
cd fasttext && make && ls
RUN addgroup rebased &&\
adduser --system --shell /bin/false -G rebased --home ${HOME} rebased &&\
mkdir -p ${DATA}/uploads &&\
mkdir -p ${DATA}/static &&\
chown -R rebased ${DATA} &&\
mkdir -p /etc/pleroma &&\
chown -R rebased /etc/pleroma &&\
mkdir -p /usr/share/fasttext &&\
curl -L https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.ftz -o /usr/share/fasttext/lid.176.ftz &&\
chmod 0644 /usr/share/fasttext/lid.176.ftz
RUN cp /src/fasttext/fasttext /usr/bin/fasttext
USER rebased
RUN cp -r /src/release/* ${HOME}
RUN cp /src/config/docker.exs /etc/pleroma/config.exs &&\
cp /src/docker-entrypoint.sh ${HOME}
RUN chown -R rebased ${HOME} ${DATA}
RUN chmod +x ${HOME}/docker-entrypoint.sh
EXPOSE 5000
WORKDIR /var/lib/pleroma
ENTRYPOINT ["/opt/pleroma/docker-entrypoint.sh"]

View file

@ -11,8 +11,10 @@ Its main advantages are its lightness and speed.
## Features
This podman set up is configured using the official Dockerfile at [Rebased GitLab](https://gitlab.com/soapbox-pub/rebased)
and working through each script will allow you to set up your own Rebased server.
This podman set up build and creates a Rebased container image using Alpine Linux.
Working through each script will allow you to set up your own Rebased server.
For a more "official" set up, please use the `ubuntu` branch of this repo which builds the image directly using Rebased's own Dockerfile.
## Build-time variables

View file

@ -1,10 +1,11 @@
#!/bin/bash
DATE=$(date +"%Y-%m-%d")
PG_USER=pleroma
PORT=5000
PG_USER=rebased
PG_PASS=rebased
PG_HOST=localhost
PG_NAME=pleroma
PG_NAME=rebased
REBASED_VER=develop
REBASED_IMG="rebased-$REBASED_VER-$DATE"

12
script_config_sample.sh Normal file
View file

@ -0,0 +1,12 @@
#!/bin/bash
DATE=$(date +"%Y-%m-%d")
PORT=5000
PG_USER=rebased
PG_PASS=rebased
PG_HOST=localhost
PG_NAME=rebased
REBASED_VER=develop
REBASED_IMG="rebased-$REBASED_VER-$DATE"
echo $REBASED_IMG