Skip to content

Commit c0f24f2

Browse files
committed
chore: initialize mysql database in docker
The mysql dockerfile has been pinned at 8.3 to avoid errors in the default authentication plugin. See mysqljs/mysql#2233 for more information. It might be prudent to switch to mysql2 instead of mysqljs for future release. I've renamed all the server model files to have a numeric prefix to allow execution in order. The 99-debug.sql file crashes, but it is not necessary for the functioning of the BHIMA server. You can now type `docker-compose up` and be taken to the BHIMA installation page on localhost. Environmental variables are set in the `.env` file as usual.
1 parent c3ce8bd commit c0f24f2

12 files changed

+10
-39
lines changed

Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ USER node
3838

3939
ENV NODE_ENV production
4040

41+
LABEL org.opencontainers.image.source=https://github.com/third-Culture-Software/bhima
42+
LABEL org.opencontainers.image.description="A hospital information management application for rural Congolese hospitals"
43+
LABEL org.opencontainers.image.licenses=GPL
44+
4145
# Define startup command
4246
CMD ["node", "server/app.js"]
4347

docker-compose.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ services:
1515
- backend
1616

1717
mysql:
18-
image: mysql:8
18+
image: mysql:8.3 # pin 8.3 ; https://github.com/appsignal/appsignal-nodejs/commit/0586d603c75aa12f8e99f4a5716fd8445f10d79c
1919
restart: unless-stopped
2020
command:
21-
- --mysql-native-password=ON
21+
#- --mysql-native-password=ON # See https://github.com/appsignal/appsignal-nodejs/commit/0586d603c75aa12f8e99f4a5716fd8445f10d79c
2222
- --sql-mode=STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION
23+
- --default-authentication-plugin=mysql_native_password
2324
volumes:
2425
- mysqldata:/var/lib/mysql/
25-
- "./temp/docker-build.sql:/docker-entrypoint-initdb.d/bhima.sql"
26+
- ./server/models:/docker-entrypoint-initdb.d
2627
environment:
27-
- MYSQL_RANDOM_ROOT_PASSWORD=1
28+
- MYSQL_RANDOM_ROOT_PASSWORD=yes
2829
- MYSQL_USER=$DB_USER
2930
- MYSQL_PASSWORD=$DB_PASS
3031
- MYSQL_DATABASE=$DB_NAME

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"build:db": "cross-env ./sh/build-database.sh",
2929
"build:clean": "cross-env ./sh/build-init-database.sh",
3030
"build:stock": "cross-env ./sh/build-stock-database.sh",
31-
"build:docker": "cross-env ./sh/docker-init.sh",
31+
"build:docker": "docker compose build",
3232
"migrate": "cross-env ./sh/setup-migration-script.sh",
3333
"watch": "cross-env ./node_modules/.bin/gulp watch",
3434
"check:lang": "cross-env node ./utilities/translation/tfcomp.js client/src/i18n/en client/src/i18n/fr",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)