Skip to content

Commit

Permalink
Change to typescript from js and show service request history (#269)
Browse files Browse the repository at this point in the history
* Use typescript

* Fix bugs

* lint

* Convert more to typescript

* More typescript

* User service req view

* Update dockerfile

* Implement service history
  • Loading branch information
piyushroshan authored Aug 28, 2024
1 parent f9e6188 commit f2c312e
Show file tree
Hide file tree
Showing 116 changed files with 26,385 additions and 35,190 deletions.
14 changes: 7 additions & 7 deletions deploy/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ services:
crapi-identity:
container_name: crapi-identity
image: crapi/crapi-identity:${VERSION:-latest}
#ports:
# - "${LISTEN_IP:-127.0.0.1}:8080:8080"
ports:
- "${LISTEN_IP:-127.0.0.1}:8080:8080"
volumes:
- ./keys:/keys
environment:
Expand Down Expand Up @@ -170,7 +170,7 @@ services:
crapi-workshop:
condition: service_healthy
healthcheck:
test: curl 0.0.0.0:80/web/health
test: curl 0.0.0.0:80/health
interval: 15s
timeout: 15s
retries: 15
Expand All @@ -188,8 +188,8 @@ services:
POSTGRES_USER: admin
POSTGRES_PASSWORD: crapisecretpassword
POSTGRES_DB: crapi
#ports:
# - "${LISTEN_IP:-127.0.0.1}:5432:5432"
ports:
- "${LISTEN_IP:-127.0.0.1}:5432:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready" ]
interval: 15s
Expand All @@ -209,8 +209,8 @@ services:
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: crapisecretpassword
#ports:
# - "${LISTEN_IP:-127.0.0.1}:27017:27017"
ports:
- "${LISTEN_IP:-127.0.0.1}:27017:27017"
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongo mongodb:27017/test --quiet
interval: 15s
Expand Down
2 changes: 1 addition & 1 deletion services/gateway-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.17-buster as builder
FROM golang:1.17-buster AS builder

WORKDIR /app

Expand Down
2 changes: 1 addition & 1 deletion services/mailhog/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# MailHog Dockerfile
#

FROM golang:alpine as builder
FROM golang:alpine AS builder

# Install MailHog:
RUN apk --no-cache add --virtual build-dependencies \
Expand Down
11 changes: 5 additions & 6 deletions services/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@


# Node build
FROM node:16 as build
FROM node:16 AS build
RUN mkdir /app
WORKDIR /app
COPY ./package.json /app/package.json
COPY ./package-lock.json /app/package-lock.json
COPY ./*.json /app/
RUN npm install --silent
COPY ./src /app/src
COPY ./public /app/public
RUN cp /app/src/config.js.template /app/src/config.js
RUN NODE_OPTIONS=--max_old_space_size=768 npm run build
COPY ./src/config.ts.template /app/src/config.ts
RUN NODE_OPTIONS=--max-old-space-size=1536 npm run build
RUN ls /app/build

# Main Image
Expand All @@ -40,4 +39,4 @@ RUN echo "daemon off;" >> /usr/local/openresty/nginx/conf/nginx.conf
EXPOSE 80
EXPOSE 443

CMD /etc/nginx/nginx-wrapper.sh
CMD [ "/etc/nginx/nginx-wrapper.sh" ]
40 changes: 28 additions & 12 deletions services/web/nginx.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ server {
try_files $uri $uri/ =404;
}

location /static {
try_files $uri $uri/ =404;
}

location /.well-known/jwks.json {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE}/identity/api/auth/jwks.json;
}
Expand All @@ -83,13 +87,17 @@ server {
sub_filter_once off;
}

location /health {
add_header Content-Type text/plain;
return 200 'OK';
}

location / {
try_files $uri /index.html =404;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
set $fallback_file /index.html;
if ($http_accept !~ text/html) {
set $fallback_file =404;
}
try_files $uri $uri/ $fallback_file =404;
}
}

Expand Down Expand Up @@ -152,6 +160,10 @@ server {
try_files $uri $uri/ =404;
}

location /static {
try_files $uri $uri/ =404;
}

location /.well-known/jwks.json {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE}/identity/api/auth/jwks.json;
}
Expand All @@ -173,12 +185,16 @@ server {
sub_filter_once off;
}

location /health {
add_header Content-Type text/plain;
return 200 'OK';
}

location / {
try_files $uri /index.html =404;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
set $fallback_file /index.html;
if ($http_accept !~ text/html) {
set $fallback_file =404;
}
try_files $uri $uri/ $fallback_file =404;
}
}
40 changes: 28 additions & 12 deletions services/web/nginx.ssl.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ server {
try_files $uri $uri/ =404;
}

location /static {
try_files $uri $uri/ =404;
}

location /.well-known/jwks.json {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE}/identity/api/auth/jwks.json;
proxy_ssl_verify off;
Expand All @@ -92,13 +96,17 @@ server {
proxy_ssl_trusted_certificate /app/certs/server.crt;
}

location /health {
add_header Content-Type text/plain;
return 200 'OK';
}

location / {
try_files $uri /index.html =404;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
set $fallback_file /index.html;
if ($http_accept !~ text/html) {
set $fallback_file =404;
}
try_files $uri $uri/ $fallback_file =404;
}
}

Expand Down Expand Up @@ -161,6 +169,10 @@ server {
try_files $uri $uri/ =404;
}

location /static {
try_files $uri $uri/ =404;
}

location /.well-known/jwks.json {
proxy_pass ${HTTP_PROTOCOL}://${IDENTITY_SERVICE}/identity/api/auth/jwks.json;
}
Expand All @@ -182,12 +194,16 @@ server {
sub_filter_once off;
}

location /health {
add_header Content-Type text/plain;
return 200 'OK';
}

location / {
try_files $uri /index.html =404;
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
set $fallback_file /index.html;
if ($http_accept !~ text/html) {
set $fallback_file =404;
}
try_files $uri $uri/ $fallback_file =404;
}
}
Loading

0 comments on commit f2c312e

Please sign in to comment.