Skip to content

Commit 1a4bfa5

Browse files
committed
Improve the readme
1 parent f3bd482 commit 1a4bfa5

File tree

1 file changed

+38
-10
lines changed

1 file changed

+38
-10
lines changed

README.md

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,55 @@
11
# FAForever DB project
22

3-
Provides the Docker container and migration tools for a production-ready FAF database.
3+
This project contains the FAF database structure for the core faf database used by API and server. (Other databases like forums or wiki are not part of this repository.)
44

5-
## Creating a new database
6-
7-
We highly recommended to use [faf-stack](https://github.com/FAForever/faf-stack) to create a new database container, like so:
5+
## Usage with faf-stack
6+
We highly recommended to use [faf-stack](https://github.com/FAForever/faf-stack) to interact with the database!
87

8+
### Creating a new database
99
docker-compose up -d faf-db
1010

11-
## Updating the database
12-
11+
### Updating the database
1312
In order to update an existing database to the newest schema version, execute:
1413

15-
docker exec -ti faf-db ./migrate.sh
16-
17-
## Connecting to the database
14+
docker-compose run faf-db-migrations migrate
1815

16+
### Connecting to the database
1917
In order to connect to the database using the mysql client, execute:
2018

2119
docker exec -ti faf-db mysql -uroot -pbanana
2220

2321
Where you have to replace `root` and `banana` with your custom credentials.
2422

2523

24+
## Usage with plain docker
25+
26+
### Create a network
27+
Create a network to connect the docker containers to each other. The old `--link` method is deprecated.
28+
29+
docker network create faf
30+
31+
If you want to connect other docker containers to connect to the database, put them into the same network.
32+
33+
### Creating a new database
34+
docker run --network="faf" --network-alias="faf-db" -p 3306:3306 \
35+
-e MYSQL_ROOT_PASSWORD=banana \
36+
-e MYSQL_DATABASE=faf \
37+
-d --name faf-db \
38+
mysql:5.7
39+
40+
### Updating the database
41+
In order to update an existing database to the newest schema version, execute:
42+
43+
docker run --network="faf" \
44+
-e FLYWAY_URL=jdbc:mysql://faf-db/faf?useSSL=false \
45+
-e FLYWAY_USER=root \
46+
-e FLYWAY_PASSWORD=banana \
47+
faf-db-migrations migrate
48+
2649
## How to Contribute
27-
https://github.com/FAForever/db/wiki/How-to-Contribute
50+
51+
To make changes to the database, add a new .sql file to the migrations folder. Each file needs to have a unique version prefix and be one version higher than the latest one.
52+
53+
For more information how the migration works please consult the [flyway tutorial](https://flywaydb.org/getstarted/how).
54+
55+
Please also follow our [general contribution guidelines](https://github.com/FAForever/db/wiki/How-to-Contribute).

0 commit comments

Comments
 (0)