mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-22 16:02:54 +03:00
email settings as ENV variables inside Docker containers
This commit is contained in:
parent
4bebdf4bec
commit
547bad01f1
5 changed files with 49 additions and 36 deletions
15
.env
15
.env
|
@ -1,10 +1,19 @@
|
|||
DB_USERNAME=easyappointments
|
||||
DB_NAME=easyappointments
|
||||
DB_USERNAME=easyapp
|
||||
DB_NAME=easyapp
|
||||
|
||||
# before deploying to production change to harder password
|
||||
DB_PASSWORD=change-that-password
|
||||
DB_PASSWORD=veryhardpassword
|
||||
|
||||
# change to you installation address
|
||||
APP_URL=localhost
|
||||
APP_HOST=0.0.0.0
|
||||
APP_PORT=80
|
||||
|
||||
# email settings - set to 'smtp' and provide SMTP settings if you want to send emails
|
||||
EMAIL_PROTOCOL=mail
|
||||
SMTP_HOST=smtp.gmail.com
|
||||
SMTP_USER=user
|
||||
SMTP_PASS=password
|
||||
SMTP_CRYPTO=ssl
|
||||
SMTP_PORT=25
|
||||
|
||||
|
|
|
@ -19,12 +19,9 @@ services:
|
|||
ports:
|
||||
- 80:80
|
||||
environment:
|
||||
- DB_NAME=${DB_NAME}
|
||||
- DB_USERNAME=${DB_USERNAME}
|
||||
- DB_PASSWORD=${DB_PASSWORD}
|
||||
- DB_HOST=database:3306
|
||||
- APP_URL=${APP_URL}
|
||||
- APP_HOST=${APP_HOST}
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- easy-appointments-storage:/app/src/storage
|
||||
restart: always
|
||||
|
|
|
@ -18,9 +18,8 @@ services:
|
|||
ports:
|
||||
- ${APP_HOST}:80:80
|
||||
environment:
|
||||
- DB_NAME=easyapp
|
||||
- DB_USERNAME=easyapp
|
||||
- DB_PASSWORD=veryhardpassword
|
||||
- DB_HOST=database:3306
|
||||
- APP_URL=localhost
|
||||
env_file:
|
||||
- .env
|
||||
restart: always
|
|
@ -1,23 +1,42 @@
|
|||
#!/usr/bin/env sh
|
||||
if [ "$1" == "run" ]; then
|
||||
|
||||
echo "Preparing Easy!Appointments production configuration.."
|
||||
|
||||
createAppSettings() {
|
||||
cp $PROJECT_DIR/config-sample.php $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_HOST = ''/DB_HOST = '$DB_HOST'/g" $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_USERNAME = ''/DB_USERNAME = '$DB_USERNAME'/g" $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_PASSWORD = ''/DB_PASSWORD = '$DB_PASSWORD'/g" $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_NAME = ''/DB_NAME = '$DB_NAME'/g" $PROJECT_DIR/config.php
|
||||
if [ "$EMAIL_PROTOCOL" == "smtp" ]; then
|
||||
echo "Setting up email..."
|
||||
sed -i "s/\$config\['protocol'\] = 'mail'/\$config['protocol'] = 'smtp'/g" $PROJECT_DIR/application/config/email.php
|
||||
sed -i "s#// \$config\['smtp_host'\] = ''#\$config['smtp_host'] = '$SMTP_HOST'#g" $PROJECT_DIR/application/config/email.php
|
||||
sed -i "s#// \$config\['smtp_user'\] = ''#\$config['smtp_user'] = '$SMTP_USER'#g" $PROJECT_DIR/application/config/email.php
|
||||
sed -i "s#// \$config\['smtp_pass'\] = ''#\$config['smtp_pass'] = '$SMTP_PASS'#g" $PROJECT_DIR/application/config/email.php
|
||||
sed -i "s#// \$config\['smtp_crypto'\] = 'ssl'#\$config['smtp_crypto'] = '$SMTP_CRYPTO'#g" $PROJECT_DIR/application/config/email.php
|
||||
sed -i "s#// \$config\['smtp_port'\] = 25#\$config['smtp_port'] = $SMTP_PORT#g" $PROJECT_DIR/application/config/email.php
|
||||
fi
|
||||
sed -i "s/url-to-easyappointments-directory/$APP_URL/g" $PROJECT_DIR/config.php
|
||||
}
|
||||
|
||||
updateApacheSettings() {
|
||||
sed -i "s#^DocumentRoot \".*#DocumentRoot \"$PROJECT_DIR\"#g" /etc/apache2/httpd.conf
|
||||
sed -i "s#/var/www/localhost/htdocs#$PROJECT_DIR#" /etc/apache2/httpd.conf
|
||||
printf "\n<Directory \"$PROJECT_DIR\">\n\tAllowOverride All\n</Directory>\n" >> /etc/apache2/httpd.conf
|
||||
|
||||
chown -R apache:apache $PROJECT_DIR
|
||||
chmod -R 777 $PROJECT_DIR/storage/uploads
|
||||
}
|
||||
|
||||
echo "Starting Easy!Appointments server.."
|
||||
|
||||
if [ "$1" == "run" ]; then
|
||||
|
||||
echo "Preparing Easy!Appointments production configuration.."
|
||||
|
||||
createAppSettings
|
||||
|
||||
updateApacheSettings
|
||||
|
||||
echo "Starting Easy!Appointments development server.."
|
||||
|
||||
exec httpd -D FOREGROUND
|
||||
|
||||
|
@ -25,24 +44,13 @@ elif [ "$1" == "dev" ]; then
|
|||
|
||||
echo "Preparing Easy!Appointments development configuration.."
|
||||
|
||||
if [ ! -e "$PROJECT_DIR/config.php" ]; then
|
||||
cp $PROJECT_DIR/config-sample.php $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_HOST = ''/DB_HOST = '$DB_HOST'/g" $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_USERNAME = ''/DB_USERNAME = '$DB_USERNAME'/g" $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_PASSWORD = ''/DB_PASSWORD = '$DB_PASSWORD'/g" $PROJECT_DIR/config.php
|
||||
sed -i "s/DB_NAME = ''/DB_NAME = '$DB_NAME'/g" $PROJECT_DIR/config.php
|
||||
|
||||
createAppSettings
|
||||
sed -i "s/DEBUG_MODE = FALSE/DEBUG_MODE = TRUE/g" $PROJECT_DIR/config.php
|
||||
sed -i "s/url-to-easyappointments-directory/$APP_URL/g" $PROJECT_DIR/config.php
|
||||
fi
|
||||
|
||||
sed -i "s#^DocumentRoot \".*#DocumentRoot \"$PROJECT_DIR\"#g" /etc/apache2/httpd.conf
|
||||
sed -i "s#/var/www/localhost/htdocs#$PROJECT_DIR#" /etc/apache2/httpd.conf
|
||||
printf "\n<Directory \"$PROJECT_DIR\">\n\tAllowOverride All\n</Directory>\n" >> /etc/apache2/httpd.conf
|
||||
updateApacheSettings
|
||||
|
||||
chown -R apache:apache $PROJECT_DIR
|
||||
chmod -R 777 $PROJECT_DIR/storage/uploads
|
||||
|
||||
echo "Starting Easy!Appointments server.."
|
||||
echo "Starting Easy!Appointments production server.."
|
||||
|
||||
exec httpd -D FOREGROUND
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue