Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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


  1. Create Nginx Catalog Recipe
  2. 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.

  1. Create a new recipe from Dashboard Nginx Recipe
    1. Give it a new name
    2. Change the port configuration
      1. Change the values named published of both http and https ports
        1. Reference Link: Catalog Recipes#nginxRecipe 
      2. Configure the environment variables


Code Block
languagejs
titleFull Demo Dev Nginx Sample with full env list
linenumberstrue
collapsetrue
{
	"_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"
				},
				"SOAJS_NX_DOMAIN": {
					"type": "computed",
					"value": "$SOAJS_NX_DOMAIN"
				},
				"SOAJS_NX_API_DOMAIN": {
					"type": "computed",
					"value": "$SOAJS_NX_API_DOMAIN"
				},
				"SOAJS_PETSTORE_DOMAIN": {
					"type": "computed",
					"value": "$SOAJS_NX_SITE_DOMAIN"
				},
				"SOAJS_NX_CONTROLLER_NB": {
					"type": "computed",
					"value": "$SOAJS_NX_CONTROLLER_NB"
				},
				"SOAJS_NX_CONTROLLER_IP": {
					"type": "computed",
					"value": "$SOAJS_NX_CONTROLLER_IP_N"
				},
				"SOAJS_NX_CONTROLLER_PORT": {
					"type": "computed",
					"value": "$SOAJS_NX_CONTROLLER_PORT"
				},
				"SOAJS_DEPLOY_HA": {
					"type": "computed",
					"value": "$SOAJS_DEPLOY_HA"
				},
				"SOAJS_HA_NAME": {
					"type": "computed",
					"value": "$SOAJS_HA_NAME"
				},
				"SOAJS_GIT_REPO": {
					"type": "userInput",
					"default": "soajs.petstore.ui",
					"label": "Git Repo"
				},
				"SOAJS_GIT_OWNER": {
					"type": "userInput",
					"default": "SOAJS-Demos",
					"label": "Git Repo"
				},
				"SOAJS_GIT_BRANCH": {
					"type": "userInput",
					"default": "master",
					"label": "Git Branch"
				},
				"SOAJS_GIT_PATH": {
					"type": "userInput",
					"default": "/widget",
					"label": "Git Path"
				},
				"SOAJS_CONFIG_REPO_PROVIDER": {
					"type": "static",
					"value": "github"
				},
				"SOAJS_CONFIG_REPO_DOMAIN": {
					"type": "static",
					"value": "github.com"
				},
				"SOAJS_CONFIG_REPO_OWNER": {
					"type": "static",
					"value": "SOAJS-Demos"
				},
				"SOAJS_CONFIG_REPO_BRANCH": {
					"type": "static",
					"value": "master"
				},
				"SOAJS_CONFIG_REPO_NAME": {
					"type": "static",
					"value": "soajs.petstore.config"
				}
			},
			"cmd": {
				"deploy": {
					"command": [
						"bash",
						"-c"
					],
					"args": [
						"node index.js -T nginx"
					]
				}
			}
		}
	}
}




Step 2


  1. Go to Deploy → High Availability
  2. Click on Deploy environment
    1. for the Nginx section, pick the recipe you created
  3. Fill the rest of the form inputs
  4. Submit

Your environment will deploy in a few minutes where the Nginx is configured to use the recipe you created last.