Objective
You are about to deploy a new environment that contains an nginx. The Nginx default port is 80 and is already allocated by the Dashboard Nginx in the Dashboard Environment. Learn how to create a new Catalog Recipe and use it when you deploy an Nginx in a new environment.
Steps
- Create Nginx Catalog Recipe
- Deploy Nginx
Step 1
Go to Module Develop → Catalog Recipes, you will find that the installer already created a recipe named Dashboard Nginx Recipe. The catalog recipes modules provides the ability to create new entries from other recipes.
- Create a new recipe from Dashboard Nginx Recipe
- Give it a new name
- Change the port configuration
- Change the values named published of both http and https ports
- Reference Link: Catalog Recipes#nginxRecipe
- Configure the environment variables
- Change the values named published of both http and https ports
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{ "_id": '5919bf91645d410044f137a1', "name": "Dev Nginx Recipe", "type": "nginx", "description": "This is the nginx catalog recipe used to deploy the nginx in the dev environment.", "recipe": { "deployOptions": { "image": { "prefix": "soajsorg", "name": "nginx", "tag": "latest", "pullPolicy": "Always" }, "readinessProbe": { "httpGet": { "path": "/", "port": "http" }, "initialDelaySeconds": 5, "timeoutSeconds": 2, "periodSeconds": 5, "successThreshold": 1, "failureThreshold": 3 }, "restartPolicy": { "condition": "", "maxAttempts": 0 }, "container": { "network": "", "workingDir": "" }, "voluming": { "volumes": [{ "Type": "volume", "Source": "soajs_log_volume", "Target": "/var/log/soajs/" }] }, "ports": [{ "name": "http", "target": 80, "isPublished": true, "published": 81 //port 80 is exposed as 81 }, { "name": "https", "target": 443, "isPublished": true, "published": 444 //port 443 is exposed as 444 } ] }, "buildOptions": { "env": { "SOAJS_ENV": { "type": "computed", "value": "$SOAJS_ENV" }, //domain of the environment "SOAJS_NX_DOMAIN": { "type": "computed", "value": "$SOAJS_NX_DOMAIN" }, //domain of the DEV API in nginx "SOAJS_NX_API_DOMAIN": { "type": "computed", "value": "$SOAJS_NX_API_DOMAIN" }, //domain of the DEV UI frontend widget in nginx //domain is mapped to custom env variable (petstore) "SOAJS_PETSTORE_DOMAIN": { "type": "computed", "value": "$SOAJS_NX_SITE_DOMAIN" }, //number of controllers the nginx should upstream to "SOAJS_NX_CONTROLLER_NB": { "type": "computed", "value": "$SOAJS_NX_CONTROLLER_NB" }, //IP values of the controllers the nginx should upstream to "SOAJS_NX_CONTROLLER_IP": { "type": "computed", "value": "$SOAJS_NX_CONTROLLER_IP_N" }, //Port values of the controllers the nginx should upstream to "SOAJS_NX_CONTROLLER_PORT": { "type": "computed", "value": "$SOAJS_NX_CONTROLLER_PORT" }, //the HA deployment mode based on drivers: swarm - kubernetes "SOAJS_DEPLOY_HA": { "type": "computed", "value": "$SOAJS_DEPLOY_HA" }, //the HA deployment name based on drivers: swarm - kubernetes "SOAJS_HA_NAME": { "type": "computed", "value": "$SOAJS_HA_NAME" }, //Git repo name containing the custom UI code of the frontend widget "SOAJS_GIT_REPO": { "type": "userInput", "default": "soajs.petstore.ui", "label": "Git Repo" }, //Git repo owner that owns the custom ui repo "SOAJS_GIT_OWNER": { "type": "userInput", "default": "SOAJS-Demos", "label": "Git Repo" }, //Git repo branch of ui repo to pull the code from "SOAJS_GIT_BRANCH": { "type": "userInput", "default": "master", "label": "Git Branch" }, //Git repo path of ui repo in branch (default: "/" ) "SOAJS_GIT_PATH": { "type": "userInput", "default": "/widget", "label": "Git Path" }, //Custom Git repo for advanced Nginx configuration //this repo contains advanced configuration that tells the SOAJS deployer in nginx image to create a virtual host //for the petstore ui and map the nginx ui widget domain to env variable SOAJS_PETSTORE_DOMAIN ( see above ) //in addition the nginx configuration file of this host is custom since it provides clean URL rules for nginx and angular js //Provider of custom git repo "SOAJS_CONFIG_REPO_PROVIDER": { "type": "static", "value": "github" }, //Domain of custom git repo "SOAJS_CONFIG_REPO_DOMAIN": { "type": "static", "value": "github.com" }, //owner of custom git repo "SOAJS_CONFIG_REPO_OWNER": { "type": "static", "value": "SOAJS-Demos" }, //branch of custom git repo "SOAJS_CONFIG_REPO_BRANCH": { "type": "static", "value": "master" }, //name of custom git repo "SOAJS_CONFIG_REPO_NAME": { "type": "static", "value": "soajs.petstore.config" } }, "cmd": { "deploy": { "command": [ "bash", "-c" ], "args": [ "node index.js -T nginx" ] } } } } } |
Step 2
- Go to Deploy → High Availability - Cloud
- Click on Deploy environment
- for the Nginx section, pick the recipe you created
- Fill the rest of the form inputs
- Submit
Your environment will deploy in a few minutes where the Nginx is configured to use the recipe you created last.