Skip to content

Commit

Permalink
chore: add init files
Browse files Browse the repository at this point in the history
  • Loading branch information
supersonictw committed Jan 3, 2025
1 parent 960a15c commit 749cf35
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.default
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MARIADB_ROOT_PASSWORD=illusion-admin
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env.local
dump/
4 changes: 2 additions & 2 deletions backup.sh → .illusion-dump
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
# illusion - docker-composer.yml of mariadb + redis + phpmyadmin, for sample only.
# (c) 2023 SuperSonic (https://github.com/supersonictw)
# (c) 2025 Shiranui (https://shiranui.xyz)

# Arguments:
BACKUP_DATABASE_NAME=$1
BACKUP_DATABASE_HOST="localhost"
BACKUP_DATABASE_USER="root"
BACKUP_DATABASE_PASS="illusion-admin"
BACKUP_DATABASE_PASS="$MARIADB_ROOT_PASSWORD"

# Export databases
if ! [ -z "$BACKUP_DATABASE_NAME" ]; then
Expand Down
15 changes: 15 additions & 0 deletions .init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
# illusion - docker-composer.yml of mariadb + redis + phpmyadmin, for sample only.
# (c) 2025 Shiranui (https://shiranui.xyz)

RANDOM_STRING() {
# Generate a random string for a password.
docker run --rm alpine/openssl:latest rand -hex 16
}

# Copy from .env.default file
cp .env.default .env.local

# Generate a random password for MariaDB
MARIADB_ROOT_PASSWORD="$(RANDOM_STRING)"
sed -i "s/MARIADB_ROOT_PASSWORD=.*/MARIADB_ROOT_PASSWORD=$MARIADB_ROOT_PASSWORD/" .env.local
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ Allow to connect via host `localhost` only.

[MIT License](LICENSE)

> (c)2022 [SuperSonic](https://github.com/supersonictw).
> (c)2022 [SuperSonic](https://shiranui.xyz).
9 changes: 5 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# illusion - docker-composer.yml of mariadb + redis + phpmyadmin, for sample only.
# (c) 2023 SuperSonic (https://github.com/supersonictw)
# (c) 2025 Shiranui (https://shiranui.xyz)

version: "3.5"
services:
Expand All @@ -10,12 +10,13 @@ services:
- 127.0.0.1:2001:3306
volumes:
- database:/var/lib/mysql:rw
- ./backup.sh:/usr/local/bin/backup.sh:ro
- ./.illusion-dump:/usr/local/bin/illusion-dump:ro
- ./dump:/dump:rw
networks:
- illusion
environment:
MARIADB_ROOT_PASSWORD: illusion-admin
env_file:
- .env.default
- .env.local
restart: always

cache:
Expand Down

0 comments on commit 749cf35

Please sign in to comment.