Skip to content

Commit

Permalink
docs: update docker installation instructions
Browse files Browse the repository at this point in the history
This commit updates the BHIMA installation instructions for the docker
installation of MySQL, and bumps the supported version to 9.1.  It also
updates the docker-compose file accordingly.
  • Loading branch information
jniles committed Oct 21, 2024
1 parent 804a148 commit 35a0af4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ services:
- backend

mysql:
image: mysql:8.4
image: mysql:9.1
restart: unless-stopped
command:
- --sql-mode=STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION
- --mysql-native-password=ON
volumes:
- mysqldata:/var/lib/mysql/
- ./server/models:/docker-entrypoint-initdb.d
Expand Down
24 changes: 11 additions & 13 deletions docs/en/for-developers/installing-bhima.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ sudo apt install chromium-browser
sudo apt-get install libx11-xcb1 libxcomposite1 libasound2 libatk1.0-0 libatk-bridge2.0-0 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6
```

We suggest putting the follwing line into your .bashrc file and restarting your shell session:
We suggest putting the following line into your .bashrc file and restarting your shell session:

```bash
export CHROME_BIN=`which chromium`
Expand Down Expand Up @@ -105,7 +105,7 @@ The dependencies should now be set!

BHIMA uses environmental variables to connect to the database and toggle features. These are found in the `.env.sample` file included in the top level of the repository. You'll need to set these in a `.env` file to be read by the application at runtime.
Before building, create your `.env` file based on the sample template to set up your MySQL database connection parameters. Their variables should be self-explanatory.
Before building, create your `.env` file based on the sample template to set up your MySQL database connection parameters. The variables should be self-explanatory.
Use the following command to edit the .env file if desired \(make your changes and then type ctrl + x to exit and save\):
Expand All @@ -121,7 +121,7 @@ nano .env
sudo mysql -u root -p
CREATE USER 'bhima'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'bhima'@'localhost';
GRANT ALL PRIVILEGES ON *.* TO 'bhima'@'localhost';
FLUSH PRIVILEGES;
# Use ctrl + z to get back to the main terminal prompt
```
Expand All @@ -131,7 +131,7 @@ NOTE: Debian installs MariaDB by default and the `CREATE USER` statement should
CREATE USER 'bhima'@'localhost' IDENTIFIED BY 'password';
```
Then, build the app with
Then, build the app with:
```bash
# build the application
Expand All @@ -158,13 +158,11 @@ To start a MySQL server using docker you can use:
```bash
# In this example, we use "mysql" as the tag name
docker run --name mysql -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=MyPassword \
-e MYSQL_ROOT_HOST=% \
-d mysql:8.3 \
--sql-mode='STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION' \
--default-authentication-plugin=mysql_native_password
docker run --name mysql -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=<MyPassword> \
-e MYSQL_ROOT_HOST=% \
-d mysql:9.1 \
--sql-mode='STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION'
# give it a few seconds, and MySQL will be started and listening on port 3306
```
Expand All @@ -177,7 +175,7 @@ Note that you can also run redis using docker if you prefer:
docker run --name redis -p 6379:6379 -d redis
```
If you have already a MySQL server running on port 3306 of your localhost, start docker without the port-forwarding (`-p 3306:3306`), use `docker inspect mysql` to find the IP of the container and use that IP in the `.env` file as `DB_HOST`.
If you have already a MySQL server running on port 3306 of your local machine, start docker without the port-forwarding (`-p 3306:3306`), use `docker inspect mysql` to find the IP of the container and use that IP in the `.env` file as `DB_HOST`.
The database structure is contained in the `server/models/*.sql` files. You can execute these one by one in the order below, or simply run `npm run build:db`.
Expand All @@ -198,7 +196,7 @@ You can run all this by using the following command: `npm run build:db` Alternat
```bash
# Install the database
DB_USER='me' DB_PASS='MyPassword' DB_NAME='bhima' ./sh/build-database.sh
DB_USER='<MyUser>' DB_PASS='<MyPassword>' DB_NAME='bhima' ./sh/build-database.sh
```
If you are creating a fresh build for a new production site, you should probably start with:
Expand Down
17 changes: 7 additions & 10 deletions docs/fr/for-developers/installing-bhima.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,21 +114,18 @@ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
sql-mode="STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION"

# sauvegarder, puis redémarrez mysql avec la commande suivante:
sudo service mysql redémarrer
sudo systemctl restart mysql
```

Tu peux aussi utiliser docker avec mysql. Le command pour le lancer est:
```bash
# demarrer docker sur port 3306

#demarrer docker sur port 3306

docker run --name mysql -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=MyPassword \
-e MYSQL_ROOT_HOST=% \
-d mysql:8.3 \
--sql-mode='STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION' \
--default-authentication-plugin=mysql_native_password

docker run --name mysql -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=<MyPassword> \
-e MYSQL_ROOT_HOST=% \
-d mysql:9.1 \
--sql-mode='STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION'
```

Il faut changer le fichier `.env` pour mettre `DB_HOST` a `127.0.0.1`.
Expand Down

0 comments on commit 35a0af4

Please sign in to comment.