From 3520e834eb582777686d0ebd38d07f678f3418c4 Mon Sep 17 00:00:00 2001 From: Carl Downing Date: Sat, 29 Jul 2023 16:03:00 -0700 Subject: [PATCH] shortner > shortener --- .github/workflows/compile.yml | 4 ++-- .github/workflows/docker-build.yml | 4 ++-- .github/workflows/release.yml | 10 +++++----- .vscode/launch.json | 4 ++-- CommonServer/Config.ts | 8 ++++---- CommonServer/Services/ShortLinkService.ts | 4 ++-- LinkShortner/Dockerfile.tpl | 8 ++++---- LinkShortner/Index.ts | 4 ++-- LinkShortner/package.json | 2 +- Nginx/default.conf.template | 8 ++++---- config.example.env | 6 +++--- docker-compose.base.yml | 4 ++-- docker-compose.dev.yml | 8 ++++---- docker-compose.yml | 6 +++--- status-check.sh | 4 ++-- 15 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index ddd883ac19..8ff6325055 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -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 diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index b5435636ea..f2e72959a1 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4c7189b5c9..67fa924d51 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.vscode/launch.json b/.vscode/launch.json index e57a1cc00c..620bd58b73 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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", diff --git a/CommonServer/Config.ts b/CommonServer/Config.ts index ae3bc560db..5fdcfb84a6 100644 --- a/CommonServer/Config.ts +++ b/CommonServer/Config.ts @@ -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( diff --git a/CommonServer/Services/ShortLinkService.ts b/CommonServer/Services/ShortLinkService.ts index 66fc3d1e54..1086a388b6 100644 --- a/CommonServer/Services/ShortLinkService.ts +++ b/CommonServer/Services/ShortLinkService.ts @@ -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 { @@ -31,7 +31,7 @@ export class Service extends DatabaseService { return new URL( HttpProtocol, Domain, - new Route(LinkShortnerRoute.toString()).addRoute( + new Route(LinkShortenerRoute.toString()).addRoute( '/' + model.shortId?.toString() ) ); diff --git a/LinkShortner/Dockerfile.tpl b/LinkShortner/Dockerfile.tpl index 599e7e9d5b..4e932c02cb 100644 --- a/LinkShortner/Dockerfile.tpl +++ b/LinkShortner/Dockerfile.tpl @@ -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 diff --git a/LinkShortner/Index.ts b/LinkShortner/Index.ts index 7bfd2c0f83..43f26be67c 100644 --- a/LinkShortner/Index.ts +++ b/LinkShortner/Index.ts @@ -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 => { try { diff --git a/LinkShortner/package.json b/LinkShortner/package.json index 6208b04a61..9fe7503085 100644 --- a/LinkShortner/package.json +++ b/LinkShortner/package.json @@ -1,5 +1,5 @@ { - "name": "linkshortner", + "name": "linkshortener", "version": "1.0.0", "description": "", "main": "index.js", diff --git a/Nginx/default.conf.template b/Nginx/default.conf.template index 0f6e386795..b26416c0a2 100644 --- a/Nginx/default.conf.template +++ b/Nginx/default.conf.template @@ -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; } diff --git a/config.example.env b/config.example.env index af9c656add..d0a02ed6b3 100644 --- a/config.example.env +++ b/config.example.env @@ -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 diff --git a/docker-compose.base.yml b/docker-compose.base.yml index e6b96c66a7..0e6defbde6 100644 --- a/docker-compose.base.yml +++ b/docker-compose.base.yml @@ -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 diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index d6f0891a65..479d3bad2b 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -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: diff --git a/docker-compose.yml b/docker-compose.yml index 935ea73849..80fe2cdbdc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: diff --git a/status-check.sh b/status-check.sh index a1b7ab5b48..30e6992b06 100644 --- a/status-check.sh +++ b/status-check.sh @@ -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 ""