Skip to content

Latest commit

ย 

History

History
128 lines (103 loc) ยท 2.42 KB

File metadata and controls

128 lines (103 loc) ยท 2.42 KB

logo Alpha Core - Docker & Makefile Guide


โœ… Requirements

  • Docker 19.03+
  • Docker Compose v2 (docker compose)

โšก Quick Start (Local DB)

  1. Create .env:
    cp env.dist .env
  2. Create config.yml:
    make config
  3. Ensure local DB is selected:
    make internal_db
  4. Build and start everything:
    make setup-all

Note

If the database is still starting, make db-setup may fail the first time.
Just rerun it after a few seconds.

If you run docker compose down -v, the local DB volume is removed and the databases are empty. Run make db-setup or make db-restore after that.


๐Ÿ—„๏ธ Database Workflow (Makefile)

  • Create databases:
    make db-create
  • Drop databases:
    make db-drop
  • Populate schema:
    make db-populate
  • Apply updates:
    make db-update
  • Full setup (create โ†’ populate โ†’ update):
    make db-setup
  • Backup:
    make db-backup
  • Restore (use a specific backup folder name):
    make db-restore BACKUP=<folder>

Note

All database names use the prefix from .env (DB_PREFIX).


๐Ÿ”Œ External Database

  1. Set these values in .env:
    EXTERNAL_DB_HOST=
    EXTERNAL_DB_PORT=3306
    EXTERNAL_DB_USERNAME=
    EXTERNAL_DB_PASSWORD=
    
  2. Apply external DB config:
    make external_db
  3. Start containers:
    make up

This updates etc/config/config.yml with concrete values and disables the local sql service by clearing COMPOSE_PROFILES.


๐Ÿ” Switch Back to Local DB

make internal_db
make up

This rewrites etc/config/config.yml with local values and enables the localdb profile.


โš™๏ธ Important .env Values

  • DB_PREFIX=alpha_
    Database names become ${DB_PREFIX}auth, ${DB_PREFIX}realm, ${DB_PREFIX}world, ${DB_PREFIX}dbc.
  • MYSQL_PORT=3306
    Port used inside the Docker network.
  • MYSQL_HOST_PORT=3300
    Port exposed on your host (useful when 3306 is already in use).
  • COMPOSE_PROFILES=localdb
    Enables the local MariaDB container.

๐Ÿ› ๏ธ Permissions Tip

If config.yml is owned by root (often created by a container), fix it once:

sudo chown $USER:$USER etc/config/config.yml