Use .env file instead of hard coded environment variables (#41)

Use .env file instead of hard coded environment variables
Steve Clement 2019-08-21 17:38:14 +02:00 committed by GitHub
commit 5d7bc41a28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 36 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.env
data

View File

@ -34,14 +34,8 @@ $ git clone https://github.com/MISP/misp-docker
$ cd misp-docker $ cd misp-docker
``` ```
## Fix your environment ## Fix your environment
Edit the docker-compose.yml and change the following environment variables: Copy template.env to .env (on the root directory) and edit the environment variables at .env file
* MYSQL_DATABASE
* MYSQL_USER
* MYSQL_PASSWORD
* MYSQL_ROOT_PASSWORD
* MYSQL_MISP_PASSWORD
* MISP_ADMIN_PASSPHRASE
* Changed the volumes to match your local filesystem
## Build the containers ## Build the containers
``` ```

View File

@ -18,27 +18,27 @@ services:
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /dev/urandom:/dev/random - /dev/urandom:/dev/random
- /data/misp/web:/var/www/MISP - ${DATA_DIR}/web:/var/www/MISP
environment: environment:
- MYSQL_HOST=db - MYSQL_HOST=db
- MYSQL_DATABASE=misp - MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=misp - MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=misp - MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MISP_ADMIN_EMAIL=admin@admin.test - MISP_ADMIN_EMAIL=${MISP_ADMIN_EMAIL}
- MISP_ADMIN_PASSPHRASE=admin - MISP_ADMIN_PASSPHRASE=${MISP_ADMIN_PASSPHRASE}
- MISP_BASEURL=http:\/\/misp\.test - MISP_BASEURL=${MISP_BASEURL}
- POSTFIX_RELAY_HOST=relay.fqdn - POSTFIX_RELAY_HOST=${POSTFIX_RELAY_HOST}
- TIMEZONE=Europe/Brussels - TIMEZONE=${TIMEZONE}
db: db:
container_name: misp_db container_name: misp_db
image: mysql/mysql-server:5.7 image: mysql/mysql-server:5.7
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /data/misp/db:/var/lib/mysql - ${DATA_DIR}/db:/var/lib/mysql
environment: environment:
- MYSQL_DATABASE=misp - MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=misp - MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=misp - MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=misp - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}

View File

@ -12,26 +12,26 @@ services:
- "80:80" - "80:80"
volumes: volumes:
- /dev/urandom:/dev/random - /dev/urandom:/dev/random
- /data/misp/web:/var/www/MISP - ${DATA_DIR}/web:/var/www/MISP
environment: environment:
- MYSQL_HOST=db - MYSQL_HOST=db
- MYSQL_DATABASE=misp - MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=misp - MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=misp - MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MISP_ADMIN_EMAIL=admin@admin.test - MISP_ADMIN_EMAIL=${MISP_ADMIN_EMAIL}
- MISP_ADMIN_PASSPHRASE=admin - MISP_ADMIN_PASSPHRASE=${MISP_ADMIN_PASSPHRASE}
- MISP_BASEURL=http:\/\/misp\.test - MISP_BASEURL=${MISP_BASEURL}
- POSTFIX_RELAY_HOST=relay.fqdn - POSTFIX_RELAY_HOST=${POSTFIX_RELAY_HOST}
- TIMEZONE=Europe/Brussels - TIMEZONE=${TIMEZONE}
db: db:
container_name: misp_db container_name: misp_db
image: mysql/mysql-server:5.7 image: mysql/mysql-server:5.7
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /data/misp/db:/var/lib/mysql - ${DATA_DIR}/db:/var/lib/mysql
environment: environment:
- MYSQL_DATABASE=misp - MYSQL_DATABASE=${MYSQL_DATABASE}
- MYSQL_USER=misp - MYSQL_USER=${MYSQL_USER}
- MYSQL_PASSWORD=misp - MYSQL_PASSWORD=${MYSQL_PASSWORD}
- MYSQL_ROOT_PASSWORD=misp - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}

13
template.env Normal file
View File

@ -0,0 +1,13 @@
MYSQL_DATABASE=misp
MYSQL_USER=misp
MYSQL_PASSWORD=misp
MYSQL_ROOT_PASSWORD=misp
MISP_ADMIN_EMAIL=admin@admin.test
MISP_ADMIN_PASSPHRASE=admin
MISP_BASEURL=localhost
POSTFIX_RELAY_HOST=relay.fqdn
TIMEZONE=Europe/Brussels
DATA_DIR=./data