Compare commits

...

4 Commits

Author SHA1 Message Date
Simon Larsen
446e947cc9 Update Dockerfile and package.json scripts 2024-02-02 07:07:26 +00:00
Simon Larsen
428c563659 Remove accounts service from docker-compose files 2024-02-02 06:45:57 +00:00
Simon Larsen
34a83637e1 Update Dockerfile and package.json for Accounts feature 2024-02-02 06:44:59 +00:00
Simon Larsen
27d030ab30 move accounts to featureset 2024-02-02 06:34:53 +00:00
99 changed files with 57 additions and 228 deletions

View File

@@ -1,56 +0,0 @@
.git
node_modules
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
node_modules
.idea
# testing
/coverage
# production
/build
# misc
.DS_Store
env.js
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
*.local.sh
*.local.yaml
run
stop
nohup.out*
encrypted-credentials.tar
encrypted-credentials/
_README.md
# Important Add production values to gitignore.
values-saas-production.yaml
kubernetes/values-saas-production.yaml
/private
/tls_cert.pem
/tls_key.pem
/keys
temp_readme.md
tests/coverage
settings.json
GoSDK/tester/

View File

@@ -1 +0,0 @@
*.js text eol=lf

23
Accounts/.gitignore vendored
View File

@@ -1,23 +0,0 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
node_modules
.idea
# testing
/coverage
# production
/build
/dist
# misc
.DS_Store
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock
Untitled-1
.eslintcache

View File

@@ -1,89 +0,0 @@
#
# Accounts Dockerfile
#
# Pull base image nodejs image.
FROM node:21.6-alpine3.18
USER root
RUN mkdir /tmp/npm && chmod 2777 /tmp/npm && chown 1000:1000 /tmp/npm && npm config set cache /tmp/npm --global
ARG GIT_SHA
ARG APP_VERSION
ENV GIT_SHA=${GIT_SHA}
ENV APP_VERSION=${APP_VERSION}
# Install bash.
RUN apk add bash && apk add curl
#Use bash shell by default
SHELL ["/bin/bash", "-c"]
RUN mkdir /usr/src
WORKDIR /usr/src/Common
COPY ./Common/package*.json /usr/src/Common/
RUN npm install
COPY ./Common /usr/src/Common
WORKDIR /usr/src/Model
COPY ./Model/package*.json /usr/src/Model/
RUN npm install
COPY ./Model /usr/src/Model
WORKDIR /usr/src/CommonServer
COPY ./CommonServer/package*.json /usr/src/CommonServer/
RUN npm install
COPY ./CommonServer /usr/src/CommonServer
# Install CommonUI
WORKDIR /usr/src/CommonUI
COPY ./CommonUI/package*.json /usr/src/CommonUI/
RUN npm install --force
COPY ./CommonUI /usr/src/CommonUI
ENV PRODUCTION=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
WORKDIR /usr/src/app
# Install app dependencies
COPY ./Accounts/package*.json /usr/src/app/
RUN npm install
# Expose ports.
# - 3003: accounts
EXPOSE 3003
RUN npm i -D webpack-cli
{{ if eq .Env.ENVIRONMENT "development" }}
RUN mkdir /usr/src/app/dev-env
RUN touch /usr/src/app/dev-env/.env
RUN npm i -D webpack-dev-server
#Run the app
CMD [ "npm", "run", "dev" ]
{{ else }}
# Copy app source
COPY ./Accounts /usr/src/app
# Bundle app source
RUN npm run build
#Run the app
CMD [ "npm", "start" ]
{{ end }}

View File

@@ -1,4 +0,0 @@
{
"watch": ["webpack.config.js"],
"exec": "export DEBUG=express:* && printenv > /usr/src/app/dev-env/.env && echo 'HOST=localhost' >> /usr/src/app/dev-env/.env && echo 'USE_HTTPS=false' >> /usr/src/app/dev-env/.env && webpack-dev-server --port=3003 --mode=development"
}

View File

@@ -28,6 +28,8 @@ SHELL ["/bin/bash", "-c"]
RUN mkdir /usr/src
WORKDIR /usr/src/Common
COPY ./Common/package*.json /usr/src/Common/
RUN npm install
@@ -56,12 +58,32 @@ WORKDIR /usr/src/app
COPY ./App/package*.json /usr/src/app/
RUN npm install
# Install global npm modules
RUN npm i -D webpack-cli
# Expose ports.
# - 3002: OneUptime-backend
EXPOSE 3002
# -----------------
# Install Accounts REact App
# -----------------
COPY ./App/FeatureSet/Accounts/package*.json /usr/src/app/FeatureSet/Accounts/
RUN cd /usr/src/app/FeatureSet/Accounts && npm install
{{ if eq .Env.ENVIRONMENT "development" }}
#Run the app
RUN mkdir /usr/src/app/dev-env
RUN touch /usr/src/app/dev-env/.env
RUN npm i -D webpack-dev-server
CMD [ "npm", "run", "dev" ]
{{ else }}
# Copy app source
@@ -69,5 +91,9 @@ COPY ./App /usr/src/app
# Bundle app source
RUN npm run compile
#Run the app
# Build Accounts.
RUN cd /usr/src/app/FeatureSet/Accounts && npm run build
CMD [ "npm", "start" ]
{{ end }}

View File

@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": false,
"scripts": {
"dev": "npx nodemon",
"dev": "printenv > /usr/src/app/FeatureSet/Accounts/dev-env/.env && echo 'HOST=localhost' >> /usr/src/app/featureset/accounts/dev-env/.env && echo 'USE_HTTPS=false' >> /usr/src/app/featureset/accounts/dev-env/.env && webpack-dev-server --port=3003 --mode=development",
"build": "webpack build --mode=production",
"test": "",
"compile": "tsc",

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

Before

Width:  |  Height:  |  Size: 804 B

After

Width:  |  Height:  |  Size: 804 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

14
App/dev.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
# Start the main app
node --inspect=0.0.0.0:9229 --require ts-node/register Index.ts &
# Start the accounts app
cd ./FeatureSet/Accounts && npm run dev &
# Wait for any process to exit
wait -n
# Exit with status of process that exited first
exit $?

View File

@@ -4,5 +4,5 @@
"ignore": [
"greenlock.d/*"
],
"exec": "node --inspect=0.0.0.0:9229 --require ts-node/register Index.ts"
"exec": "bash dev.sh"
}

View File

@@ -4,7 +4,7 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "node --require ts-node/register Index.ts",
"start": "bash run.sh",
"compile": "tsc",
"clear-modules": "rm -rf node_modules && rm package-lock.json && npm install",
"dev": "npx nodemon",

13
App/run.sh Normal file
View File

@@ -0,0 +1,13 @@
#!/bin/bash
# Start the main app
node --require ts-node/register Index.ts &
# Start the accounts app
cd ./FeatureSet/Accounts && npm start &
# Wait for any process to exit
wait -n
# Exit with status of process that exited first
exit $?

View File

@@ -1,7 +1,3 @@
upstream accounts {
server ${SERVER_ACCOUNTS_HOSTNAME}:${ACCOUNTS_PORT} weight=10 max_fails=3 fail_timeout=30s;
}
upstream app {
server ${SERVER_APP_HOSTNAME}:${APP_PORT} weight=10 max_fails=3 fail_timeout=30s;
}
@@ -354,7 +350,7 @@ server {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://accounts;
proxy_pass http://app/accounts;
}
location /otlp/ {

View File

@@ -148,18 +148,6 @@ services:
driver: "local"
options:
max-size: "1000m"
accounts:
networks:
- oneuptime
restart: always
environment:
<<: *common-ui-variables
PORT: ${ACCOUNTS_PORT}
logging:
driver: "local"
options:
max-size: "1000m"
admin-dashboard:
@@ -195,9 +183,6 @@ services:
environment:
<<: *common-ui-variables
PORT: ${STATUS_PAGE_PORT}
depends_on:
- accounts
- app
logging:
driver: "local"
options:
@@ -316,7 +301,6 @@ services:
ingress:
depends_on:
- accounts
- app
- dashboard
- otel-collector

View File

@@ -42,31 +42,6 @@ services:
network: host
context: .
dockerfile: ./OTelCollector/Dockerfile
accounts:
ports:
- '${ACCOUNTS_PORT}:${ACCOUNTS_PORT}' # ws port for webpack
extends:
file: ./docker-compose.base.yml
service: accounts
volumes:
- ./Accounts:/usr/src/app
# Use node modules of the container and not host system.
# https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder
- /usr/src/app/dev-env
- /usr/src/app/node_modules/
- ./Common:/usr/src/Common
- ./Model:/usr/src/Model
- ./CommonServer:/usr/src/CommonServer
- ./CommonUI:/usr/src/CommonUI
- /usr/src/Common/node_modules/
- /usr/src/CommonUI/node_modules/
- /usr/src/CommonServer/node_modules/
- /usr/src/Model/node_modules/
build:
network: host
context: .
dockerfile: ./Accounts/Dockerfile
dashboard:

View File

@@ -33,12 +33,6 @@ services:
extends:
file: ./docker-compose.base.yml
service: otel-collector
accounts:
image: oneuptime/accounts:${APP_TAG}
extends:
file: ./docker-compose.base.yml
service: accounts
dashboard: