-
Notifications
You must be signed in to change notification settings - Fork 288
Use .env file for directory/db #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0f4d980
20c16cd
f7dad4f
200981f
5aa57ae
25750bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Set up path to Moodle code | ||
MOODLE_DOCKER_WWWROOT=/path/to/moodle/code | ||
# Choose a db server (Currently supported: pgsql, mariadb, mysql, mssql, oracle) | ||
MOODLE_DOCKER_DB=pgsql | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.env |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,27 +18,22 @@ This repository contains Docker configuration aimed at Moodle developers and tes | |
|
||
## Quick start | ||
|
||
```bash | ||
# Set up path to Moodle code | ||
export MOODLE_DOCKER_WWWROOT=/path/to/moodle/code | ||
# Choose a db server (Currently supported: pgsql, mariadb, mysql, mssql, oracle) | ||
export MOODLE_DOCKER_DB=pgsql | ||
1. Download or clone this repository | ||
2. Rename `.env.example` to `.env` | ||
3. Specify Moodle directory and db driver in `.env` | ||
4. Run `bin/create-moodle-config`. This copies the `config.php` into Moodle. | ||
You only have to call this command onces. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to me like a more complicated setup than what was here previously. |
||
4. Run `bin/moodle-docker-compose up -d` inside `moodle-docker` folder to create the container. | ||
5. You may have to call also `bin/moodle-docker-wait-for-db` if you use `oracle/mssql`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may have to -> You should (at least to my knowledge you always want to do this if you execute these commands directly after each other) |
||
|
||
# Ensure customized config.php for the Docker containers is in place | ||
cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This still seems necessary for someone to quick start? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoups your right. I added a |
||
You can now access Moodle under `localhost:8000`. | ||
|
||
# Start up containers | ||
bin/moodle-docker-compose up -d | ||
If you want to destroy the container, run `bin/moodle-docker-compose down`. | ||
|
||
# Wait for DB to come up (important for oracle/mssql) | ||
bin/moodle-docker-wait-for-db | ||
|
||
# Work with the containers (see below) | ||
# [..] | ||
Everytime you reboot your PC or destroyed the container, you just have to start the container with `bin/moodle-docker-compose up -d` | ||
(and with `bin/moodle-docker-wait-for-db` if you use `oracle/mssql`). | ||
|
||
# Shut down and destroy containers | ||
bin/moodle-docker-compose down | ||
``` | ||
|
||
## Use containers for running behat tests | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ -f .env ]; | ||
then | ||
source .env | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will not work as the variables are not exported (at least inside you sample env file) |
||
fi | ||
|
||
cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These need an export before them if you want to source them from the scripts. dotenv files like you know them from php, python etc will not work with shells.