mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-21 23:42:21 +03:00
Merge branch 'Valian-develop' into develop
This commit is contained in:
commit
6c28b4c68f
6 changed files with 155 additions and 26 deletions
19
.env
Normal file
19
.env
Normal file
|
@ -0,0 +1,19 @@
|
|||
DB_USERNAME=easyapp
|
||||
DB_NAME=easyapp
|
||||
|
||||
# before deploying to production change to harder password, and don't commit it to git
|
||||
DB_PASSWORD=veryhardpassword
|
||||
|
||||
# change to your 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
|
||||
|
15
Dockerfile
15
Dockerfile
|
@ -1,5 +1,14 @@
|
|||
FROM tutum/apache-php
|
||||
FROM php:7.0-apache
|
||||
|
||||
MAINTAINER Alex Tselegidis <alextselegidis@gmail.com>
|
||||
ENV PROJECT_DIR=/var/www/html \
|
||||
APP_URL=localhost
|
||||
|
||||
EXPOSE 80
|
||||
RUN docker-php-ext-install mysqli gettext
|
||||
|
||||
COPY ./src $PROJECT_DIR
|
||||
COPY docker-entrypoint.sh /entrypoint.sh
|
||||
|
||||
VOLUME $PROJECT_DIR/storage
|
||||
|
||||
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
||||
CMD ["run"]
|
||||
|
|
19
README.md
19
README.md
|
@ -46,6 +46,25 @@ If you have problems installing or configuring the application take a look on th
|
|||
You can also report problems on the [issues page](https://github.com/alextselegidis/easyappointments/issues)
|
||||
and help the development progress.
|
||||
|
||||
### Docker
|
||||
To start Easy!Appointments using Docker in development configuration, with source files mounted into container, run:
|
||||
```
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
Production deployment can be made by changing required values in .env file (DB_PASSWORD, APP_URL, APP_PORT) and running:
|
||||
```
|
||||
docker-compose -f docker-compose.prod.yml up -d
|
||||
```
|
||||
|
||||
Database data will be stored in named volume `easyappointments_easy-appointments-data`, and app storage (logs, cache, uploads) in `easyappointments_easy-appointments-storage`.
|
||||
To find where exactly they are stored, you can run
|
||||
```
|
||||
docker volume inspect easyappointments_easy-appointments-storage
|
||||
```
|
||||
|
||||
Production containers will automatically be restarted in case of crash / server reboot. For more info, take a look into `docker-compose.prod.yml` file.
|
||||
|
||||
### User Feedback
|
||||
|
||||
Whether it is new ideas or defects, your feedback is highly appreciated and will be taken into
|
||||
|
|
31
docker-compose.prod.yml
Normal file
31
docker-compose.prod.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: '2'
|
||||
services:
|
||||
database:
|
||||
image: mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
|
||||
- MYSQL_DATABASE=${DB_NAME}
|
||||
- MYSQL_USER=${DB_USERNAME}
|
||||
- MYSQL_PASSWORD=${DB_PASSWORD}
|
||||
volumes:
|
||||
- easy-appointments-data:/var/lib/mysql
|
||||
restart: always
|
||||
|
||||
|
||||
application:
|
||||
image: easyappointments
|
||||
build:
|
||||
context: .
|
||||
ports:
|
||||
- 80:80
|
||||
environment:
|
||||
- DB_HOST=database:3306
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- easy-appointments-storage:/var/www/html/src/storage
|
||||
restart: always
|
||||
|
||||
volumes:
|
||||
easy-appointments-data:
|
||||
easy-appointments-storage:
|
|
@ -1,23 +1,27 @@
|
|||
storage:
|
||||
image: 'busybox:latest'
|
||||
volumes:
|
||||
- /var/lib/mysql
|
||||
- ./src:/app
|
||||
command: sleep 3153600000
|
||||
database:
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: root
|
||||
MYSQL_DATABASE: easyappointments
|
||||
volumes_from:
|
||||
- storage
|
||||
restart: always
|
||||
mem_limit: 200m
|
||||
app:
|
||||
build: ./
|
||||
ports:
|
||||
- 80:80
|
||||
links:
|
||||
- database:database
|
||||
volumes_from:
|
||||
- storage
|
||||
version: '2'
|
||||
services:
|
||||
database:
|
||||
image: mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=veryhardpassword
|
||||
- MYSQL_DATABASE=easyapp
|
||||
- MYSQL_USER=easyapp
|
||||
- MYSQL_PASSWORD=veryhardpassword
|
||||
|
||||
application:
|
||||
image: easyappointments
|
||||
build:
|
||||
context: .
|
||||
volumes:
|
||||
- ./src:/var/www/html
|
||||
command: dev
|
||||
ports:
|
||||
- ${APP_HOST}:80:80
|
||||
environment:
|
||||
- DB_HOST=database:3306
|
||||
- APP_URL=localhost
|
||||
depends_on:
|
||||
- database
|
||||
env_file:
|
||||
- .env
|
||||
restart: always
|
||||
|
|
47
docker-entrypoint.sh
Normal file
47
docker-entrypoint.sh
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
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
|
||||
|
||||
chown -R www-data $PROJECT_DIR
|
||||
}
|
||||
|
||||
|
||||
if [ "$1" = "run" ]; then
|
||||
|
||||
echo "Preparing Easy!Appointments production configuration.."
|
||||
|
||||
createAppSettings
|
||||
|
||||
echo "Starting Easy!Appointments production server.."
|
||||
|
||||
exec docker-php-entrypoint apache2-foreground
|
||||
|
||||
elif [ "$1" = "dev" ]; then
|
||||
|
||||
echo "Preparing Easy!Appointments development configuration.."
|
||||
|
||||
|
||||
createAppSettings
|
||||
sed -i "s/DEBUG_MODE = FALSE/DEBUG_MODE = TRUE/g" $PROJECT_DIR/config.php
|
||||
|
||||
echo "Starting Easy!Appointments production server.."
|
||||
|
||||
exec docker-php-entrypoint apache2-foreground
|
||||
fi
|
||||
|
||||
exec $@
|
Loading…
Reference in a new issue