-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dfcc884
Showing
20 changed files
with
480 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
* -text | ||
|
||
# dont touch bash scripts so it doesnt mess up the shebang #!/bin/bash | ||
*.sh text eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# To get started with Dependabot version updates, you'll need to specify which | ||
# package ecosystems to update and where the package manifests are located. | ||
# Please see the documentation for all configuration options: | ||
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates | ||
|
||
version: 2 | ||
updates: | ||
- package-ecosystem: "docker" # See documentation for possible values | ||
directory: "/" # Location of package manifests | ||
schedule: | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: Publish HCW Docker images with i18n translations | ||
|
||
on: | ||
workflow_dispatch: | ||
env: | ||
|
||
REGISTRY: ghcr.io | ||
HCW_ADMIN_VERSION: 5.0.2 | ||
HCW_ADMIN_IMAGE_NAME_PREFIX: hcw-admin | ||
HCW_ADMIN_CONTEXT: ./admin | ||
HCW_DOCTOR_VERSION: 5.0.9 | ||
HCW_DOCTOR_IMAGE_NAME_PREFIX: hcw-doctor | ||
HCW_DOCTOR_CONTEXT: ./doctor | ||
HCW_PATIENT_VERSION: 5.0.14 | ||
HCW_PATIENT_IMAGE_NAME_PREFIX: hcw-patient | ||
HCW_PATIENT_CONTEXT: ./patient | ||
HCW_BACKEND_VERSION: 5.0.19 | ||
HCW_BACKEND_IMAGE_NAME_PREFIX: hcw-backend | ||
HCW_BACKEND_CONTEXT: ./backend | ||
IMAGE_TAG: latest | ||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.REGISTRY }}/${{ github.repository }}/${{ env.HCW_ADMIN_IMAGE_NAME_PREFIX }}-${{ env.HCW_ADMIN_VERSION }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/${{ env.HCW_DOCTOR_IMAGE_NAME_PREFIX }}-${{ env.HCW_DOCTOR_VERSION }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/${{ env.HCW_PATIENT_IMAGE_NAME_PREFIX }}-${{ env.HCW_PATIENT_VERSION }} | ||
${{ env.REGISTRY }}/${{ github.repository }}/${{ env.HCW_BACKEND_IMAGE_NAME_PREFIX }}-${{ env.HCW_BACKEND_VERSION }} | ||
tags: | | ||
type=raw,value=${{ env.IMAGE_TAG }} | ||
type=sha | ||
- name: Build and push HCW Admin v${{ env.HCW_ADMIN_VERSION }} i18n Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ env.HCW_ADMIN_CONTEXT }} | ||
build-args: | | ||
HCW_ADMIN_VERSION=${{ env.HCW_ADMIN_VERSION }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Build and push HCW Doctor v${{ env.HCW_DOCTOR_VERSION }} i18n Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ env.HCW_DOCTOR_CONTEXT }} | ||
build-args: | | ||
HCW_DOCTOR_VERSION=${{ env.HCW_DOCTOR_VERSION }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
|
||
- name: Build and push HCW PATIENT v${{ env.HCW_PATIENT_VERSION }} i18n Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ env.HCW_PATIENT_CONTEXT }} | ||
build-args: | | ||
HCW_PATIENT_VERSION=${{ env.HCW_PATIENT_VERSION }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
- name: Build and push HCW BACKEND v${{ env.HCW_BACKEND_VERSION }} i18n Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ${{ env.HCW_BACKEND_CONTEXT }} | ||
build-args: | | ||
HCW_BACKEND_VERSION=${{ env.HCW_BACKEND_VERSION }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/.idea/ | ||
/secrets.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Why this project | ||
|
||
Will create Docker images based on [HCW](https://github.com/HCW-home) applications with custom translations, enabling HCW applications to be used in various contexts beyond health. | ||
|
||
The main i18n changes are: | ||
- `consultation` replaced by `session` | ||
- `patient` replaced by `service user` | ||
|
||
# How to use this project | ||
|
||
## Reuse the docker images | ||
Images generated by this GitHub project can be used directly. See https://github.com/icrc/packages?repo_name=hcw-i18n | ||
|
||
## Create custom translated images | ||
To provide custom translations, fork this repository and modify the `<lang>.override.json` files. | ||
|
||
|
||
# How to add translations | ||
for each project, there is a folder named `assets/i18n` containing `<lang>.override.json` files. | ||
For instance for the patient interface, translations are in the folder [./patient/assets/i18n](./patient/assets/i18n). | ||
|
||
# How to start the applications locally | ||
|
||
To test translations, all application can be started locally. | ||
|
||
By default, the backend is configured to start in development mode, allowing the content of sent emails and SMS to be printed to the backend sysout. To check these messages, please display the backend logs with `docker compose logs -f backend` | ||
|
||
## Step 1: Create the file `secrets.env` | ||
Create the secrets.env file by copying secrets.env.default, then generate and add passwords in the new file. | ||
|
||
## Step 2: Start the applications | ||
|
||
Run: `docker compose up -d` | ||
|
||
## Step 3: Create a user | ||
See https://docs.hcw-at-home.com/users/ for all documentation. | ||
|
||
**Main steps:** | ||
`docker compose exec -ti mongo mongosh` | ||
|
||
Then: | ||
`use hcw-athome` | ||
|
||
and run this query after having replaced the relevant info: | ||
|
||
``` | ||
db.user.insertOne({email:"replace-by-your-email", firstName:"replace-by-your-firstname", lastName:"replace-by-your-lastname", password: "replace-by-a-hashed-password", role: "admin", createdAt: new Date().getTime(), "updatedAt": new Date().getTime(), "username" : "", phoneNumber: "+41..."}) | ||
``` | ||
|
||
|
||
Please have a look to https://docs.hcw-at-home.com/users/ to manually hash the password. | ||
|
||
|
||
## Step 5: Access to the applications | ||
|
||
The local URLs are: | ||
|
||
- Doctor: http://localhost:8081 | ||
- Patient: http://localhost:8080 | ||
- Admin: http://localhost:8082 | ||
display the logs with `docker compose logs -f` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG HCW_ADMIN_VERSION | ||
FROM iabsis/hcw-admin:${HCW_ADMIN_VERSION} AS i18n-layer | ||
USER root | ||
RUN apt update && apt install -y jq && rm -rf /var/lib/apt/lists/* | ||
COPY assets/* /usr/share/nginx/html/assets/i18n | ||
RUN bash /usr/share/nginx/html/assets/i18n/combine.sh | ||
|
||
|
||
FROM iabsis/hcw-admin:${HCW_ADMIN_VERSION} | ||
|
||
COPY --from=i18n-layer /usr/share/nginx/html/assets/i18n/*.json /usr/share/nginx/html/assets/i18n/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
## This script combine the language files | ||
# simply create a file <lang>.override.json and the overrided language | ||
# will be applied on upgrade. | ||
|
||
folder=$(dirname $0) | ||
|
||
for file in ${folder}/??.json ; do | ||
basename=$(echo ${file/.json/}) | ||
filename=$(basename ${file}) | ||
lang=${filename/.json/} | ||
if [ -f ${basename}.override.json ] ; then | ||
jq -s '.[0] * .[1]' ${basename}.json ${basename}.override.json > ${basename}.combined.json ; ret=$? | ||
if [ ${ret} = 0 ] ; then | ||
mv ${basename}.json ${basename}.orig.json | ||
mv ${basename}.combined.json ${basename}.json | ||
echo "Lang ${lang} combined successfully" | ||
else | ||
echo "Error during combining lang ${lang}, check if json is valid" | ||
exit 1 | ||
fi | ||
else | ||
echo "Nothing to combine for lang ${lang}" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG HCW_BACKEND_VERSION | ||
FROM iabsis/hcw-backend:${HCW_BACKEND_VERSION} AS i18n-layer | ||
USER root | ||
RUN apt update && apt install -y jq && rm -rf /var/lib/apt/lists/* | ||
COPY assets/* /usr/src/app/config/locales/ | ||
RUN bash /usr/src/app/config/locales/combine.sh | ||
|
||
|
||
FROM iabsis/hcw-backend:${HCW_BACKEND_VERSION} | ||
|
||
COPY --from=i18n-layer /usr/src/app/config/locales/*.json /usr/src/app/config/locales/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
## This script combine the language files | ||
# simply create a file <lang>.override.json and the overrided language | ||
# will be applied on upgrade. | ||
|
||
folder=$(dirname $0) | ||
|
||
for file in ${folder}/??.json ; do | ||
basename=$(echo ${file/.json/}) | ||
filename=$(basename ${file}) | ||
lang=${filename/.json/} | ||
if [ -f ${basename}.override.json ] ; then | ||
jq -s '.[0] * .[1]' ${basename}.json ${basename}.override.json > ${basename}.combined.json ; ret=$? | ||
if [ ${ret} = 0 ] ; then | ||
mv ${basename}.json ${basename}.orig.json | ||
mv ${basename}.combined.json ${basename}.json | ||
echo "Lang ${lang} combined successfully" | ||
else | ||
echo "Error during combining lang ${lang}, check if json is valid" | ||
exit 1 | ||
fi | ||
else | ||
echo "Nothing to combine for lang ${lang}" | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"patient invite": "You have been invited to a %(branding)s session at the following link %(url)s", | ||
"guest invite": "You have been invited to a %(branding)s session at the following link %(url)s" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"patient invite": "Vous avez été invité(e) à une session %(branding)s session sur le lien suivant %(url)s", | ||
"guest invite": "Vous avez été invité(e) à une session %(branding)s session sur le lien suivant %(url)s" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
services: | ||
mongo: | ||
image: mongo:6 | ||
volumes: | ||
- mongo:/data/mongo | ||
|
||
patient: | ||
build: | ||
context: patient | ||
args: | ||
# If you update this, please update .github/workflows/publish-hcw-docker-images.yml | ||
- HCW_PATIENT_VERSION=5.0.14 | ||
user: nginx | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
- BACKEND_URL=http://backend:1337 | ||
depends_on: | ||
- mongo | ||
- backend | ||
|
||
doctor: | ||
build: | ||
context: doctor | ||
args: | ||
# If you update this, please update .github/workflows/publish-hcw-docker-images.yml | ||
- HCW_DOCTOR_VERSION=5.0.9 | ||
user: nginx | ||
ports: | ||
- "8081:8081" | ||
environment: | ||
- BACKEND_URL=http://backend:1337 | ||
depends_on: | ||
- mongo | ||
- backend | ||
|
||
admin: | ||
build: | ||
context: admin | ||
args: | ||
# If you update this, please update .github/workflows/publish-hcw-docker-images.yml | ||
- HCW_ADMIN_VERSION=5.0.2 | ||
user: nginx | ||
ports: | ||
- "8082:8082" | ||
environment: | ||
- BACKEND_URL=http://backend:1337 | ||
depends_on: | ||
- mongo | ||
- backend | ||
|
||
backend: | ||
build: | ||
context: backend | ||
args: | ||
#If you update this, please update .github/workflows/publish-hcw-docker-images.yml | ||
- HCW_BACKEND_VERSION=5.0.19 | ||
user: node | ||
ports: | ||
- "1337:1337" | ||
env_file: | ||
- ./secrets.env | ||
environment: | ||
# Configure here database, by default | ||
# a local mongo is used. | ||
- DB_URI=mongodb://mongo:27017/hcw-athome | ||
- REDIS_HOST=redis | ||
# don't use on PROD ! | ||
- NODE_ENV=development | ||
- LOGIN_METHOD=password | ||
- DOCTOR_URL=http://localhost:8081 | ||
- EXPERT_FQDN=http://localhost:8080 | ||
- PATIENT_FQDN=http://localhost:8080 | ||
- CLAM_HOST=clamav | ||
- MEDIASOUP_URL=http://mediasoup | ||
- MEDIASOUP_USER=mediasoup_user | ||
- BRANDING=Teleconnect | ||
- ACCESSIBILITY_MODE=false | ||
- ATTACHMENTS_DIR=/data/attachments | ||
|
||
depends_on: | ||
- mongo | ||
- redis | ||
- clamav | ||
volumes: | ||
- backend-attachments:/data/attachments | ||
restart: always | ||
|
||
redis: | ||
image: redis | ||
|
||
clamav: | ||
image: clamav/clamav:1.2 | ||
ports: | ||
- "3310:3310" | ||
|
||
mediasoup: | ||
image: iabsis/mediasoup-api:latest | ||
env_file: | ||
- ./secrets.env | ||
environment: | ||
- API_USER=mediasoup_user | ||
- REDIS_HOST=redis | ||
|
||
|
||
volumes: | ||
backend-attachments: | ||
name: hcw-backend-attachments | ||
driver: local | ||
mongo: | ||
name: hcw-mongo | ||
driver: local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
ARG HCW_DOCTOR_VERSION | ||
FROM iabsis/hcw-doctor:${HCW_DOCTOR_VERSION} AS i18n-layer | ||
USER root | ||
RUN apt update && apt install -y jq && rm -rf /var/lib/apt/lists/* | ||
COPY assets/* /usr/share/nginx/html/assets/i18n | ||
RUN bash /usr/share/nginx/html/assets/i18n/combine.sh | ||
|
||
|
||
FROM iabsis/hcw-doctor:${HCW_DOCTOR_VERSION} | ||
|
||
COPY --from=i18n-layer /usr/share/nginx/html/assets/i18n/*.* /usr/share/nginx/html/assets/i18n/ |
Oops, something went wrong.