mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
shortner > shortener
This commit is contained in:
parent
9b797b5eed
commit
3520e834eb
4
.github/workflows/compile.yml
vendored
4
.github/workflows/compile.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd ApiReference && npm install && npm run compile
|
||||
|
||||
compile-link-shortner:
|
||||
compile-link-shortener:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
@ -51,7 +51,7 @@ jobs:
|
||||
- run: cd Common && npm install
|
||||
- run: cd Model && npm install
|
||||
- run: cd CommonServer && npm install
|
||||
- run: cd LinkShortner && npm install && npm run compile
|
||||
- run: cd LinkShortener && npm install && npm run compile
|
||||
|
||||
compile-common-server:
|
||||
runs-on: ubuntu-latest
|
||||
|
4
.github/workflows/docker-build.yml
vendored
4
.github/workflows/docker-build.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./Accounts/Dockerfile .
|
||||
|
||||
docker-build-link-shortner:
|
||||
docker-build-link-shortener:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
CI_PIPELINE_ID: ${{github.run_number}}
|
||||
@ -38,7 +38,7 @@ jobs:
|
||||
|
||||
# build image for accounts service
|
||||
- name: build docker image
|
||||
run: sudo docker build -f ./LinkShortner/Dockerfile .
|
||||
run: sudo docker build -f ./LinkShortener/Dockerfile .
|
||||
|
||||
docker-build-api-reference:
|
||||
runs-on: ubuntu-latest
|
||||
|
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@ -216,7 +216,7 @@ jobs:
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
link-shortner-docker-image-deploy:
|
||||
link-shortener-docker-image-deploy:
|
||||
needs: generate-build-number
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -225,8 +225,8 @@ jobs:
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: |
|
||||
oneuptime/link-shortner
|
||||
ghcr.io/oneuptime/link-shortner
|
||||
oneuptime/link-shortener
|
||||
ghcr.io/oneuptime/link-shortener
|
||||
tags: |
|
||||
type=raw,value=test,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
||||
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
|
||||
@ -250,7 +250,7 @@ jobs:
|
||||
- name: Generate Dockerfile from Dockerfile.tpl
|
||||
run: npm run prerun
|
||||
|
||||
# Build and deploy link-shortner.
|
||||
# Build and deploy link-shortener.
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v2.2.0
|
||||
@ -268,7 +268,7 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
file: ./LinkShortner/Dockerfile
|
||||
file: ./LinkShortener/Dockerfile
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
|
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@ -57,8 +57,8 @@
|
||||
},
|
||||
{
|
||||
"address": "127.0.0.1",
|
||||
"localRoot": "${workspaceFolder}/LinkShortner",
|
||||
"name": "Link Shortner: Debug with Docker",
|
||||
"localRoot": "${workspaceFolder}/LinkShortener",
|
||||
"name": "Link Shortener: Debug with Docker",
|
||||
"port": 9826,
|
||||
"remoteRoot": "/usr/src/app",
|
||||
"request": "attach",
|
||||
|
@ -66,8 +66,8 @@ export const WorkerHostname: Hostname = Hostname.fromString(
|
||||
process.env['WORKER_HOSTNAME'] || 'worker'
|
||||
);
|
||||
|
||||
export const LinkShortnerHostname: Route = new Route(
|
||||
process.env['LINK_SHORTNER_HOSTNAME'] || 'link-shortner'
|
||||
export const LinkShortenerHostname: Route = new Route(
|
||||
process.env['LINK_SHORTENER_HOSTNAME'] || 'link-shortener'
|
||||
);
|
||||
|
||||
export const WorkflowHostname: Hostname = Hostname.fromString(
|
||||
@ -128,8 +128,8 @@ export const StatusPageRoute: Route = new Route(
|
||||
process.env['STATUS_PAGE_ROUTE'] || '/status-page'
|
||||
);
|
||||
|
||||
export const LinkShortnerRoute: Route = new Route(
|
||||
process.env['LINK_SHORTNER_ROUTE'] || '/l'
|
||||
export const LinkShortenerRoute: Route = new Route(
|
||||
process.env['LINK_SHORTENER_ROUTE'] || '/l'
|
||||
);
|
||||
|
||||
export const DashboardRoute: Route = new Route(
|
||||
|
@ -4,7 +4,7 @@ import DatabaseService, { OnCreate } from './DatabaseService';
|
||||
import CreateBy from '../Types/Database/CreateBy';
|
||||
import Text from 'Common/Types/Text';
|
||||
import URL from 'Common/Types/API/URL';
|
||||
import { Domain, HttpProtocol, LinkShortnerRoute } from '../Config';
|
||||
import { Domain, HttpProtocol, LinkShortenerRoute } from '../Config';
|
||||
import Route from 'Common/Types/API/Route';
|
||||
|
||||
export class Service extends DatabaseService<Model> {
|
||||
@ -31,7 +31,7 @@ export class Service extends DatabaseService<Model> {
|
||||
return new URL(
|
||||
HttpProtocol,
|
||||
Domain,
|
||||
new Route(LinkShortnerRoute.toString()).addRoute(
|
||||
new Route(LinkShortenerRoute.toString()).addRoute(
|
||||
'/' + model.shortId?.toString()
|
||||
)
|
||||
);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# OneUptime-LinkShortner Dockerfile
|
||||
# OneUptime-LinkShortener Dockerfile
|
||||
#
|
||||
|
||||
# Pull base image nodejs image.
|
||||
@ -54,12 +54,12 @@ RUN mkdir /usr/src/app
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
# Install app dependencies
|
||||
COPY ./LinkShortner/package*.json /usr/src/app/
|
||||
COPY ./LinkShortener/package*.json /usr/src/app/
|
||||
RUN npm install
|
||||
|
||||
|
||||
# Expose ports.
|
||||
# - 3088: OneUptime-LinkShortner
|
||||
# - 3088: OneUptime-LinkShortener
|
||||
EXPOSE 3521
|
||||
|
||||
{{ if eq .Env.ENVIRONMENT "development" }}
|
||||
@ -67,7 +67,7 @@ EXPOSE 3521
|
||||
CMD [ "npm", "run", "dev" ]
|
||||
{{ else }}
|
||||
# Copy app source
|
||||
COPY ./LinkShortner /usr/src/app
|
||||
COPY ./LinkShortener /usr/src/app
|
||||
# Bundle app source
|
||||
RUN npm run compile
|
||||
#Run the app
|
||||
|
@ -2,13 +2,13 @@ import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
|
||||
import App from 'CommonServer/Utils/StartServer';
|
||||
import { PostgresAppInstance } from 'CommonServer/Infrastructure/PostgresDatabase';
|
||||
import logger from 'CommonServer/Utils/Logger';
|
||||
import LinkShortnerAPI from './API/LinkShortner';
|
||||
import LinkShortenerAPI from './API/LinkShortener';
|
||||
|
||||
const APP_NAME: string = 'l';
|
||||
|
||||
const app: ExpressApplication = Express.getExpressApp();
|
||||
|
||||
app.use([`/${APP_NAME}/`, '/'], LinkShortnerAPI);
|
||||
app.use([`/${APP_NAME}/`, '/'], LinkShortenerAPI);
|
||||
|
||||
const init: Function = async (): Promise<void> => {
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "linkshortner",
|
||||
"name": "linkshortener",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
@ -19,8 +19,8 @@ upstream workflow {
|
||||
}
|
||||
|
||||
|
||||
upstream link-shortner {
|
||||
server link-shortner:3521 weight=10 max_fails=3 fail_timeout=30s;
|
||||
upstream link-shortener {
|
||||
server link-shortener:3521 weight=10 max_fails=3 fail_timeout=30s;
|
||||
}
|
||||
|
||||
|
||||
@ -319,7 +319,7 @@ server {
|
||||
client_max_body_size 50M;
|
||||
}
|
||||
|
||||
location /l { # Short URL for Link Shortner
|
||||
location /l { # Short URL for Link Shortener
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
@ -329,7 +329,7 @@ server {
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_pass http://link-shortner;
|
||||
proxy_pass http://link-shortener;
|
||||
|
||||
client_max_body_size 50M;
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ NOTIFICATION_HOSTNAME=notification:3191
|
||||
DASHBOARD_HOSTNAME=dashboard:3000
|
||||
DASHBOARD_API_HOSTNAME=dashboard-api:3002
|
||||
WORKFLOW_HOSTNAME=workflow:3099
|
||||
LINK_SHORTNER_HOSTNAME=link-shortner:3521
|
||||
LINK_SHORTENER_HOSTNAME=link-shortener:3521
|
||||
ALERT_HOSTNAME=alert:3088
|
||||
PROBE_API_HOSTNAME=probe-api:3400
|
||||
TEST_SERVER_HOSTNAME=test-server:3800
|
||||
@ -90,7 +90,7 @@ NOTIFICATION_ROUTE=/notification
|
||||
DASHBOARD_ROUTE=/dashboard
|
||||
DASHBOARD_API_ROUTE=/api
|
||||
WORKFLOW_ROUTE=/workflow
|
||||
LINK_SHORTNER_ROUTE=/l
|
||||
LINK_SHORTENER_ROUTE=/l
|
||||
ALERT_ROUTE=/alert
|
||||
TEST_SERVER_API_ROUTE=/test-server
|
||||
PROBE_API_ROUTE=/probe-api
|
||||
@ -107,7 +107,7 @@ STATUS_PAGE_ROUTE=/status-page
|
||||
DASHBOARD_API_PORT=3002
|
||||
API_DOCS_PORT=1445
|
||||
WORKFLOW_PORT=3099
|
||||
LINK_SHORTNER_PORT=3521
|
||||
LINK_SHORTENER_PORT=3521
|
||||
ALERT_PORT=3088
|
||||
PROBE_API_PORT=3400
|
||||
PROBE_PORT=3500
|
||||
|
@ -206,13 +206,13 @@ services:
|
||||
|
||||
|
||||
|
||||
link-shortner:
|
||||
link-shortener:
|
||||
networks:
|
||||
- oneuptime
|
||||
restart: always
|
||||
environment:
|
||||
<<: *common-server-variables
|
||||
PORT: ${LINK_SHORTNER_PORT}
|
||||
PORT: ${LINK_SHORTENER_PORT}
|
||||
depends_on:
|
||||
- redis
|
||||
- postgres
|
||||
|
@ -159,9 +159,9 @@ services:
|
||||
|
||||
|
||||
|
||||
link-shortner:
|
||||
link-shortener:
|
||||
volumes:
|
||||
- ./LinkShortner:/usr/src/app
|
||||
- ./LinkShortener:/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/
|
||||
@ -175,13 +175,13 @@ services:
|
||||
- /usr/src/Model/node_modules/
|
||||
extends:
|
||||
file: ./docker-compose.base.yml
|
||||
service: link-shortner
|
||||
service: link-shortener
|
||||
ports:
|
||||
- '9826:9229' # Debugging port.
|
||||
build:
|
||||
network: host
|
||||
context: .
|
||||
dockerfile: ./LinkShortner/Dockerfile
|
||||
dockerfile: ./LinkShortener/Dockerfile
|
||||
|
||||
|
||||
workflow:
|
||||
|
@ -64,11 +64,11 @@ services:
|
||||
|
||||
|
||||
|
||||
link-shortner:
|
||||
image: oneuptime/link-shortner:${APP_TAG}
|
||||
link-shortener:
|
||||
image: oneuptime/link-shortener:${APP_TAG}
|
||||
extends:
|
||||
file: ./docker-compose.base.yml
|
||||
service: link-shortner
|
||||
service: link-shortener
|
||||
|
||||
|
||||
workflow:
|
||||
|
@ -46,9 +46,9 @@ echo "Checking API Docs Server Status..."
|
||||
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/reference/status)" != "200" ]]; do sleep 5; done'
|
||||
echo "API Docs Server is up ✔️"
|
||||
|
||||
echo "Checking Link Shortner Status..."
|
||||
echo "Checking Link Shortener Status..."
|
||||
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/l/status)" != "200" ]]; do sleep 5; done'
|
||||
echo "Link Shortner Server is up ✔️"
|
||||
echo "Link Shortener Server is up ✔️"
|
||||
|
||||
echo "⌛️ OneUptime is up!"
|
||||
echo ""
|
||||
|
Loading…
Reference in New Issue
Block a user