Deploying Nx Private Cloud to AWS

You can easily deploy your Nx Private Cloud instance to AWS.

Using ECS

First, create a container configuration using the following image: nxprivatecloud/nxcloud:latest

Second, set up a mount point.

1"mountPoints": [
2  {
3    "readOnly": null,
4    "containerPath": "/data",
5    "sourceVolume": "data"
6  }
7],

Third, configure the following env variables:

1"environment": [
2  {
3    "name": "ADMIN_PASSWORD",
4    "value": "admin-password"
5  },
6  {
7    "name": "GITHUB_API_URL",
8    "value": "https://api.github.com"
9  },
10  {
11    "name": "GITHUB_AUTH_TOKEN",
12    "value": "your-github-auth-token"
13  },
14  {
15    "name": "GITHUB_WEBHOOK_SECRET",
16    "value": "your-github-webhook-secret"
17  },
18  {
19    "name": "NX_CLOUD_APP_URL",
20    "value": "url-accessible-from-ci-and-dev-machines"
21  },
22  {
23    "name": "NX_CLOUD_MODE",
24    "value": "private-community"
25  }
26]

All env variables prefixed with GITHUB are required for the Nx Cloud GitHub integration. If you don't use GitHub, you don't need to set them.

To test that everything works, open NX_CLOUD_APP_URL in the browser and log in using the username "admin" and the password provisioned above.

For reference, here is an example complete task definition:

1{
2  "ipcMode": null,
3  "executionRoleArn": null,
4  "containerDefinitions": [
5    {
6      "dnsSearchDomains": null,
7      "environmentFiles": null,
8      "logConfiguration": {
9        "logDriver": "awslogs",
10        "secretOptions": null,
11        "options": {
12          "awslogs-group": "/ecs/DeployCloud",
13          "awslogs-region": "us-east-1",
14          "awslogs-stream-prefix": "ecs"
15        }
16      },
17      "entryPoint": null,
18      "portMappings": [
19        {
20          "hostPort": 8081,
21          "protocol": "tcp",
22          "containerPort": 8081
23        }
24      ],
25      "command": null,
26      "linuxParameters": null,
27      "cpu": 0,
28      "environment": [
29        {
30          "name": "ADMIN_PASSWORD",
31          "value": "admin-password"
32        },
33        {
34          "name": "GITHUB_API_URL",
35          "value": "https://api.github.com"
36        },
37        {
38          "name": "GITHUB_AUTH_TOKEN",
39          "value": "your-github-auth-token"
40        },
41        {
42          "name": "GITHUB_WEBHOOK_SECRET",
43          "value": "your-github-webhoook-secret"
44        },
45        {
46          "name": "NX_CLOUD_APP_URL",
47          "value": "url-accessible-from-ci-and-dev-machines"
48        },
49        {
50          "name": "NX_CLOUD_MODE",
51          "value": "private-community"
52        }
53      ],
54      "resourceRequirements": null,
55      "ulimits": null,
56      "dnsServers": null,
57      "mountPoints": [
58        {
59          "readOnly": null,
60          "containerPath": "/data",
61          "sourceVolume": "data"
62        }
63      ],
64      "workingDirectory": null,
65      "secrets": null,
66      "dockerSecurityOptions": null,
67      "memory": 2000,
68      "memoryReservation": null,
69      "volumesFrom": [],
70      "stopTimeout": null,
71      "image": "nxprivatecloud/nxcloud:latest",
72      "startTimeout": null,
73      "firelensConfiguration": null,
74      "dependsOn": null,
75      "disableNetworking": null,
76      "interactive": null,
77      "healthCheck": null,
78      "essential": true,
79      "links": null,
80      "hostname": null,
81      "extraHosts": null,
82      "pseudoTerminal": null,
83      "user": null,
84      "readonlyRootFilesystem": null,
85      "dockerLabels": null,
86      "systemControls": null,
87      "privileged": null,
88      "name": "PrivateCloud"
89    }
90  ],
91  "placementConstraints": [],
92  "memory": null,
93  "taskRoleArn": null,
94  "compatibilities": ["EC2"],
95  "taskDefinitionArn": "your-task-definition-arn",
96  "family": "deploy-nx-cloud",
97  "requiresAttributes": [
98    {
99      "targetId": null,
100      "targetType": null,
101      "value": null,
102      "name": "com.amazonaws.ecs.capability.logging-driver.awslogs"
103    },
104    {
105      "targetId": null,
106      "targetType": null,
107      "value": null,
108      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19"
109    },
110    {
111      "targetId": null,
112      "targetType": null,
113      "value": null,
114      "name": "ecs.capability.docker-plugin.local"
115    },
116    {
117      "targetId": null,
118      "targetType": null,
119      "value": null,
120      "name": "com.amazonaws.ecs.capability.docker-remote-api.1.25"
121    }
122  ],
123  "pidMode": null,
124  "requiresCompatibilities": ["EC2"],
125  "networkMode": null,
126  "cpu": null,
127  "status": "ACTIVE",
128  "inferenceAccelerators": null,
129  "proxyConfiguration": null,
130  "volumes": [
131    {
132      "fsxWindowsFileServerVolumeConfiguration": null,
133      "efsVolumeConfiguration": null,
134      "name": "data",
135      "host": null,
136      "dockerVolumeConfiguration": {
137        "autoprovision": true,
138        "labels": null,
139        "scope": "shared",
140        "driver": "local",
141        "driverOpts": null
142      }
143    }
144  ]
145}

When using this configuration, the metadata and file artifacts are stored in the /data volume.

Using S3

If you want to use S3 for storing and delivering cached artifacts, add the following env variables:

1"environment": [
2  {
3    "name": "AWS_S3_ACCESS_KEY_ID",
4    "value": "your-access-key-id"
5  },
6  {
7    "name": "AWS_S3_SECRET_ACCESS_KEY",
8    "value": "your-secret-access-key"
9  },
10  {
11    "name": "AWS_S3_BUCKET",
12    "value": "your-backet-name"
13  }
14]

Using this configuration, the metadata will be stored on the volume and the file artifacts will be stored using S3.

We highly recommend using S3 for large workspaces.