Compare commits

..

1 Commits

Author SHA1 Message Date
3wc
3c9ea7e608 WIP: SMTP 2022-06-24 12:08:45 +01:00
5 changed files with 34 additions and 52 deletions

64
abra.sh
View File

@ -1,4 +1,4 @@
export APP_ENTRYPOINT_VERSION=v6
export APP_ENTRYPOINT_VERSION=v5
migrate() {
export DATABASE_PASSWORD=$(cat /run/secrets/db_password)
@ -6,14 +6,24 @@ migrate() {
yarn db:migrate --env=production-ssl-disabled
}
delete_user_by_id() {
delete_user() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: ... delete_user_by_id <userid-to-delete> <userid-to-replace>"
echo "Usage: ... delete_user <user-to-delete> <user-to-replace>"
exit 1
fi
USERID_REPLACE="$2"
USERID_REMOVE="$1"
USERID_REMOVE=$(echo "SELECT id FROM users WHERE username = '$1'" | psql -t -A -U outline outline)
USERID_REPLACE=$(echo "SELECT id FROM users WHERE username = '$2'" | psql -t -A -U outline outline)
if [ -z "$USERID_REMOVE" ]; then
echo "Can't find ID of '$1'"
exit 1
fi
if [ -z "$USERID_REPLACE" ]; then
echo "Can't find ID of '$2'"
exit 1
fi
psql -U outline outline <<- SQL
UPDATE documents SET "userId" = '$USERID_REPLACE' WHERE "userId" = '$USERID_REMOVE';
@ -31,48 +41,6 @@ delete_user_by_id() {
DELETE FROM notification_settings WHERE "userId" = '$USERID_REMOVE';
DELETE FROM events WHERE "actorId" = '$USERID_REMOVE';
DELETE FROM events WHERE "userId" = '$USERID_REMOVE';
DELETE FROM users WHERE "id" = '$USERID_REMOVE';
DELETE FROM users WHERE username = '$1';
SQL
}
delete_user() {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: ... delete_user <userid-to-delete> <userid-to-replace>"
exit 1
fi
USERID_REMOVE=$(echo "SELECT id FROM users WHERE username = '$1'" | psql -t -A -U outline outline)
USERID_REPLACE=$(echo "SELECT id FROM users WHERE username = '$2'" | psql -t -A -U outline outline)
if [ -z "$USERID_REMOVE" ]; then
echo "Can't find ID of '$1'"
exit 1
fi
if [ -z "$USERID_REPLACE" ]; then
echo "Can't find ID of '$2'"
exit 1
fi
delete_user_by_id "$USERID_REMOVE" "$USERID_REPLACE"
}
delete_duplicate_users() {
if [ -z "$1" ]; then
echo "Usage: ... delete_duplicate_users <username>"
exit 1
fi
USERIDS=$(echo "SELECT id FROM users WHERE username = '$1' ORDER BY users.\"createdAt\" DESC" | psql -t -A -U outline outline)
if [ ! "$(echo "$USERIDS" | wc -l)" -gt 1 ]; then
echo "Only one user exists, bailing"
exit 1
fi
USERID_NEW=$(echo "$USERIDS" | head -n1)
for USERID_OLD in $(echo "$USERIDS" | tail -n+2); do
delete_user_by_id "$USERID_OLD" "$USERID_NEW"
done
}

View File

@ -8,7 +8,6 @@ services:
environment:
- GOOGLE_CLIENT_ID
- GOOGLE_ENABLED
- ALLOWED_DOMAINS
secrets:
google_client_secret:

14
compose.smtp.yml Normal file
View File

@ -0,0 +1,14 @@
---
version: "3.8"
services:
app:
environment:
- SMTP_HOST
- SMTP_PORT
- SMTP_USERNAME
- SMTP_PASSWORD
- SMTP_FROM_EMAIL
- SMTP_REPLY_EMAIL
- SMTP_SECURE
- SMTP_TLS_CIPHERS

View File

@ -3,10 +3,11 @@ version: "3.8"
services:
app:
# entrypoint: ['tail', '-f', '/dev/null']
networks:
- backend
- proxy
image: outlinewiki/outline:0.67.2
image: outlinewiki/outline:0.64.3
secrets:
- aws_secret_key
- db_password
@ -17,6 +18,7 @@ services:
target: /docker-entrypoint.sh
mode: 0555
environment:
- DEBUG
- AWS_ACCESS_KEY_ID
- AWS_REGION
- AWS_S3_ACL
@ -43,7 +45,7 @@ services:
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`${EXTRA_DOMAINS})"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"
- "traefik.http.routers.${STACK_NAME}.tls.certresolver=${LETS_ENCRYPT_ENV}"
- "coop-cloud.${STACK_NAME}.version=0.5.0+0.67.2"
- "coop-cloud.${STACK_NAME}.version=0.4.0+0.64.3"
## Redirect from EXTRA_DOMAINS to DOMAIN
#- "traefik.http.routers.${STACK_NAME}.middlewares=${STACK_NAME}-redirect"
#- "traefik.http.middlewares.${STACK_NAME}-redirect.headers.SSLForceHost=true"

View File

@ -15,5 +15,4 @@ export SECRET_KEY=$(cat /run/secrets/secret_key)
export DATABASE_PASSWORD=$(cat /run/secrets/db_password)
export DATABASE_URL="postgres://outline:${DATABASE_PASSWORD}@${STACK_NAME}_db:5432/outline"
/usr/local/bin/yarn db:migrate --env=production-ssl-disabled
/usr/local/bin/yarn start "$@"