Fixing startup issues

This commit is contained in:
Aleksandr Bogdanov 2018-10-31 13:53:10 +01:00
parent e9fc6f58a3
commit 87ab3e10f3
5 changed files with 16 additions and 9 deletions

View file

@ -8,7 +8,7 @@
"version": "2.5.2", "version": "2.5.2",
"healthCheckPath": "/about", "healthCheckPath": "/about",
"httpPort": 8000, "httpPort": 8000,
"memoryLimit": 536870912, "memoryLimit": 671088640,
"addons": { "addons": {
"localstorage": {}, "localstorage": {},
"postgresql": {}, "postgresql": {},

View file

@ -41,6 +41,8 @@ RUN SECRET_KEY_BASE=insecure.secret_key_base OTP_SECRET=insecure.otp_secret \
RUN ln -fs /app/data/.env.production /app/code/.env.production RUN ln -fs /app/data/.env.production /app/code/.env.production
RUN ln -fs /app/data/bullet.log /app/code/log/bullet.log RUN ln -fs /app/data/bullet.log /app/code/log/bullet.log
RUN ln -fs /app/data/system /app/code/public/system RUN ln -fs /app/data/system /app/code/public/system
RUN rm -rf /app/code/tmp && ln -fs /tmp /app/code/tmp
CMD /app/code/start.sh CMD /app/code/start.sh
COPY nginx.conf /etc/nginx/sites-enabled/mastodon COPY nginx.conf /etc/nginx/sites-enabled/mastodon

View file

@ -20,6 +20,7 @@ services:
tmpfs: tmpfs:
- /run - /run
- /tmp - /tmp
read_only: true
postgres: postgres:
image: postgres image: postgres
environment: environment:

View file

@ -10,7 +10,7 @@ DB_PORT="${POSTGRESQL_PORT:-"5432"}"
DB_NAME="${POSTGRESQL_DATABASE:-"mastodon"}" DB_NAME="${POSTGRESQL_DATABASE:-"mastodon"}"
DB_USER="${POSTGRESQL_USERNAME:-"mastodon"}" DB_USER="${POSTGRESQL_USERNAME:-"mastodon"}"
DB_PASS="${POSTGRESQL_PASSWORD:-"mastodon"}" DB_PASS="${POSTGRESQL_PASSWORD:-"mastodon"}"
DATABASE_URL="${POSTGRESQL_URL:-"postgresql://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}"}" DATABASE_URL="${POSTGRESQL_URL:-"postgresql://${POSTGRESQL_USERNAME:-"mastodon"}:${POSTGRESQL_PASSWORD:-"mastodon"}@${POSTGRESQL_HOST:-"localhost"}:${POSTGRESQL_PORT:-"5432"}/${POSTGRESQL_DATABASE:-"mastodon"}"}"
REDIS_HOST="${REDIS_HOST:-"localhost"}" REDIS_HOST="${REDIS_HOST:-"localhost"}"
REDIS_PORT="${REDIS_PORT:-"6379"}" REDIS_PORT="${REDIS_PORT:-"6379"}"

View file

@ -2,20 +2,24 @@
echo "=>Configuring mastodon<=" echo "=>Configuring mastodon<="
bash /app/code/mastodon.env.template > /app/data/.env.production bash /app/code/mastodon.env.template > /app/data/.env.production
if ! [ -f /app/data/.keys.env ]; then if ! [ -d /app/data/system ]; then
echo "=>First run, generating keys and setting up the DB<=" echo "=>First run, generating keys and setting up the DB<="
export RANDFILE=/app/data/.rnd
echo -e "SECRET_KEY_BASE=$(openssl rand -hex 64)\nOTP_SECRET=$(openssl rand -hex 64)" > /app/data/.keys.env
source /app/data/.keys.env export RANDFILE=/tmp/.rnd
HOME=/app/data bundle exec rake mastodon:webpush:generate_vapid_key >> /app/data/.keys.env echo -e "SECRET_KEY_BASE=$(openssl rand -hex 64)\nOTP_SECRET=$(openssl rand -hex 64)" | \
tee /app/data/.keys.env >> /app/data/.env.production
HOME=/app/data bundle exec rake mastodon:webpush:generate_vapid_key | \
tee -a /app/data/.keys.env >> /app/data/.env.production
SAFETY_ASSURED=1 HOME=/app/data bundle exec rails db:schema:load db:seed SAFETY_ASSURED=1 HOME=/app/data bundle exec rails db:schema:load db:seed
# the app writes to the following dirs: # the app writes to the following dirs:
mkdir -p /app/data/system && chown cloudron:cloudron /app/data/system mkdir -p /app/data/system && chown cloudron:cloudron /app/data/system
fi
cat /app/data/.keys.env >> /app/data/.env.production else
cat /app/data/.keys.env >> /app/data/.env.production
fi
echo "=>Starting mastodon<=" echo "=>Starting mastodon<="