mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
add integration service
This commit is contained in:
parent
9efb28f350
commit
8c21c34a27
21
.github/workflows/compile.integration.yaml
vendored
Normal file
21
.github/workflows/compile.integration.yaml
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
name: Compile Integration
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'hotfix-*'
|
||||
- 'release'
|
||||
- 'staging-release'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
check-latest: true
|
||||
- run: cd Common && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd Integration && npm install && npm run compile
|
||||
|
20
.github/workflows/docker-build.integration.yaml
vendored
Normal file
20
.github/workflows/docker-build.integration.yaml
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
name: Integration Docker Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- 'hotfix-*'
|
||||
- 'release'
|
||||
- 'staging-release'
|
||||
|
||||
jobs:
|
||||
# define job to build docker image
|
||||
licensing-docker-build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# build image for licensing
|
||||
- name: build docker image
|
||||
run: npm run build-ci integration
|
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@ -94,6 +94,18 @@
|
||||
],
|
||||
"type": "pwa-node"
|
||||
},
|
||||
{
|
||||
"address": "0.0.0.0",
|
||||
"localRoot": "${workspaceFolder}/Alert",
|
||||
"name": "Integration: Debug with Docker",
|
||||
"port": 9134,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"type": "pwa-node"
|
||||
},
|
||||
{
|
||||
"address": "0.0.0.0",
|
||||
"localRoot": "${workspaceFolder}/licensing",
|
||||
|
1
Integration/.env
Normal file
1
Integration/.env
Normal file
@ -0,0 +1 @@
|
||||
CLUSTER_KEY=test
|
61
Integration/Dockerfile
Normal file
61
Integration/Dockerfile
Normal file
@ -0,0 +1,61 @@
|
||||
#
|
||||
# OneUptime-Integration Dockerfile
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
FROM node:alpine
|
||||
|
||||
# Install bash.
|
||||
RUN apk update && apk add bash && apk add curl
|
||||
|
||||
|
||||
# Install python
|
||||
RUN apk update && apk add --no-cache --virtual .gyp python3 make g++
|
||||
|
||||
#Use bash shell by default
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
RUN npm install typescript -g
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
RUN mkdir /usr/src/Common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
COPY ./Common /usr/src/Common
|
||||
RUN npm run compile
|
||||
|
||||
# Install CommonServer
|
||||
RUN mkdir /usr/src/CommonServer
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
COPY ./CommonServer /usr/src/CommonServer
|
||||
RUN npm run compile
|
||||
|
||||
#SET ENV Variables
|
||||
ENV PRODUCTION=true
|
||||
|
||||
RUN mkdir /usr/src/app
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install trivy for container scanning
|
||||
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
|
||||
# Install app dependencies
|
||||
COPY ./Integration/package*.json /usr/src/app/
|
||||
RUN npm install
|
||||
RUN npm install -g ts-node
|
||||
|
||||
# Bundle app source
|
||||
COPY ./Integration /usr/src/app
|
||||
|
||||
# Expose ports.
|
||||
# - 3089: OneUptime-backend
|
||||
EXPOSE 3089
|
||||
|
||||
#Run the app
|
||||
RUN npm run compile
|
||||
CMD [ "npm", "start"]
|
63
Integration/Dockerfile.dev
Normal file
63
Integration/Dockerfile.dev
Normal file
@ -0,0 +1,63 @@
|
||||
#
|
||||
# OneUptime-Integration Dockerfile
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
FROM node:alpine
|
||||
|
||||
# Install bash.
|
||||
RUN apk update && apk add bash && apk add curl
|
||||
|
||||
|
||||
# Install python
|
||||
RUN apk update && apk add --no-cache --virtual .gyp python3 make g++
|
||||
|
||||
#Use bash shell by default
|
||||
SHELL ["/bin/bash", "-c"]
|
||||
RUN npm install typescript -g
|
||||
|
||||
RUN mkdir /usr/src
|
||||
|
||||
# Install common
|
||||
RUN mkdir /usr/src/Common
|
||||
WORKDIR /usr/src/Common
|
||||
COPY ./Common/package*.json /usr/src/Common/
|
||||
RUN npm install
|
||||
COPY ./Common /usr/src/Common
|
||||
RUN npm run compile
|
||||
|
||||
# Install CommonServer
|
||||
RUN mkdir /usr/src/CommonServer
|
||||
WORKDIR /usr/src/CommonServer
|
||||
COPY ./CommonServer/package*.json /usr/src/CommonServer/
|
||||
RUN npm install
|
||||
COPY ./CommonServer /usr/src/CommonServer
|
||||
RUN npm run compile
|
||||
|
||||
#SET ENV Variables
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install trivy for container scanning
|
||||
RUN curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/master/contrib/install.sh | sh -s -- -b /usr/local/bin
|
||||
|
||||
# Install app dependencies
|
||||
RUN cd /usr/src/app
|
||||
|
||||
RUN mkdir -p greenlock.d || echo "Directory already exists"
|
||||
|
||||
# Copy package.json files
|
||||
COPY ./Integration/package.json /usr/src/app/package.json
|
||||
COPY ./Integration/package-lock.json /usr/src/app/package-lock.json
|
||||
|
||||
|
||||
RUN npm install
|
||||
|
||||
# Expose ports.
|
||||
# - 3088: OneUptime-Integration
|
||||
EXPOSE 3089
|
||||
EXPOSE 9229
|
||||
|
||||
#Run the app
|
||||
RUN npm run compile
|
||||
CMD [ "npm", "run", "dev"]
|
3
Integration/Index.ts
Normal file
3
Integration/Index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import app from 'CommonServer/Utils/StartServer';
|
||||
|
||||
export default app;
|
6358
Integration/package-lock.json
generated
Normal file
6358
Integration/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
Integration/package.json
Normal file
26
Integration/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "integration",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "ts-node index.ts",
|
||||
"compile": "tsc",
|
||||
"dev": "cross-env NODE_ENV=development ts-node-dev --inspect=0.0.0.0 index.ts",
|
||||
"audit": "npm audit --audit-level=low",
|
||||
"dep-check": "depcheck ./ --skip-missing=true",
|
||||
"test": "jest"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"CommonServer": "file:../CommonServer",
|
||||
"Common": "file:../Common"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.5.0",
|
||||
"@types/node": "^17.0.31",
|
||||
"jest": "^28.1.0",
|
||||
"ts-jest": "^28.0.2"
|
||||
}
|
||||
}
|
@ -85,6 +85,23 @@ services:
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
|
||||
integration:
|
||||
ports:
|
||||
- '3089:3089'
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./Integration/Dockerfile
|
||||
env_file:
|
||||
- ./Integration/.env
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
|
||||
- DATABASE_HOST=postgres
|
||||
- CLUSTER_KEY=test
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
|
||||
accounts:
|
||||
ports:
|
||||
|
@ -275,7 +275,7 @@ services:
|
||||
build:
|
||||
network: host
|
||||
context: .
|
||||
dockerfile: ./Identity/Dockerfile.dev
|
||||
dockerfile: ./Alert/Dockerfile.dev
|
||||
env_file:
|
||||
- ./Alert/.env
|
||||
environment:
|
||||
@ -291,6 +291,30 @@ services:
|
||||
# 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/node_modules/
|
||||
|
||||
integration:
|
||||
ports:
|
||||
- '3089:3089'
|
||||
- '9134:9229' # Debugging port.
|
||||
build:
|
||||
network: host
|
||||
context: .
|
||||
dockerfile: ./Integration/Dockerfile.dev
|
||||
env_file:
|
||||
- ./Integration/.env
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
|
||||
- DATABASE_HOST=postgres
|
||||
- CLUSTER_KEY=test
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
volumes:
|
||||
- ./Integration:/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/node_modules/
|
||||
|
||||
dashboard:
|
||||
ports:
|
||||
|
@ -75,6 +75,21 @@ services:
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
|
||||
integration:
|
||||
ports:
|
||||
- '3089:3089'
|
||||
image: oneuptime/integration:latest
|
||||
env_file:
|
||||
- ./Integration/.env
|
||||
environment:
|
||||
- REDIS_HOST=redis
|
||||
- IS_SAAS_SERVICE=${IS_SAAS_SERVICE}
|
||||
- DATABASE_HOST=postgres
|
||||
- CLUSTER_KEY=test
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
|
||||
accounts:
|
||||
ports:
|
||||
|
Loading…
Reference in New Issue
Block a user