Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AB#47250] Use hosting-v3 for canary environment #390

Open
wants to merge 4 commits into
base: canary-73
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG PACKAGE_ROOT
ARG PACKAGE_BUILD_COMMAND

# BASE
FROM node:18-buster-slim AS base
FROM node:18.18-buster-slim AS base
WORKDIR /checkout

ARG PACKAGE_ROOT
Expand All @@ -30,7 +30,7 @@ RUN mkdir -p "$PACKAGE_ROOT/node_modules"
RUN if [ ! -d /checkout/$PACKAGE_ROOT/migrations ]; then mkdir -p /checkout/$PACKAGE_ROOT/migrations; fi

# RELEASE
FROM node:18-buster-slim
FROM node:18.18-buster-slim

ARG PACKAGE_ROOT
ARG PACKAGE_BUILD_COMMAND
Expand Down
37 changes: 37 additions & 0 deletions HOSTING_V3_DEPLOYMENT_INSTRUCTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Steps

Run the following commands on the root of the monorepo

## Notes

- Update the root .env to refer to the Canary Environment
- The env-var values can be found inside the BW Entry
`TEST - Canary Environment Root Variables`
- Change the value of the repository name (i.e. `emperorrxf/media-service`) to
the corresponding value in all the commands written below.
- After running the `docker build` & `docker push` commands for each service,
change the root package.json's `@axinom/mosaic-cli` version to the latest
version available (i.e. `"@axinom/mosaic-cli": "0.39.0"`) and run
`yarn install`
- The docker build commands need the older version
- The Mosaic CLI commands used to deploy the service need the newer version :)
- Then use the `yarn quick-deploy` script from the root package to deploy the
three services by providing the tag `canary-image` manually

## Media Service

- `docker build -t emperorrxf/media-service:canary-image --build-arg PACKAGE_ROOT=services/catalog/service --build-arg PACKAGE_BUILD_COMMAND=build:catalog-service:prod --platform linux/amd64 .`

- `docker push emperorrxf/media-service:canary-image`

## Catalog Service

- `docker build -t emperorrxf/catalog-service:canary-image --build-arg PACKAGE_ROOT=services/catalog/service --build-arg PACKAGE_BUILD_COMMAND=build:catalog-service:prod --platform linux/amd64 .`

- `docker push emperorrxf/catalog-service:canary-image`

## Entitlement Service

- `docker build -t emperorrxf/entitlement-service:canary-image --build-arg PACKAGE_ROOT=services/entitlement/service --build-arg PACKAGE_BUILD_COMMAND=build:entitlement-service:prod --platform linux/amd64 .`

- `docker push emperorrxf/entitlement-service:canary-image`
63 changes: 42 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,31 +207,52 @@ workflow.

## Deploying the services via Mosaic Hosting Service

### Pre-requisites for deploying any service
If you're looking for a quick way to deploy a service in the Axinom Cloud, we
offer a `Quick Deploy` interactive script in the root package.

1. Ensure you've configured the Container Registry for your environment in the
Admin Portal under Hosting Service (the following steps assumes `Docker Hub`
as the Container Registry provider for simplicity).
2. For each service you wish to host in Axinom, ensure you've created a
`Customized Service` entity via the Admin Portal, and that the correct
repository name has been set as expected.
3. Ensure you've run `yarn setup:hosting` from the root of the
mosaic-media-template. This will setup the required service-account for using
the Mosaic CLI commands shown below with the correct permissions.

NOTE: `yarn util:load-vars` is used in the below commands to load values for
certain CLI arguments from the `.env` file. If required, the CLI arguments can
also be directly provided as necessary (i.e. when used in a CI
environment/agent).

NOTE: The final deployment step (i.e. the `mosaic hosting service deploy` step)
can also be performed via the Admin Portal under Hosting Service.
If you're looking to deploy your customized service in the Axinom Cloud using
your CI/CD pipelines, we recommend the `Advanced Deploy` option that uses the
`Mosaic CLI` where you can control the deployment steps with more precision via
the supplied arguments.

A detailed guide on how to deploy services via Mosaic Hosting Service can be
found at
https://portal.axinom.com/mosaic/documentation/deploy-a-customized-service-with-hosting-service

### Deploying Media Service
### Quick Deploy

1. Ensure you've configured the `Container Registry` for your environment in the
Admin Portal under `Hosting Service`.
2. Ensure you've run `yarn setup:hosting` from the root of the
mosaic-media-template. This will setup the required service-account for the
quick-deploy script.
3. From the root of the mosaic-media-template, run `yarn quick-deploy` and
follow the on-screen instructions.

### Advanced Deploy (using the Mosaic CLI)

The following sections list the individual steps needed to `Build` & `Deploy`
the customizable services from your CI/CD pipelines.

Note that the following pre-requisites are assumed:

1. You've configured the `Container Registry` for your environment in the Admin
Portal under `Hosting Service`.
2. For each service you wish to host in the Axinom Cloud, you've created a
`Customized Service` entity via the Admin Portal, and that the correct
repository name has been set as expected.
3. You've run `yarn setup:hosting` from the root of the mosaic-media-template.
This will setup the required service-account for using the Mosaic CLI
commands shown below with the correct permissions.

NOTE: `yarn util:load-vars` is used in the below commands to load values for
certain CLI arguments from the `.env` file. If required, the CLI arguments
can also be directly provided as necessary.

NOTE: The final deployment step (i.e. the `mosaic hosting service deploy`
step) can also be performed via the Admin Portal under Hosting Service.

#### Deploy Media Service

1. Build the service using the provided Dockerfile
- CLI Command
Expand Down Expand Up @@ -267,7 +288,7 @@ https://portal.axinom.com/mosaic/documentation/deploy-a-customized-service-with-
`yarn util:load-vars mosaic hosting service deploy -i media-service -t 20230927.1 -p [email protected] -m media-service-manifest-20230927 -n media-service-deployment-20230927.1`
- Ensure you provide a unique value for the deployment name

### Deploying Catalog Service
#### Deploy Catalog Service

1. Build the service using the provided Dockerfile
- CLI Command
Expand Down Expand Up @@ -296,7 +317,7 @@ https://portal.axinom.com/mosaic/documentation/deploy-a-customized-service-with-
`yarn util:load-vars mosaic hosting service deploy -i catalog-service -t 20230927.1 -m catalog-service-manifest-20230927 -n catalog-service-deployment-20230927.1`
- Ensure you provide a unique value for the deployment name

### Deploying Entitlement Service
#### Deploy Entitlement Service

1. Build the service using the provided Dockerfile
- CLI Command
Expand Down
7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build": "wsrun -tm build",
"clean": "wsrun -tm clean",
"reset": "rimraf **/node_modules && yarn",
"quick-deploy": "yarn util:load-vars ts-node ./scripts/quick-deploy-service.ts",
"lint": "eslint \"{services,libs}/**/src/**/*.{ts,tsx,js}\" --fix",
"dev:libs": "wsrun -p '*-messages' -c dev",
"dev:services": "wsrun -p '*-service' -c dev",
Expand Down Expand Up @@ -51,12 +52,15 @@
"@libre/atom": "^1.3.3",
"@types/jest": "^29",
"@types/node": "^18.11.18",
"@types/prompts": "^2.4.4",
"@types/rimraf": "^3.0.2",
"@types/semver": "^7.3.13",
"@types/url-join": "^4.0.1",
"@types/yargs": "^16.0.4",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"axios": "^0.24.0",
"chalk": "^4.1.2",
"cross-env": "^7.0.3",
"dotenv": "^8.6.0",
"env-cmd": "^10.1.0",
Expand All @@ -68,6 +72,8 @@
"eslint-plugin-react": "^7.31.8",
"eslint-plugin-react-hooks": "^4.6.0",
"glob": "^8.1.0",
"graphql": "^15.4.0",
"graphql-tag": "^2.12.6",
"history": "^4.10.1",
"http-proxy": "^1.18.1",
"jest": "^29",
Expand All @@ -78,6 +84,7 @@
"piral-cli-webpack5": "^0.15.8",
"prettier": "^2.7.1",
"prettier-plugin-organize-imports": "^3.1.1",
"prompts": "^2.4.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router": "^5.3.4",
Expand Down
Loading