Add docker compose file and example env

This commit is contained in:
Brandon Sturgeon 2021-01-20 02:08:08 -08:00
parent 9038bd98ff
commit 46d1b1a60a
No known key found for this signature in database
GPG Key ID: 93451558FC64495C
3 changed files with 25 additions and 2 deletions

4
.env.example Normal file
View File

@ -0,0 +1,4 @@
# Modify these values and rename this file to ".env"
CFC_TIME_MYSQL_PASSWORD="CHANGE-ME"
CFC_TIME_MYSQL_PORT=3306
CFC_TIME_MYSQL_DIR=/media/storage/steam/storage/sql/cfc3/cfc_time

17
docker-compose.prod.yml Normal file
View File

@ -0,0 +1,17 @@
version: "3.8"
services:
db:
image: mysql
restart: always
ports:
- $CFC_TIME_MYSQL_PORT:3306
volumes:
# Lets you put a .sql dump into ./sql_mount and have mysql pick it up on init
- ./sql_mount:/docker-entrypoint-initdb.d
- $CFC_TIME_SQL_DIR:/var/lib/mysql
environment:
MYSQL_DATABASE: cfc_time
MYSQL_USER: cfc_time
# Reads password from ./.env
MYSQL_PASSWORD: $CFC_TIME_MYSQL_PASSWORD
MYSQL_RANDOM_ROOT_PASSWORD: true

View File

@ -9,14 +9,16 @@ config.setDefaults{
MYSQL_HOST = "127.0.0.1",
MYSQL_USERNAME = "",
MYSQL_PASSWORD = "",
MYSQL_DATABASE = "cfc_time"
MYSQL_DATABASE = "cfc_time",
MYSQL_PORT = 3306
}
storage.database = mysqloo.connect(
config.get( "MYSQL_HOST" ),
config.get( "MYSQL_USERNAME" ),
config.get( "MYSQL_PASSWORD" ),
config.get( "MYSQL_DATABASE" )
config.get( "MYSQL_DATABASE" ),
config.get( "MYSQL_PORT" )
)
function storage.database:onConnected()