diff --git a/affine/deploy.sh b/affine/deploy.sh index fc66b5a..43c8d1f 100755 --- a/affine/deploy.sh +++ b/affine/deploy.sh @@ -49,7 +49,6 @@ podman generate systemd \ --files --restart-policy always --container-prefix=affine > /dev/null mv $CONTAINER_PREFIX-$CONTAINER_POSTGRES.service ./systemd-units/ -USER_SYSTEMD="$HOME/.config/systemd/user" mkdir -p $USER_SYSTEMD cp ./systemd-units/*.service $USER_SYSTEMD systemctl --user daemon-reexec @@ -84,6 +83,11 @@ podman create \ -p $AFFINE_PORT:3010 \ -e REDIS_SERVER_HOST=$REDIS_SERVER_HOST \ -e DATABASE_URL="postgresql://$DB_USERNAME:$DB_PASSWORD@$DATABASE_HOST:$DATABASE_PORT/$DB_DATABASE" \ + -e MAILER_HOST=$SMTP_HOST \ + -e MAILER_SENDER=$SMTP_FROM \ + -e MAILER_PORT=$SMTP_PORT \ + -e MAILER_USER=$SMTP_USERNAME \ + -e MAILER_PASSWORD=$SMTP_PASSWORD \ -v "$UPLOAD_LOCATION:/root/.affine/storage:Z" \ -v "$CONFIG_LOCATION:/root/.affine/config:Z" \ ghcr.io/toeverything/affine-graphql:$AFFINE_REVISION @@ -102,4 +106,34 @@ systemctl --user start $CONTAINER_PREFIX-$CONTAINER_SERVER.service rm -r ./systemd-units +# generate haproxy blocks +sudo mkdir -p $SERVICE_DIR +echo "crt $SSL_PATH/fullchain.pem" | sudo tee $SERVICE_DIR/cert.block > /dev/null +ACL_CFG=$(cat < /dev/null +BACKEND_CFG=$(cat < /dev/null + sudo loginctl enable-linger $USER \ No newline at end of file diff --git a/affine/env.sh b/affine/env.sh index 15aee6e..c7b98e2 100644 --- a/affine/env.sh +++ b/affine/env.sh @@ -3,6 +3,8 @@ AFFINE_REVISION=stable NETWORK="affine_net" +DOMAIN="" + # set the port for the server container it will expose the server on AFFINE_PORT=3010 @@ -19,6 +21,13 @@ UPLOAD_LOCATION=$HOME/.affine/self-host/storage # position of the configuration files to persist CONFIG_LOCATION=$HOME/.affine/self-host/config +# mailer +SMTP_HOST="" +SMTP_FROM="" +SMTP_PORT="587" +SMTP_USERNAME="" +SMTP_PASSWORD="" + REDIS_SERVER_HOST="host.containers.internal" REDIS_SERVER_PORT="6379" @@ -33,4 +42,11 @@ DB_DATABASE=affine CONTAINER_PREFIX="affine" CONTAINER_REDIS="affine_redis" CONTAINER_POSTGRES="affine_postgres" -CONTAINER_SERVER="affine_server" \ No newline at end of file +CONTAINER_SERVER="affine_server" + +USER_SYSTEMD="$HOME/.config/systemd/user" + +SSL_PATH=$HOME/.config/ssl/$DOMAIN +HAPROXY_CFG_DIR="/etc/haproxy" +HAPROXY_CFG="$HAPROXY_CFG_DIR/haproxy.cfg" +SERVICE_DIR="$HAPROXY_CFG_DIR/services/$DOMAIN" \ No newline at end of file