Skip to content

Commit

Permalink
Finish release/23.04
Browse files Browse the repository at this point in the history
Release/23.04
  • Loading branch information
dragos-dobre authored May 24, 2023
2 parents 5837222 + bed23e6 commit efed17d
Show file tree
Hide file tree
Showing 14 changed files with 217 additions and 70 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# The root of backend api. Have to match the SITE_ROOT value on openIMIS backend
REACT_APP_API_URL=api
23 changes: 5 additions & 18 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
ci:
# The type of runner that the job will run on
runs-on: ubuntu-latest

Expand All @@ -22,32 +22,19 @@ jobs:
with:
node-version: "16"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: cache # use this to check for `cache-hit` (`steps.cache.outputs.cache-hit != 'true'`)
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Check package.json
run: yarn check-package
run: npm run check-package

# Runs a single command using the runners shell
- name: Prepare openIMIS Dependencies
run: yarn load-config
run: npm run load-config

- name: Install dependencies
run: yarn install # Since we edit package.json with the openIMIS deps, we cannot use --frozen-lockfile
run: npm install # Since we edit package.json with the openIMIS deps, we cannot use --frozen-lockfile

- name: Build
run: yarn build
run: npm run build

- uses: actions/upload-artifact@v2
with:
Expand Down
23 changes: 5 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,21 @@ jobs:
with:
node-version: "16"

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: cache # use this to check for `cache-hit` (`steps.cache.outputs.cache-hit != 'true'`)
with:
path: |
**/node_modules
${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Check package.json
run: yarn check-package
run: npm run check-package

# Runs a single command using the runners shell
- name: Prepare openIMIS Dependencies
run: yarn load-config
run: npm run load-config

- name: Install dependencies
run: yarn install # Since we edit package.json with the openIMIS deps, we cannot use --frozen-lockfile
run: npm install # Since we edit package.json with the openIMIS deps, we cannot use --frozen-lockfile

- name: Build
run: yarn build
run: npm run build

- uses: actions/upload-artifact@v2
with:
name: frontend-${GITHUB_REF_NAME_SLUG}-${{github.sha}}
path: ./build/*

22 changes: 22 additions & 0 deletions .github/workflows/docker-manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: create manual docker image
on:
workflow_dispatch:
inputs:
tag:
required: true

jobs:
publish-manual-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the openimis backend Docker image
run: |
docker build . --tag ghcr.io/openimis/openimis-fe:${{ github.event.inputs.tag }}
docker push ghcr.io/openimis/openimis-fe:${{ github.event.inputs.tag }}
22 changes: 22 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: create daily docker image on develop
on:
schedule:
- cron: "0 2 * * *"
jobs:
publish-docker-develop-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: develop
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the openimis backend Docker image
run: |
LABEL=develop
docker build . --tag ghcr.io/openimis/openimis-fe:${LABEL}
docker push ghcr.io/openimis/openimis-fe:${LABEL}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ modules-unlinks.txt
src/modules.js
src/locales.js
.idea
yarn.lock
yarn.lock
.env
42 changes: 35 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
FROM node:16 AS react-build
RUN mkdir app
FROM node:16 AS build-stage
RUN mkdir /app
COPY ./ /app
WORKDIR /app
RUN chown node /app -R
RUN npm install --global serve
RUN apt-get update && apt-get install -y nano openssl software-properties-common
RUN openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/privkey.pem -out /etc/ssl/private/fullchain.pem -subj "/C=DE/ST=_/L=_/O=_/OU=_/CN=localhost"
USER node
ARG OPENIMIS_CONF_JSON
ENV OPENIMIS_CONF_JSON=${OPENIMIS_CONF_JSON}
RUN yarn load-config
RUN yarn install
RUN yarn build
RUN yarn global add serve
CMD ["yarn","start"]
ENV NODE_ENV=production
RUN npm run load-config
RUN npm install
RUN npm run build


### NGINX


FROM nginx:latest
#COPY APP
COPY --from=build-stage /app/build/ /usr/share/nginx/html
#COPY DEFAULT CERTS
COPY --from=build-stage /etc/ssl/private/ /etc/nginx/ssl/live/host

COPY conf/openimis.conf /conf/openimis.conf
COPY script/entrypoint.sh /script/entrypoint.sh
RUN chmod a+x /script/entrypoint.sh
WORKDIR /script
ENV DATA_UPLOAD_MAX_MEMORY_SIZE=12582912
ENV NEW_OPENIMIS_HOST="localhost"
ENV PUBLIC_URL="front"
ENV REACT_APP_API_URL="api"
ENV ROOT_MOBILEAPI="rest"
ENV FORCE_RELOAD=""

ENTRYPOINT ["/bin/bash","/script/entrypoint.sh"]
CMD ["nginx", "-g", "daemon off;"]
14 changes: 14 additions & 0 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
events {
worker_connections 4096; ## Default: 1024
}

http {
include mime.types;
default_type application/octet-stream;
access_log ./logs/access.log;
error_log ./logs/error.log debug;
sendfile on;
keepalive_timeout 65;
gzip on;
include ./conf/openIMIS.conf;
}
50 changes: 50 additions & 0 deletions conf/openimis.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

server {
resolver 127.0.0.11 valid=30s;
set $dockerbackend "backend:8000";
set $dockerrestapi "restapi:80";

client_max_body_size ${DATA_UPLOAD_MAX_MEMORY_SIZE};
listen 443 ssl;
listen 80;
server_name ${NEW_OPENIMIS_HOST};

ssl_certificate /etc/letsencrypt/live/${NEW_OPENIMIS_HOST}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${NEW_OPENIMIS_HOST}/privkey.pem;
root /usr/share/nginx/html;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location /.well-known {
root /var/www/html;
}

location / {
return 302 https://$host/${PUBLIC_URL}/${REDIRECT_TAIL};
}

location /${PUBLIC_URL} {
try_files $uri $uri/ /${PUBLIC_URL}/index.html;
#error_page 404 $scheme://$host/front/;
}

location /${REACT_APP_API_URL}/ {
proxy_pass http://${dockerbackend};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto https;
}

location /${ROOT_MOBILEAPI}/ {
#this rewrite rule is required to remove "ROOT_MOBILEAPI" because implicite rule (/ at the end of the url) donc work with variable
rewrite /${ROOT_MOBILEAPI}/(.*) /$1 break;
proxy_pass http://${dockerrestapi};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $server_name;
}
}
46 changes: 23 additions & 23 deletions openimis.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,93 +18,93 @@
}
],
"modules": [
{
{
"name": "CoreModule",
"npm": "@openimis/fe-core@>=1.5.0"
"npm": "@openimis/fe-core@>=1.5.1"
},
{
"name": "HomeModule",
"npm": "@openimis/fe-home@>=1.5.0"
"npm": "@openimis/fe-home@>=1.5.1"
},
{
"name": "LocationModule",
"npm": "@openimis/fe-location@>=1.4.0"
"npm": "@openimis/fe-location@>=1.4.1"
},
{
"name": "InsureeModule",
"npm": "@openimis/fe-insuree@>=1.5.0"
"npm": "@openimis/fe-insuree@>=1.5.1"
},
{
"name": "MedicalModule",
"npm": "@openimis/fe-medical@>=1.5.0"
"npm": "@openimis/fe-medical@>=1.5.1"
},
{
"name": "MedicalPriceListModule",
"npm": "@openimis/fe-medical_pricelist@>=1.5.0"
"npm": "@openimis/fe-medical_pricelist@>=1.5.1"
},
{
"name": "ProductModule",
"npm": "@openimis/fe-product@>=1.5.0"
"npm": "@openimis/fe-product@>=1.5.1"
},
{
"name": "PolicyModule",
"npm": "@openimis/fe-policy@>=1.5.0"
"npm": "@openimis/fe-policy@>=1.5.1"
},
{
"name": "PayerModule",
"npm": "@openimis/fe-payer@>=1.4.1"
"npm": "@openimis/fe-payer@>=1.4.2"
},
{
"name": "ContributionModule",
"npm": "@openimis/fe-contribution@>=1.4.1"
"npm": "@openimis/fe-contribution@>=1.4.2"
},
{
"name": "PaymentModule",
"npm": "@openimis/fe-payment@>=1.4.1"
"npm": "@openimis/fe-payment@>=1.4.2"
},
{
"name": "ClaimModule",
"npm": "@openimis/fe-claim@>=1.4.1"
"npm": "@openimis/fe-claim@>=1.4.3"
},
{
"name": "ClaimBatchModule",
"npm": "@openimis/fe-claim_batch@>=1.4.1"
"npm": "@openimis/fe-claim_batch@>=1.4.2"
},
{
"name": "AdminModule",
"npm": "@openimis/fe-admin@>=1.5.0"
"npm": "@openimis/fe-admin@>=1.5.1"
},
{
"name": "ToolsModule",
"npm": "@openimis/fe-tools@>=1.5.0"
"npm": "@openimis/fe-tools@>=1.5.2"
},
{
"name": "ProfileModule",
"npm": "@openimis/fe-profile@>=1.5.0"
"npm": "@openimis/fe-profile@>=1.5.1"
},
{
"name": "LanguageFrModule",
"npm": "@openimis/fe-language_fr@>=1.5.1"
"npm": "@openimis/fe-language_fr@>=1.5.2"
},
{
"name": "CalculationModule",
"npm": "@openimis/fe-calculation@>=1.4.1"
"npm": "@openimis/fe-calculation@>=1.4.2"
},
{
"name": "PolicyHolderModule",
"npm": "@openimis/fe-policyholder@>=1.4.1"
"npm": "@openimis/fe-policyholder@>=1.4.2"
},
{
"name": "ContributionPlanModule",
"npm": "@openimis/fe-contribution_plan@>=1.5.0"
"npm": "@openimis/fe-contribution_plan@>=1.5.1"
},
{
"name": "ContractModule",
"npm": "@openimis/fe-contract@>=1.4.1"
"npm": "@openimis/fe-contract@>=1.4.2"
},
{
"name": "InvoiceModule",
"npm": "@openimis/fe-invoice@>=1.4.1"
"npm": "@openimis/fe-invoice@>=1.4.2"
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openimis/fe",
"version": "1.4.0",
"version": "23.04",
"license": "AGPL-3.0-only",
"proxy": "http://localhost:8000",
"homepage": "http://localhost:3000/front",
Expand Down
Loading

0 comments on commit efed17d

Please sign in to comment.