Newer
Older

Krish Moodbidri
committed
# Project Documentation

Krish Moodbidri
committed
This project involves the following stages:

Krish Moodbidri
committed
---

Krish Moodbidri
committed
## 1. Creating an OpenStack Account

Krish Moodbidri
committed
To access our cloud infrastructure, follow these steps:

Krish Moodbidri
committed
1. Ensure you are connected to the UAB Campus Network or VPN.
2. Visit [cloud.rc.uab.edu](https://cloud.rc.uab.edu) to verify access.
3. Contact the team to request an account if you don’t have one.

Krish Moodbidri
committed
---

Krish Moodbidri
committed
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## 2. Deploying an Ad-hoc Cluster
### Prerequisite
- **Bright (now Nvidia) cluster key:** A Bright cluster key is required. As of Nov 1, 2024, creating new accounts on Bright's platform is restricted. A limited supply of keys is available.
### Steps to Deploy:
1. Clone the repository:
```bash
git clone git@gitlab.rc.uab.edu:rc/cod-heat-stack.git
cd cod-heat-stack
```
2. Set up a virtual environment and install dependencies:
```bash
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
3. Update the following variables in `group_vars/all`:
- `ssh_key`: Public SSH key.
- `product_key`: Bright Easy8 product key.
- `password`: Plain text password.
4. Deploy the cluster:
```bash
ansible-playbook main.yaml -v
```
5. Verify deployment:
```bash
openstack stack list
```
### Access the Master Node:
1. Retrieve the floating IP:
```bash
COD_HEAD_IP=$(openstack stack output show <your-stack-name> head_a_floating_ip -f value -c output_value)
```
2. SSH into the head node:
```bash
ssh root@$COD_HEAD_IP
```
### Additional Steps:
- For OpenOnDemand, login nodes, and compute nodes, refer to the `/CRI_XCBC` directory on the master node and run the respective playbooks.
### Cluster Deletion:
To delete a cluster:
```bash
openstack stack delete -y --wait <your-stack-name>

Krish Moodbidri
committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
## 3. Setting Up a GitLab Runner
GitLab Runners are agents that execute jobs defined in `.gitlab-ci.yml`.
### Types of Runners:
- **Shared:** Available to all projects on the instance.
- **Group:** Available to projects within a group.
- **Project:** Specific to a project.
### Steps to Set Up:
1. **Create an Access Token:**
- Navigate to `Settings -> Access Tokens` in GitLab.
- Specify a name, expiration date, role (`Owner`), and scope (`create_runner`).
- Save the token securely, as it will only be shown once.
2. **Register a Runner:**
Use the appropriate command for your use case:
- **Group Runner:**
```bash
curl -sX POST https://<GITLAB_URL>/api/v4/user/runners \
--data runner_type=<RUNNER_TYPE> \
--data "group_id=<target_group_id>" \
--data "description=gitlab-ci-runner" \
--data "tag_list=<your comma-separated tags>" \
--header "PRIVATE-TOKEN: <your_access_token>"
```
- **Project Runner:**
```bash
curl -sX POST https://<GITLAB_URL>/api/v4/user/runners \
--data runner_type=<RUNNER_TYPE> \
--data "project_id=<target_project_id>" \
--data "description=gitlab-ci-runner" \
--data "tag_list=<your comma-separated tags>" \
--header "PRIVATE-TOKEN: <your_access_token>"
```

Krish Moodbidri
committed
- **Shared Runner:**
```bash
curl -sX POST https://<GITLAB_URL>/api/v4/user/runners \
--data runner_type=<RUNNER_TYPE> \
--data "group_id=<target_group_or_project_id>" \
--data "description=shared-runner" \
--data "tag_list=<your comma-separated tags>" \
--header "PRIVATE-TOKEN: <your_access_token>"
```

Krish Moodbidri
committed
### Notes:

Krish Moodbidri
committed
- The runner status will display as `Never contacted` until the actual runner is configured.
- Save the `token` value returned by the API for later use.

Krish Moodbidri
committed
---

Krish Moodbidri
committed
## 4. Building and Deploying Proxy Nodes

Krish Moodbidri
committed
### Prerequisites:

Krish Moodbidri
committed
- **Docker Desktop:** Ensure Docker is installed and running.
- **GitLab Access:** You should have credentials for GitLab. If using two-factor authentication (2FA), use a personal access token instead of a password.

Krish Moodbidri
committed
### Steps:

Krish Moodbidri
committed
1. **Authenticate to the GitLab Container Registry:**
```bash
docker login gitlab.rc.uab.edu:4567
```

Krish Moodbidri
committed
If you use 2FA, replace your password with a personal access token.

Krish Moodbidri
committed
2. **Download or Pull an Image (Optional):**
```bash
docker pull <image_name>:<tag>
```

Krish Moodbidri
committed
Replace `<image_name>` and `<tag>` with the actual image name and tag you need.

Krish Moodbidri
committed
3. **Tag the Image for GitLab Registry:**
```bash
docker tag <local_image_name>:<tag> gitlab.rc.uab.edu:4567/<your_gitlab_namespace>/<project_name>:<tag>
```

Krish Moodbidri
committed
Replace:
- `<local_image_name>` and `<tag>` with the local image name and tag.
- `<your_gitlab_namespace>/<project_name>` with your actual GitLab project path.

Krish Moodbidri
committed
4. **Push the Image to GitLab’s Container Registry:**
```bash
docker push gitlab.rc.uab.edu:4567/<your_gitlab_namespace>/<project_name>:<tag>
```
### Set Up GitLab Environment as the Final Step
To finalize your GitLab environment setup:
1. Go to the **Operate** tab in your GitLab project.
2. Create the desired environment (e.g., `build`, `dev`, or `production`).
3. Assign and configure environment-specific variables as per your requirements.
4. Trigger the pipeline and call the appropriate environment (`build` or `dev`) as needed based on pipeline job requirements.

Krish Moodbidri
committed
### Deployment Pipeline:

Krish Moodbidri
committed
You can now schedule a pipeline to build and deploy proxy nodes. Use the same process for additional proxy nodes, such as HTTP proxies.

Krish Moodbidri
committed
---

Krish Moodbidri
committed
## Screenshots

Krish Moodbidri
committed
## Deploy and Build Pipeline for SSH Proxy Node

Krish Moodbidri
committed
### Build Pipeline Example
Below is a screenshot showing the build pipeline for the SSH proxy node:

Krish Moodbidri
committed


Krish Moodbidri
committed
### Deploy Pipeline Example
Below is a screenshot showing the deploy pipeline for the SSH proxy node:

Krish Moodbidri
committed


Krish Moodbidri
committed
---
## Troubleshooting
1. **Environment Variables Not Working:**
- Check if the variables are correctly scoped to the environment.
- Validate the variable values in the **Settings > CI/CD > Variables** section.