From ee44d5dba8cbdf11177417e1dd5cb83bd53be1b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADn?= Date: Wed, 29 May 2024 11:50:53 +0200 Subject: [PATCH] Add .env instructions for docker compose --- README.md | 47 +++++++++++++++++++++++++++++++++++-- docker-compose.mariadb.yaml | 4 ++-- docker-compose.sqlite3.yaml | 2 +- 3 files changed, 48 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 59bc2f7..2311d4a 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,46 @@ git clone https://github.com/yourusername/writefreely-docker.git cd writefreely-docker ``` -#### MariaDB +#### Prepare the Data Directory + +Create the data directory and assign the appropriate permissions: + +```bash +mkdir data +sudo chown 1000:1000 data +``` + +#### Configure the Environment + +Before starting the services, you need to copy the appropriate .env file and edit it to configure the environment variables, especially the passwords. + +##### For MariaDB + +Copy the .env.mariadb file to .env: + +```bash +cp .env.mariadb .env +``` + +##### For SQLite + +Copy the .env.sqlite file to .env: + +```bash +cp .env.sqlite .env +``` + +Then, edit the .env file to set the appropriate values for your environment: + +```bash +nano .env +``` + +Ensure to set secure passwords and other necessary configuration options. + +#### Start the Services + +##### MariaDB To use the **MariaDB** configuration, run: @@ -81,7 +120,7 @@ To use the **MariaDB** configuration, run: docker-compose -f docker-compose.mariadb.yaml up ``` -#### SQLite +##### SQLite To use the **SQLite** configuration, run: @@ -98,3 +137,7 @@ docker build -t yourusername/writefreely . ``` Replace `yourusername` with your Docker Hub username or a suitable image name. + +### Contributing + +Contributions are welcome! Please fork this repository and submit pull requests for any enhancements or bug fixes. diff --git a/docker-compose.mariadb.yaml b/docker-compose.mariadb.yaml index 940692b..f1dbcb0 100644 --- a/docker-compose.mariadb.yaml +++ b/docker-compose.mariadb.yaml @@ -6,7 +6,7 @@ services: context: . init: true env_file: - - .env.mariadb + - .env volumes: - ./data:/data ports: @@ -22,7 +22,7 @@ services: volumes: - ./db-data:/var/lib/mysql env_file: - - .env.mariadb + - .env restart: unless-stopped healthcheck: test: ["CMD-SHELL", "mariadb-admin ping -h localhost -u${MARIADB_USER} -p${MARIADB_PASSWORD} || exit 1"] diff --git a/docker-compose.sqlite3.yaml b/docker-compose.sqlite3.yaml index 908e07b..7ba3580 100644 --- a/docker-compose.sqlite3.yaml +++ b/docker-compose.sqlite3.yaml @@ -6,7 +6,7 @@ services: context: . init: true env_file: - - .env.sqlite + - .env volumes: - ./data:/data ports: