Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Reorganize the repository #11

Merged
merged 16 commits into from
Aug 1, 2024
Merged
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/agile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Story/Task/Issue
description: Create a new story or task
body:
- type: textarea
id: definition_of_done
attributes:
label: Definition of Done / Acceptance Criteria
description: What can someone see/do when this task is done.
placeholder: >-
The export data is available in the xxx format, including age of the
patient at the time of imaging...
validations:
required: true
- type: textarea
id: testing
attributes:
label: Testing
description: Specific testing considerations for this task to be done
placeholder: Passed integration testing that uses the correct modality...
validations:
required: false
- type: textarea
id: documentation
attributes:
label: Documentation
description: Documentation to be completed along with this task
placeholder: Update README and user guide...
validations:
required: false
- type: textarea
id: dependencies
attributes:
label: Dependencies
description: >-
Enter the github issue number(s) that the requirement is dependent on,
in the form `#1`
placeholder: "#1"
validations:
required: false
- type: textarea
id: comments
attributes:
label: Comments
description: Any other considerations or comments
placeholder: More details or other comments...
validations:
required: false
4 changes: 3 additions & 1 deletion .github/workflows/terraform-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ jobs:
- name: Render terraform docs and push changes back to PR
uses: terraform-docs/[email protected]
with:
working-dir: .
working-dir: ./terraform
recursive: true
recursive-path: modules
output-file: README.md
output-method: inject
template: |-
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
defaults:
run:
shell: bash
working-directory: ./terraform

steps:
# Checkout the repository to the GitHub Actions runner
Expand Down
67 changes: 1 addition & 66 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1 @@
# SSRC Jupyter Instance

![SSRC-Jupyter diagram](docs/ssrc-jupyter.drawio.svg)

## Usage

1. Populate the `public_key_openssh` and `KUBECONFIG` variables
2. Deploy the Terraform module
3. Wait for `cloud-init` to finish configuring k3s on the VM
4. Log into the VM and become root
5. Fill out the `jupyterhub_config.yaml` file with data from a
suitable AzureAD app registration
6. Run the `install_jupyterhub.sh` script

## References

- [K3s](https://docs.k3s.io/installation)
- [Zero to JupyterHub](https://z2jh.jupyter.org/en/stable/)

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.8.5 |
| <a name="requirement_harvester"></a> [harvester](#requirement\_harvester) | 0.6.4 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_harvester"></a> [harvester](#provider\_harvester) | 0.6.4 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [harvester_cloudinit_secret.cloud-config-jupyter](https://registry.terraform.io/providers/harvester/harvester/0.6.4/docs/resources/cloudinit_secret) | resource |
| [harvester_virtualmachine.vm](https://registry.terraform.io/providers/harvester/harvester/0.6.4/docs/resources/virtualmachine) | resource |
| [harvester_image.rhel9](https://registry.terraform.io/providers/harvester/harvester/0.6.4/docs/data-sources/image) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Name of the SSRC namespace | `string` | `"ssrc-ns"` | no |
| <a name="input_network_name"></a> [network\_name](#input\_network\_name) | Name of the SSRC network | `string` | `"ssrc-net"` | no |
| <a name="input_os_disk_gb"></a> [os\_disk\_gb](#input\_os\_disk\_gb) | Size of the VM's primary disk | `string` | `"50Gi"` | no |
| <a name="input_public_key_openssh"></a> [public\_key\_openssh](#input\_public\_key\_openssh) | Public SSH key installed on the VM | `string` | n/a | yes |
| <a name="input_ram_gb"></a> [ram\_gb](#input\_ram\_gb) | Amount of memory for the VM | `string` | `"8Gi"` | no |
| <a name="input_vcpu"></a> [vcpu](#input\_vcpu) | Number of CPUs for the VM | `number` | `2` | no |
| <a name="input_vm_count"></a> [vm\_count](#input\_vm\_count) | Number of instances of the VM | `number` | `1` | no |
| <a name="input_vm_prefix"></a> [vm\_prefix](#input\_vm\_prefix) | Prefix applied to the VM | `string` | `"ssrc-jupyter"` | no |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_access_url"></a> [access\_url](#output\_access\_url) | The URL from which Jupyter can be accessed |

---
<!-- END_TF_DOCS -->
# ssrc-jupyter
53 changes: 53 additions & 0 deletions terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# ssrc-jupyter

![SSRC-Jupyter diagram](../docs/ssrc-jupyter.drawio.svg)

## Usage

1. Populate the `public_key_openssh` and `KUBECONFIG` variables
2. Deploy the Terraform module
3. Wait for `cloud-init` to finish configuring k3s on the VM
4. Log into the VM and become root
5. Fill out the `jupyterhub_config.yaml` file with data from a
suitable AzureAD app registration
6. Run the `install_jupyterhub.sh` script

## References

- [K3s](https://docs.k3s.io/installation)
- [Zero to JupyterHub](https://z2jh.jupyter.org/en/stable/)

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | 1.8.5 |
| <a name="requirement_harvester"></a> [harvester](#requirement\_harvester) | 0.6.4 |

## Providers

No providers.

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_ssrc-jupyter-dept"></a> [ssrc-jupyter-dept](#module\_ssrc-jupyter-dept) | ./modules/jupyter | n/a |

## Resources

No resources.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_public_key_openssh"></a> [public\_key\_openssh](#input\_public\_key\_openssh) | Public SSH key installed on the VM | `list(string)` | n/a | yes |

## Outputs

No outputs.

---
<!-- END_TF_DOCS -->
16 changes: 16 additions & 0 deletions terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module "ssrc-jupyter-dept" {
source = "./modules/jupyter"

vm_count = 1

vcpu = 4
ram_gb = "16Gi"
os_disk_gb = "50Gi"

vm_prefix = "ssrc-jupyter-dept"

namespace = "ssrc-ns"
network_name = "ssrc-net"

public_key_openssh = var.public_key_openssh
}
49 changes: 49 additions & 0 deletions terraform/modules/jupyter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# jupyter

<!-- BEGIN_TF_DOCS -->
## Requirements

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | 1.8.5 |
| <a name="requirement_harvester"></a> [harvester](#requirement\_harvester) | 0.6.4 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_harvester"></a> [harvester](#provider\_harvester) | 0.6.4 |

## Modules

No modules.

## Resources

| Name | Type |
|------|------|
| [harvester_cloudinit_secret.cloud-config-jupyter](https://registry.terraform.io/providers/harvester/harvester/0.6.4/docs/resources/cloudinit_secret) | resource |
| [harvester_virtualmachine.vm](https://registry.terraform.io/providers/harvester/harvester/0.6.4/docs/resources/virtualmachine) | resource |
| [harvester_image.rhel9](https://registry.terraform.io/providers/harvester/harvester/0.6.4/docs/data-sources/image) | data source |

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Name of the SSRC namespace | `string` | n/a | yes |
| <a name="input_network_name"></a> [network\_name](#input\_network\_name) | Name of the SSRC network | `string` | n/a | yes |
| <a name="input_os_disk_gb"></a> [os\_disk\_gb](#input\_os\_disk\_gb) | Size of the VM's primary disk | `string` | n/a | yes |
| <a name="input_public_key_openssh"></a> [public\_key\_openssh](#input\_public\_key\_openssh) | Public SSH key installed on the VM | `list(string)` | n/a | yes |
| <a name="input_ram_gb"></a> [ram\_gb](#input\_ram\_gb) | Amount of memory for the VM | `string` | n/a | yes |
| <a name="input_vcpu"></a> [vcpu](#input\_vcpu) | Number of CPUs for the VM | `number` | n/a | yes |
| <a name="input_vm_count"></a> [vm\_count](#input\_vm\_count) | Number of instances of the VM | `number` | n/a | yes |
| <a name="input_vm_prefix"></a> [vm\_prefix](#input\_vm\_prefix) | Prefix applied to the server resources | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| <a name="output_access_url"></a> [access\_url](#output\_access\_url) | The URL from which Jupyter can be accessed |

---
<!-- END_TF_DOCS -->
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,6 @@ runcmd:
- bash /tmp/install_k3s.sh

ssh_authorized_keys:
- ${public_key_openssh}
%{ for key in public_key_openssh ~}
- ${key}
%{ endfor ~}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
47 changes: 20 additions & 27 deletions variables.tf → terraform/modules/jupyter/variables.tf
Original file line number Diff line number Diff line change
@@ -1,46 +1,39 @@
variable "namespace" {
type = string
default = "ssrc-ns"
description = "Name of the SSRC namespace"
variable "vm_count" {
type = number
description = "Number of instances of the VM"
}

variable "network_name" {
variable "vcpu" {
type = number
description = "Number of CPUs for the VM"
}

variable "ram_gb" {
type = string
default = "ssrc-net"
description = "Name of the SSRC network"
description = "Amount of memory for the VM"
}

variable "os_disk_gb" {
type = string
default = "50Gi"
description = "Size of the VM's primary disk"
}

variable "public_key_openssh" {
variable "vm_prefix" {
type = string
description = "Public SSH key installed on the VM"
description = "Prefix applied to the server resources"
}

variable "ram_gb" {
variable "namespace" {
type = string
default = "16Gi"
description = "Amount of memory for the VM"
}

variable "vcpu" {
type = number
default = 4
description = "Number of CPUs for the VM"
description = "Name of the SSRC namespace"
}

variable "vm_count" {
type = number
default = 1
description = "Number of instances of the VM"
variable "network_name" {
type = string
description = "Name of the SSRC network"
}

variable "vm_prefix" {
type = string
default = "ssrc-jupyter"
description = "Prefix applied to the VM"
variable "public_key_openssh" {
type = list(string)
description = "Public SSH key installed on the VM"
}
6 changes: 3 additions & 3 deletions versions.tf → terraform/modules/jupyter/versions.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Enforce minimum Terraform and provider version numbers.
terraform {
required_providers {

required_version = "1.8.5"

required_providers {
harvester = {
source = "harvester/harvester"
version = "0.6.4"
}
}

required_version = ">= 1.8.5"
}
Empty file added terraform/output.tf
Empty file.
1 change: 1 addition & 0 deletions terraform/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
provider "harvester" {}
4 changes: 4 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
variable "public_key_openssh" {
type = list(string)
description = "Public SSH key installed on the VM"
}
12 changes: 12 additions & 0 deletions terraform/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
terraform {

required_version = "1.8.5"

required_providers {
harvester = {
source = "harvester/harvester"
version = "0.6.4"
}
}

}
Loading