Skip to content

Commit

Permalink
Merge pull request #1 from Third-Culture-Software/chore-build-with-do…
Browse files Browse the repository at this point in the history
…cker

chore: build with docker
  • Loading branch information
jniles authored May 13, 2024
2 parents 5da2515 + 6ee5c5c commit e5e9118
Show file tree
Hide file tree
Showing 38 changed files with 128 additions and 138 deletions.
7 changes: 5 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
node_modules
.git

# ignore loggin utilities
# ignore logging utilities
npm-debug.log
yarn-error.log

# ignore documentation
*.md
CNAME

# ignore unnecessary folders
docs
temp
test
test*
results
sh
bin

48 changes: 26 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,43 +1,47 @@
# define base image
FROM node:lts-slim
FROM node:lts

# download all the missing dependencies for chromium, plus chromium itself
# Install missing dependencies for chromium
# These are all needed to make sure the browser can properly render all
# the requiredd page
RUN apt-get update && apt-get install -y \
ca-certificates fonts-liberation gconf-service \
libappindicator1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 \
libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 \
libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libgconf-2-4 \
libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 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 lsb-release libxshmfence1 chromium -y
libxss1 libxtst6 lsb-release libxshmfence1 chromium -y \
&& rm -rf /var/lib/apt/lists/*

# ENV NODE_ENV=production
ENV YARN_VERSION 1.22.17
#ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD 1
RUN yarn policies set-version $YARN_VERSION
#ENV CHROME_BIN /usr/bin/chromium
#ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium

# define working directory inside the container
# Set working directory
WORKDIR /usr/src/app

# Copy all the source code from host machine to the container project directory
COPY . .
# Copy source code
COPY --chown=node:node . .

# install all the dependencies
RUN yarn --frozen-lockfile && yarn build
# Install dependencies
RUN npm install && \
NODE_ENV=production npm run build && \
npm install --omit=dev

# yarn build creates the bin/ folder
# Copy environment file to bin folder
COPY .env bin/

# change directory to the bin diretory
# Change directory to bin
WORKDIR /usr/src/app/bin/

# make sure the node user is the owner of all the underlying files.
# Set ownership
RUN chown -R node:node *

# ensure this container runs as the user "node"
# Switch to non-root user
USER node

# define the start up command of the container to run the server
ENV NODE_ENV production

LABEL org.opencontainers.image.source=https://github.com/third-Culture-Software/bhima
LABEL org.opencontainers.image.description="A hospital information management application for rural Congolese hospitals"
LABEL org.opencontainers.image.licenses=GPL

# Define startup command
CMD ["node", "server/app.js"]

33 changes: 22 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,48 @@
version: '3'

services:
bhima:
build: .
image: imaworldhealth/bhima
image: ghcr.io/third-culture-software/bhima
restart: unless-stopped
ports:
- $PORT:$PORT
environment:
- REDIS_HOST=redis
- DB_HOST=mysql
- DB_USER=$DB_USER
- DB_PASS=$DB_PASS
depends_on:
- mysql
- redis
networks:
- backend

mysql:
image: mysql:8
restart: always
image: mysql:8.3 # pin 8.3 ; https://github.com/appsignal/appsignal-nodejs/commit/0586d603c75aa12f8e99f4a5716fd8445f10d79c
restart: unless-stopped
command:
- --default-authentication-plugin=mysql_native_password
#- --mysql-native-password=ON # See https://github.com/appsignal/appsignal-nodejs/commit/0586d603c75aa12f8e99f4a5716fd8445f10d79c
- --sql-mode=STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
volumes:
- mysqldata:/var/lib/mysql/
- "./temp/docker-build.sql:/docker-entrypoint-initdb.d/bhima.sql"
- ./server/models:/docker-entrypoint-initdb.d
environment:
- MYSQL_RANDOM_ROOT_PASSWORD=1
- MYSQL_RANDOM_ROOT_PASSWORD=yes
- MYSQL_USER=$DB_USER
- MYSQL_PASSWORD=$DB_PASS
- MYSQL_DATABASE=$DB_NAME
networks:
- backend

redis:
image: redis:latest
restart: always
restart: unless-stopped
networks:
- backend

networks:
backend:

volumes:
mysqldata:

24 changes: 15 additions & 9 deletions docs/en/for-developers/installing-bhima.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ To start a MySQL server using docker you can use:
docker run --name mysql -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=MyPassword \
-e MYSQL_ROOT_HOST=% \
-d mysql/mysql-server:8.0 \
-d mysql:8.3 \
--sql-mode='STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION' \
--default-authentication-plugin=mysql_native_password

Expand All @@ -176,21 +176,27 @@ docker run --name mysql -p 3306:3306 \

This will start a MySQL server that listens on port 3306 (the default MySQL port) on your localhost. Additionally, you have to set `DB_HOST` in the `.env` file to `127.0.0.1`, leaving it to `localhost` will make the `mysql` command trying to connect via socket, what is not possible when using docker.

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 mysql5.7` to find the IP of the container and use that IP in the `.env` file as `DB_HOST`.
Note that you can also run redis using docker if you prefer:

```bash
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`.

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 `yarn build:db`.

1. `server/models/schema.sql`
2. `server/models/functions.sql`
3. `server/models/procedures.sql`
4. `server/models/admin.sql`
5. `server/models/triggers.sql`
1. `server/models/01-schema.sql`
2. `server/models/02-functions.sql`
3. `server/models/03-procedures.sql`
4. `server/models/98-admin.sql`
5. `server/models/04-triggers.sql`


This sets up the basic schema, routines, and triggers. The following scripts will build a basic dataset to begin playing around with:

1. `server/models/icd10.sql`
2. `server/models/bhima.sql`
1. `server/models/05-icd10.sql`
2. `server/models/06-bhima.sql`
3. `test/data.sql`

You can run all this by using the following command: `yarn build:db` Alternatively, you might use the `./sh/build-database.sh` script, customized with your environmental variables as shown below:
Expand Down
18 changes: 9 additions & 9 deletions docs/fr/for-developers/installing-bhima.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ Tu peux aussi utiliser docker avec mysql. Le command pour le lancer est:
docker run --name mysql -p 3306:3306 \
-e MYSQL_ROOT_PASSWORD=MyPassword \
-e MYSQL_ROOT_HOST=% \
-d mysql/mysql-server:8.0 \
-d mysql:8.3 \
--sql-mode='STRICT_ALL_TABLES,NO_UNSIGNED_SUBTRACTION' \
--default-authentication-plugin=mysql_native_password

Expand All @@ -141,18 +141,18 @@ docker run --name mysql -p 3306:3306 \
Il faut changer le fichier `.env` pour mettre `DB_HOST` a `127.0.0.1`.


La structure de la base de données est contenue dans les fichiers `server/models/*. Sql`. Vous pouvez les exécuter un par un dans l'ordre ci-dessous ou simplement lancer `yarn build: db`.
La structure de la base de données est contenue dans les fichiers `server/models/*.sql`. Vous pouvez les exécuter un par un dans l'ordre ci-dessous ou simplement lancer `yarn build: db`.

1. `server/models/schema.sql`
2. `server/models/triggers.sql`
3. `server/models/functions.sql`
4. `server/models/procedures.sql`
5. `server/models/admin.sql`
1. `server/models/01-schema.sql`
2. `server/models/04-triggers.sql`
3. `server/models/02-functions.sql`
4. `server/models/03-procedures.sql`
5. `server/models/98-admin.sql`

Ceci configure le schéma de base, les déclencheurs et les routines. Les scripts suivants créeront un ensemble de données de base avec lequel commencer à jouer:

1. `server/models/icd10.sql`
2. `server/models/bhima.sql`
1. `server/models/05-icd10.sql`
2. `server/models/06-bhima.sql`
3. `test/data.sql`

Vous pouvez exécuter tout cela en utilisant la commande suivante: `yarn build:db` Vous pouvez également utiliser le script`./sh/build-database.sh`, personnalisé à l'aide de vos variables d'environnement, comme indiqué ci-dessous:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"build:db": "cross-env ./sh/build-database.sh",
"build:clean": "cross-env ./sh/build-init-database.sh",
"build:stock": "cross-env ./sh/build-stock-database.sh",
"build:docker": "cross-env ./sh/docker-init.sh",
"build:docker": "docker compose build",
"migrate": "cross-env ./sh/setup-migration-script.sh",
"watch": "cross-env ./node_modules/.bin/gulp watch",
"check:lang": "cross-env node ./utilities/translation/tfcomp.js client/src/i18n/en client/src/i18n/fr",
Expand Down
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.
File renamed without changes.
14 changes: 7 additions & 7 deletions sh/build-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" -e "DROP DATABASE IF
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" -e "CREATE DATABASE $DB_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" || { echo 'failed to create DB' ; exit 1; }

echo "[build] database schema"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/schema.sql || { echo 'failed to build DB schema' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/01-schema.sql || { echo 'failed to build DB schema' ; exit 1; }

echo "[build] functions"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/functions.sql || { echo 'failed to import functions into DB' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/02-functions.sql || { echo 'failed to import functions into DB' ; exit 1; }

echo "[build] procedures"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/procedures.sql || { echo 'failed to import procedures into DB 1/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/admin.sql || { echo 'failed to import procedures into DB 2/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/03-procedures.sql || { echo 'failed to import procedures into DB 1/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/98-admin.sql || { echo 'failed to import procedures into DB 2/2' ; exit 1; }

echo "[build] triggers"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/triggers.sql || { echo 'failed to import triggers into DB' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/04-triggers.sql || { echo 'failed to import triggers into DB' ; exit 1; }

echo "[build] default data"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/icd10.sql || { echo 'failed to import default data into DB 1/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/05-icd10.sql || { echo 'failed to import default data into DB 1/2' ; exit 1; }

mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/bhima.sql || { echo 'failed to import default data into DB 2/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/06-bhima.sql || { echo 'failed to import default data into DB 2/2' ; exit 1; }

echo "[build] test data"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < test/data.sql || { echo 'failed to import test data into DB' ; exit 1; }
Expand Down
14 changes: 7 additions & 7 deletions sh/build-init-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" -e "DROP DATABASE IF
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" -e "CREATE DATABASE $DB_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" || { echo "failed to create DB" ; exit 1; }

echo "[ build ] database schema"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/schema.sql || { echo "failed to build DB scheme" ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/01-schema.sql || { echo "failed to build DB scheme" ; exit 1; }

echo "[ build ] functions"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/functions.sql || { echo "failed to import functions into DB" ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/02-functions.sql || { echo "failed to import functions into DB" ; exit 1; }

echo "[ build ] procedures"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/procedures.sql
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/admin.sql || { echo "failed to import procedures into DB 2/2" ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/03-procedures.sql
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/98-admin.sql || { echo "failed to import procedures into DB 2/2" ; exit 1; }

echo "[ build ] triggers"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/triggers.sql
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/04-triggers.sql

echo "[ build ] default data"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/icd10.sql || { echo "failed to import default data into DB 1/2" ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/bhima.sql || { echo "failed to import default data into DB 2/2" ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/05-icd10.sql || { echo "failed to import default data into DB 1/2" ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/06-bhima.sql || { echo "failed to import default data into DB 2/2" ; exit 1; }

echo "[build] recomputing mappings"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" -e "Call zRecomputeEntityMap();" || { echo "failed to recompute mappings 1/2" ; exit 1; }
Expand Down
14 changes: 7 additions & 7 deletions sh/build-stock-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" -e "DROP DATABASE IF
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" -e "CREATE DATABASE $DB_NAME CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" || { echo 'failed to create DB' ; exit 1; }

echo "[build] database schema"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/schema.sql || { echo 'failed to build DB schema' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/01-schema.sql || { echo 'failed to build DB schema' ; exit 1; }

echo "[build] functions"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/functions.sql || { echo 'failed to import functions into DB' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/02-functions.sql || { echo 'failed to import functions into DB' ; exit 1; }

echo "[build] procedures"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/procedures.sql || { echo 'failed to import procedures into DB 1/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/admin.sql || { echo 'failed to import procedures into DB 2/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/03-procedures.sql || { echo 'failed to import procedures into DB 1/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/98-admin.sql || { echo 'failed to import procedures into DB 2/2' ; exit 1; }

echo "[build] triggers"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/triggers.sql || { echo 'failed to import triggers into DB' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/04-triggers.sql || { echo 'failed to import triggers into DB' ; exit 1; }

echo "[build] default data"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/icd10.sql || { echo 'failed to import default data into DB 1/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/05-icd10.sql || { echo 'failed to import default data into DB 1/2' ; exit 1; }

mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/bhima.sql || { echo 'failed to import default data into DB 2/2' ; exit 1; }
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < server/models/06-bhima.sql || { echo 'failed to import default data into DB 2/2' ; exit 1; }

echo "[build] stock test data"
mysql -u "$DB_USER" -p"$DB_PASS" -h"$DB_HOST" -P"$DB_PORT" "$DB_NAME" < test/data/enterprise.sql || { echo 'failed to import test data into DB 1/5' ; exit 1; }
Expand Down
14 changes: 7 additions & 7 deletions sh/debian-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -293,21 +293,21 @@ cp .env bin/
echo "Building initial mysql database..."

echo "[ build ] database schema"
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/schema.sql || { echo "failed to build DB scheme" ; exit 1; }
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/01-schema.sql || { echo "failed to build DB scheme" ; exit 1; }
echo "[ build ] functions"
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/functions.sql || { echo "failed to import functions into DB" ; exit 1; }
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/02-functions.sql || { echo "failed to import functions into DB" ; exit 1; }

echo "[ build ] procedures"
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/procedures.sql || { echo "failed to import procedures into DB 1/2" ; exit 1; }
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/03-procedures.sql || { echo "failed to import procedures into DB 1/2" ; exit 1; }

mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/admin.sql || { echo "failed to import procedures into DB 2/2" ; exit 1; }
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/98-admin.sql || { echo "failed to import procedures into DB 2/2" ; exit 1; }

echo "[ build ] triggers"
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/triggers.sql
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/04-triggers.sql

echo "[ build ] default data"
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/icd10.sql || { echo "failed to import default data into DB 1/2" ; exit 1; }
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/bhima.sql || { echo "failed to import default data into DB 2/2" ; exit 1; }
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/05-icd10.sql || { echo "failed to import default data into DB 1/2" ; exit 1; }
mysql "$BHIMA_DB_NAME" < $HOME/apps/bhima/bin/server/models/06-bhima.sql || { echo "failed to import default data into DB 2/2" ; exit 1; }

echo "[build] recomputing mappings"
mysql "$BHIMA_DB_NAME" -e "Call zRecomputeEntityMap();" || { echo "failed to recompute mappings 1/2" ; exit 1; }
Expand Down
Loading

0 comments on commit e5e9118

Please sign in to comment.