Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing CI. #4

Merged
merged 9 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Docker
on:
push:
branches: [ main, sandbox ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
omnibus:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
# - name: "Populate frontend version information"
# run: "cd webapp/frontend && ./git.version.sh"
# - name: "Generate frontend & version information"
# uses: addnab/docker-run-action@v3
# with:
# image: node:lts
# options: -v ${{ github.workspace }}:/work
# run: |
# cd /work
# make binary-frontend && echo "print contents of /work/dist" && ls -alt /work/dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: 'arm64,arm'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
tags: |
type=ref,enable=true,event=branch
type=ref,enable=true,event=tag
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
context: .
file: docker/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# cache-from: type=gha
# cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
cd frontend
npm run dist
go mod vendor
go run backend/cmd/fasten/fasten.go start --config ./config.yaml --debug
go run backend/cmd/fasten/fasten.go start --config ./config.example.yaml --debug
```
19 changes: 13 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /usr/src/fastenhealth/frontend
COPY frontend/package.json ./
RUN yarn install --frozen-lockfile
COPY frontend/ ./
RUN yarn run build -- --output-path=../dist
RUN yarn run build -- --configuration sandbox --output-path=../dist

FROM golang:1.18 as backend-build
WORKDIR /go/src/github.com/fastenhealth/fastenhealth-onprem
Expand All @@ -15,13 +15,20 @@ RUN go mod vendor \
&& go generate ./... \
&& go vet ./... \
&& go test ./...

RUN CGO_ENABLED=0 go build -o /go/bin/fasten ./backend/cmd/fasten/

FROM gcr.io/distroless/static-debian11
# create folder structure
RUN mkdir -p /opt/fasten/db \
mkdir -p /opt/fasten/web \
mkdir -p /opt/fasten/config


COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/dist

FROM gcr.io/distroless/static-debian11
WORKDIR /opt/fasten/
COPY --from=backend-build /opt/fasten/ /opt/fasten/
COPY --from=frontend-build /usr/src/fastenhealth/dist /opt/fasten/web
COPY --from=backend-build /go/bin/fasten /opt/fasten/fasten
COPY LICENSE.md /opt/fasten/LICENSE.md
COPY config.yaml /opt/fasten/config.yaml
CMD ["/opt/fasten/fasten"]
COPY config.yaml /opt/fasten/config/config.yaml
CMD ["/opt/fasten/fasten", "start", "--config", "/opt/fasten/config/config.yaml"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# goweb-template

# Fasten - On Premise/Self-Hosted

Find & replace the following

Expand Down
48 changes: 0 additions & 48 deletions backend/pkg/hub/internal/fhir/cerner/client_test.go

This file was deleted.

2 changes: 1 addition & 1 deletion backend/pkg/hub/internal/fhir/logica/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func TestLogicaClient_SyncAll(t *testing.T) {
defer mockCtrl.Finish()
fakeConfig := mock_config.NewMockInterface(mockCtrl)

testDatabase, err := ioutil.TempFile("testdata", "fasten.db")
testDatabase, err := ioutil.TempFile("", "fasten.db")
require.NoError(t, err)
defer os.Remove(testDatabase.Name())
fakeConfig.EXPECT().GetString("web.database.location").AnyTimes().Return(testDatabase.Name())
Expand Down

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ web:
# used to encrypt/validate JWT session key (used for authentication)
encryptionkey: 'changethissupersecretkey'
listen:
port: 9090
port: 8080
host: 0.0.0.0

# if you're using a reverse proxy like apache/nginx, you can override this value to serve fasten on a subpath.
Expand All @@ -21,8 +21,7 @@ web:
src:
# the location on the filesystem where webapp javascript + css is located
frontend:
# path: /opt/fasten/web
path: ./dist
path: /opt/fasten/web

log:
file: '' #absolute or relative paths allowed, eg. web.log
Expand Down
29 changes: 28 additions & 1 deletion frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,33 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
},
"sandbox": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.sandbox.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
Expand All @@ -65,6 +91,7 @@
}
]
}

}
},
"serve": {
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import {Router} from '@angular/router';
import {NavigationEnd, Router} from '@angular/router';

@Component({
selector: 'app-root',
Expand All @@ -10,7 +10,7 @@ export class AppComponent implements OnInit {
title = 'fastenhealth';

public layoutOption: string;
showHeader:boolean = true;
showHeader:boolean = false;
showFooter:boolean = true;

constructor(private router: Router) {}
Expand All @@ -28,8 +28,8 @@ export class AppComponent implements OnInit {
this.router.events.subscribe(event => this.modifyHeader(event));
}

modifyHeader(location) {
if(location.url?.startsWith('/auth'))
modifyHeader(event) {
if(event instanceof NavigationEnd && event.url?.startsWith('/auth'))
{
this.showHeader = false;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {Component} from '@angular/core';
import {GenericColumnDefn, ListGenericResourceComponent} from './list-generic-resource.component';
import {attributeXTime} from './utils';
import {getPath} from '../../fhir/utils';

@Component({
selector: 'app-list-care-plan',
Expand All @@ -13,8 +12,8 @@ export class ListCarePlanComponent extends ListGenericResourceComponent {
{ title: 'Category', versions: '*', format: 'code', getter: c => c.category[0].coding[0] },
{ title: 'Reason', versions: '*', getter: c => {
return (c.activity || []).map((a, i) => {
let reason = getPath(a, "detail.code.coding.0.display") || ""
return reason ? [reason, getPath(a, "detail.status") || "no data"] : []
let reason = a.detail?.code?.coding[0]?.display || ""
return reason ? [reason, a.detail?.status || "no data"] : []
})
} },
{ title: 'Period', versions: '*', format: 'period', getter: c => c.period },
Expand Down
10 changes: 0 additions & 10 deletions frontend/src/app/fhir/constants.ts

This file was deleted.

Loading