Use environment variables only (no .env file) and separate horizon
This commit is contained in:
parent
d327aeba2b
commit
cce25eb771
|
@ -1,40 +1,56 @@
|
||||||
---
|
---
|
||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
|
# In order to set configuration, please use a .env file in
|
||||||
|
# your compose project directory (the same directory as your
|
||||||
|
# docker-compose.yml), and set database options, application
|
||||||
|
# name, key, and other settings there.
|
||||||
|
# A list of available settings is available in .env.example
|
||||||
|
#
|
||||||
|
# The services should scale properly across a swarm cluster
|
||||||
|
# if the volumes are properly shared between cluster members.
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
pixelfed:
|
app:
|
||||||
build: .
|
# Uncomment to build a local copy of the image
|
||||||
|
# build: .
|
||||||
image: pixelfed
|
image: pixelfed
|
||||||
|
# If you have a traefik running, uncomment this to expose Pixelfed
|
||||||
|
# labels:
|
||||||
|
# - traefik.enable=true
|
||||||
|
# - traefik.frontend.rule=Host:your.url
|
||||||
|
# - traefik.port=80
|
||||||
|
env_file:
|
||||||
|
- ./.env
|
||||||
volumes:
|
volumes:
|
||||||
- "php-storage:/var/www/html"
|
- "app-storage:/var/www/storage"
|
||||||
networks:
|
networks:
|
||||||
- external
|
- external
|
||||||
- internal
|
- internal
|
||||||
environment:
|
|
||||||
# The full list of available variables is documented in docker/env
|
|
||||||
- DB_HOST=mysql
|
|
||||||
- DB_DATABASE=pixelfed
|
|
||||||
- DB_USERNAME=${DB_USERNAME:-pixelfed}
|
|
||||||
- DB_PASSWORD=${DB_PASSWORD:-pixelfed}
|
|
||||||
- REDIS_HOST=redis
|
|
||||||
- APP_KEY=SetYourAppKeyHere
|
|
||||||
- APP_NAME=Pixelfed
|
|
||||||
- APP_URL=https://your.url
|
|
||||||
- MAIL_HOST=mail.host
|
|
||||||
- MAIL_FROM_ADDRESS=noreply@your.url
|
|
||||||
- MAIL_FROM_NAME=Pixelfed
|
|
||||||
|
|
||||||
mysql:
|
# Uncomment if you set HORIZON_EMBED to false and wish to run a local worker
|
||||||
|
# worker:
|
||||||
|
# image: pixelfed
|
||||||
|
# env_file:
|
||||||
|
# - ./.env
|
||||||
|
# volumes:
|
||||||
|
# - "app-storage:/var/www/storage"
|
||||||
|
# networks:
|
||||||
|
# - internal
|
||||||
|
# command: php artisan horizon
|
||||||
|
|
||||||
|
db:
|
||||||
image: mysql:5.7
|
image: mysql:5.7
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
environment:
|
environment:
|
||||||
- MYSQL_DATABASE=pixelfed
|
- MYSQL_DATABASE=pixelfed
|
||||||
- MYSQL_USER=${DB_USERNAME:-pixelfed}
|
- MYSQL_USER=${DB_USERNAME}
|
||||||
- MYSQL_PASSWORD=${DB_PASSWORD:-pixelfed}
|
- MYSQL_PASSWORD=${DB_PASSWORD}
|
||||||
- MYSQL_RANDOM_ROOT_PASSWORD="true"
|
- MYSQL_RANDOM_ROOT_PASSWORD=true
|
||||||
volumes:
|
volumes:
|
||||||
- "mysql-data:/var/lib/mysql"
|
- "db-data:/var/lib/mysql"
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
|
@ -43,10 +59,11 @@ services:
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
|
|
||||||
|
# Adjust your volume data in order to store data where you wish
|
||||||
volumes:
|
volumes:
|
||||||
redis-data:
|
redis-data:
|
||||||
mysql-data:
|
db-data:
|
||||||
php-storage:
|
app-storage:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
internal:
|
internal:
|
||||||
|
|
|
@ -32,10 +32,27 @@ COPY . /var/www/
|
||||||
|
|
||||||
WORKDIR /var/www/
|
WORKDIR /var/www/
|
||||||
RUN cp -r storage storage.skel \
|
RUN cp -r storage storage.skel \
|
||||||
&& cp docker/env .env \
|
|
||||||
&& composer install --prefer-source --no-interaction \
|
&& composer install --prefer-source --no-interaction \
|
||||||
&& rm -rf html && ln -s public html
|
&& rm -rf html && ln -s public html
|
||||||
|
|
||||||
VOLUME ["/var/www/storage"]
|
VOLUME ["/var/www/storage"]
|
||||||
|
|
||||||
|
ENV APP_ENV=production \
|
||||||
|
APP_DEBUG=false \
|
||||||
|
LOG_CHANNEL=stderr \
|
||||||
|
DB_CONNECTION=mysql \
|
||||||
|
DB_PORT=3306 \
|
||||||
|
DB_HOST=db \
|
||||||
|
BROADCAST_DRIVER=log \
|
||||||
|
QUEUE_DRIVER=redis \
|
||||||
|
HORIZON_PREFIX=horizon-pixelfed \
|
||||||
|
REDIS_HOST=redis \
|
||||||
|
SESSION_SECURE_COOKIE=true \
|
||||||
|
API_BASE="/api/1/" \
|
||||||
|
API_SEARCH="/api/search" \
|
||||||
|
OPEN_REGISTRATION=true \
|
||||||
|
ENFORCE_EMAIL_VERIFICATION=true \
|
||||||
|
REMOTE_FOLLOW=false \
|
||||||
|
ACTIVITY_PUB=false
|
||||||
|
|
||||||
CMD /var/www/docker/start.sh
|
CMD /var/www/docker/start.sh
|
||||||
|
|
59
docker/env
59
docker/env
|
@ -1,59 +0,0 @@
|
||||||
APP_NAME="${APP_NAME}"
|
|
||||||
APP_ENV=local
|
|
||||||
APP_KEY="${APP_KEY}"
|
|
||||||
APP_DEBUG=false
|
|
||||||
APP_URL=${APP_URL}
|
|
||||||
|
|
||||||
LOG_CHANNEL=stderr
|
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST=${DB_HOST}
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_DATABASE="${DB_DATABASE}"
|
|
||||||
DB_USERNAME="${DB_USERNAME}"
|
|
||||||
DB_PASSWORD="${DB_PASSWORD}"
|
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
SESSION_DRIVER=file
|
|
||||||
SESSION_LIFETIME=120
|
|
||||||
QUEUE_DRIVER=redis
|
|
||||||
HORIZON_PREFIX=horizon-pixelfed
|
|
||||||
|
|
||||||
REDIS_HOST="${REDIS_HOST}"
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
MAIL_DRIVER=smtp
|
|
||||||
MAIL_HOST=${MAIL_HOST}
|
|
||||||
MAIL_PORT="${MAIL_PORT}"
|
|
||||||
MAIL_USERNAME="${MAIL_USERNAME}"
|
|
||||||
MAIL_PASSWORD="${MAIL_PASSWORD}"
|
|
||||||
MAIL_ENCRYPTION="${MAIL_ENCRYPTION}"
|
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
|
||||||
PUSHER_APP_KEY=
|
|
||||||
PUSHER_APP_SECRET=
|
|
||||||
PUSHER_APP_CLUSTER=mt1
|
|
||||||
|
|
||||||
SESSION_DOMAIN="${SESSION_DOMAIN}"
|
|
||||||
SESSION_SECURE_COOKIE=true
|
|
||||||
API_BASE="/api/1/"
|
|
||||||
API_SEARCH="/api/search"
|
|
||||||
|
|
||||||
OPEN_REGISTRATION=${OPEN_REGISTRATION}
|
|
||||||
MAX_CAPTION_LENGTH=${MAX_CAPTION_LENGTH}
|
|
||||||
MAX_PHOTO_SIZE=${MAX_PHOTO_SIZE}
|
|
||||||
ENFORCE_EMAIL_VERIFICATION=${ENFORCE_EMAIL_VERIFICATION}
|
|
||||||
REMOTE_FOLLOW=${REMOTE_FOLLOW}
|
|
||||||
ACTIVITY_PUB=${ACTIVITY_PUB}
|
|
||||||
|
|
||||||
RECAPTCHA_ENABLED=${RECAPTCHA_ENABLED}
|
|
||||||
RECAPTCHA_PUBLIC_KEY=${RECAPTCHA_PUBLIC_KEY}
|
|
||||||
RECAPTCHA_PRIVATE_KEY=${RECAPTCHA_PRIVATE_KEY}
|
|
||||||
|
|
||||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
|
||||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
||||||
MIX_APP_URL="${APP_URL}"
|
|
||||||
MIX_API_BASE="${API_BASE}"
|
|
||||||
MIX_API_SEARCH="${API_SEARCH}"
|
|
|
@ -1,13 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -o allexport
|
# Create the storage tree if needed and fix permissions
|
||||||
source .env
|
|
||||||
set +o allexport
|
|
||||||
|
|
||||||
cp -r storage.skel/* storage/
|
cp -r storage.skel/* storage/
|
||||||
chown -R www-data:www-data storage/
|
chown -R www-data:www-data storage/
|
||||||
php artisan migrate --force
|
|
||||||
php artisan storage:link
|
php artisan storage:link
|
||||||
|
|
||||||
php artisan horizon &
|
# Migrate database if the app was upgraded
|
||||||
|
php artisan migrate --force
|
||||||
|
|
||||||
|
# Run a worker if it is set as embedded
|
||||||
|
if [ HORIZON_EMBED = true ]; then
|
||||||
|
php artisan horizon &
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Finally run Apache
|
||||||
exec apache2-foreground
|
exec apache2-foreground
|
||||||
|
|
Loading…
Reference in a new issue