chore: add mariadb database

This commit is contained in:
2022-11-20 22:05:59 +01:00
parent fc7fbd18d4
commit 5dae122f53
6 changed files with 54 additions and 30 deletions

6
.gitignore vendored
View File

@@ -1 +1,5 @@
.env.mariadb # Environment files for docker composes
.env.production
# Home assistant configuration file
configuration.production.yaml

View File

@@ -1,16 +1,20 @@
# Loads default set of integrations. Do not remove # Loads default set of integrations. Do not remove
# This was added to the homeAutomation repo. # This was added to the homeAutomation repo.
default_config: # This is a sample configuration. Please create a configuration.production.yml for production use.
default_config:
# Text to speech
tts: # Text to speech
- platform: google_translate tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml automation: !include automations.yaml
scene: !include scenes.yaml script: !include scripts.yaml
scene: !include scenes.yaml
http:
use_x_forwarded_for: true http:
trusted_proxies: use_x_forwarded_for: true
- 10.55.8.1 trusted_proxies:
- 10.55.8.1

View File

@@ -1,10 +1,10 @@
# General settings # General settings
INTERNAL_IP: localhost INTERNAL_IP: 0.0.0.0
# Db-Specific settings
# Should be overridden with a .env.mariadb file.
MARIADB_ROOT_PASSWORD=test
MARIADB_USER=homeassistant
MARIADB_PASSWORD=homeassistant
# Maria DB settings
# For testing purposes only. Please create a .env.mariadb to overwrite these variables
MARIADB_ROOT_PASSWORD=testing
MARIADB_DATABASE=homeassistant
MARIADB_USER=homeassistant_user
MARIADB_PASSWORD=homeassistant_pw

5
home-server/.env.mariadb Normal file
View File

@@ -0,0 +1,5 @@
MARIADB_ROOT_PASSWORD=testing
MARIADB_DATABASE=homeassistant_2
MARIADB_USER=homeassistant_user
MARIADB_PASSWORD=homeassistant_pw

View File

@@ -1,23 +1,26 @@
version: "3.9" version: "3.9"
services: services:
db: db:
image: mariadb image: mariadb:latest
restart: unless-stopped restart: unless-stopped
ports: ports:
- ${INTERNAL_IP}:3306:3306 - 3306:3306
env_file: env_file:
# Override the mariadb-specific settings in a .env.mariadb file.
# You should create the .env.mariadb file yourself.
- .env - .env
- .env.mariadb - .env.production
volumes:
- /home/willem/mariadb:/var/lib/mysql
homeassistant: homeassistant:
image: "ghcr.io/home-assistant/home-assistant:stable" image: "ghcr.io/home-assistant/home-assistant:stable"
ports: ports:
- ${INTERNAL_IP}:8123:8123 - ${INTERNAL_IP}:8123:8123
volumes: volumes:
- /home/willem/homeassistant:/config - /home/willem/homeassistant:/config
- /home/willem/repos/homeAutomation/configurations/home-assistant/configuration.yaml:/config/configuration.yaml - /home/willem/repos/homeAutomation/configurations/home-assistant/configuration.production.yaml:/config/configuration.yaml
restart: unless-stopped restart: unless-stopped
env_file:
- .env
- .env.production
syncthing: syncthing:
image: lscr.io/linuxserver/syncthing:latest image: lscr.io/linuxserver/syncthing:latest
container_name: syncthing container_name: syncthing

View File

@@ -22,6 +22,14 @@ ln -s /usr/bin/resolvectl /usr/local/bin/resolvconf
TODO add .sh script to start in production TODO add .sh script to start in production
## Tips
When database credentials are not updated after docker restart, consider using
```bash
docker compose rm db
```
## To Do ## To Do