You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dev_env/README.md
+71-19Lines changed: 71 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,66 +30,118 @@ This software encapsulates the deployment of the Unity Algorithm Development Ser
30
30
Deploys these Unity ADS services:
31
31
32
32
* Development Environment
33
-
* Jupyterlab
34
-
* Shared Storage
35
-
* EC2 Support Instance
33
+
* EFS Shared Storage
34
+
* Jupyterhub
35
+
* EC2 Support Instance (optional)
36
36
37
37
38
38
## Development Environment
39
39
40
40
For each deployment instance (ie. development, test, production) define the following environment variables to customize the install to the environment. For example for the test deployment you would defined the following variables:
The `unity_instance` variable should match the string used in the Unity instance's VPC name as this variable is used to look up the VPC. The `cognito_base_url` can be found from the "App Integration" tab of the user pool's information screen through the AWS web interface. The `s3_identifier` variable must match the instance string inserted into the names of the instance's Cumulus S3 buckets.
50
+
The `unity_instance` variable should match the string used in the Unity instance's VPC name as this variable is used to look up the VPC. The `s3_identifier` variable must match the instance string inserted into the names of the instance's Cumulus S3 buckets. The `efs_identifider` variable is used to create the EFS shared storage resource.
50
51
51
52
Each of the following Development Environment components need to be intialized individually by changing into their respective directory and running Terraform there. The Development Enviroment base directory under the repository is `dev_env/`.
52
53
53
-
### Shared Storage
54
+
The steps below assume that the above environment variables have already been defined.
55
+
56
+
### EFS Shared Storage
54
57
55
-
Shared storage must be installed prior to initalizing Jupterlab. The Terraform scripts in this directory create an EFS server for Jupyterlab intended to host files common to all users. These scripts are seperated out from the Jupyterlab installation scripts to enable removing and rebuilding the Jupyterlab instance without deleting the EFS stored files.
58
+
Shared storage must be installed prior to initalizing Jupterlab. The Terraform scripts in this directory create an EFS server for Jupyterhub intended to host files common to all users. These scripts are seperated out from the Jupyterhub installation scripts to enable removing and rebuilding the Jupyterhubz instance without deleting the EFS stored files.
56
59
57
60
1. Change to the `dev_env/shared_storage` directory
58
61
2. Run `terraform init`
59
62
3. Run `terraform apply`
60
63
61
-
### Jupyterlab
64
+
### Cognito Initial Setup
62
65
63
-
Jupyterlab must be installed after the EFS shared storage Terraform scripts have run. These scripts require the creation of a private key that will be used set up self signed certificates in the Application Load Balancer.
66
+
The connection of the Juptyterhub instance to the Unity Cognito Authentication requires running commands from the `cognito` directory twice.
The initial set up will generate a Cognito application client along with the client id and secret necessary for feeding into the Jupyterhub deployment.
69
+
70
+
1. Change to the `dev_env/cognito` directory
71
+
2. Run `terraform init`
72
+
3. Run `terraform apply`
73
+
74
+
Once Terraform has finished succesfully run the following to bring the Cognito id and secret into environment variables required in the next step.
75
+
76
+
```
77
+
$ eval $(./cognito_config_envs.sh)
78
+
```
79
+
80
+
Run the following to verify that the environment variables were succesfully set up:
81
+
82
+
```
83
+
$ env | grep TF_VAR_cogn
84
+
```
85
+
86
+
Note that the Cognito resource could exist in a seperate venue from the Jupyterhub instance.
69
87
70
-
These scripts set up an EKS cluster. To access the cluster you must first initialize your `~/.kube/config` configuration file by running the following command:
88
+
### Jupyterhub
89
+
90
+
Jupyterhub must be installed after the EFS shared storage Terraform scripts and Cognito initial step have been run.
91
+
92
+
1. Change to the `dev_env/jupyterhub` directory
93
+
2. Run `terraform init`
94
+
3. Run `terraform apply`
95
+
96
+
For the above steps it is recommended to keep the `KUBE_CONFIG_PATH` environment variable unset, or else the EKS system within Terraform might get confused by trying to access a non-existent cluster if this is the first time this particular cluster has been set up and you have multiple clusters listed in your Kubernetes config file.
97
+
98
+
Two useful variables are output from the Terraform execution:
99
+
100
+
* jupyter\_base\_uri - The URL used to log into the Jupyterhub cluster
101
+
* eks_cluster_name - The name of the generated EKS cluster
102
+
* kube_namespace - The namespace used with `kubectl` for investigating the EKS cluster
103
+
104
+
But after successfully running the Terraform script for this directory for the first time, for subsequent runs to update changes to the Terraform scripts you must define the `KUBE_CONFIG_PATH` environment variable:
Run the `update_kube_config.sh` script to use the generated EKS cluster name from Terraform to create a new entry in the Kubernetes config file to allow use of the kubectl command for querying the cluster.
111
+
76
112
Now you can query the status of the cluster nodes as follows:
77
113
78
114
```
79
-
$ kubectl --namespace=jhub-${TF_VAR_tenant_identifier} get pods
115
+
$ kubectl --namespace=$kube_namespace get pods
80
116
```
81
117
82
118
The status for all pods should be ``Running``. If not query to log from the
Where `${pod_id}` comes from the output of the `get pods` command.
124
+
Where `$pod_id` comes from the output of the `get pods` command.
125
+
126
+
### Cognito Final Setup
127
+
128
+
Change back to the `cognito` directory to run the following sequence to publish the Jupyterhub callback URL to Cognito:
129
+
130
+
```
131
+
$ eval $(./jupyter_uri_env.sh)
132
+
$ env | grep TF_VAR_jupyter_base_url
133
+
$ terraform apply
134
+
```
135
+
136
+
Now that the `TF_VAR_jupyter_base_url` variable has been defined the Terraform process will update the Cogntio client to allow connection from the Jupyterhub instance.
137
+
138
+
### Test Jupyterhub
139
+
140
+
Now to test Jupyterhub installation by navigating to the URL from the `jupyter_base_uri` output from the `jupyterhub` directory.
89
141
90
142
### EC2 Support Instance
91
143
92
-
The Support EC2 instance is used to manage the EFS shared storage. It must be installed after the EFS shared storage Terraform scripts have run. These scripts require the creation of a private key that will be used for logging into the instance.
144
+
The Support EC2 instance can optionally be used to manage the EFS shared storage. It must be installed after the EFS shared storage Terraform scripts have run. These scripts require the creation of a private key that will be used for logging into the instance.
93
145
94
146
1. Change to the `dev_env/support_instance` directory
0 commit comments