From a3ae312467cfd3cce153bf31582886d9bd3add76 Mon Sep 17 00:00:00 2001 From: Dean Ruina <81315494+DeRuina@users.noreply.github.com> Date: Mon, 15 Jul 2024 08:51:12 +0300 Subject: [PATCH 1/7] Import from Git (Private Repositories) UPDATE Added documentation for Import from Git (Private Repositories) using Web GUI and CLI --- docs/cloud/rahti2/images/creating.md | 120 +++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/docs/cloud/rahti2/images/creating.md b/docs/cloud/rahti2/images/creating.md index e19f5e19fd..ef98d4b783 100644 --- a/docs/cloud/rahti2/images/creating.md +++ b/docs/cloud/rahti2/images/creating.md @@ -175,6 +175,126 @@ It is also possible to create a build from a given `Dockerfile`: cat Dockerfile | oc new-build -D - ``` +### Import from Git (Private Repositories) using the Web GUI + +Deploying a private Git repository to Rahti involves setting up the necessary authentication to access your private repository. Without proper authentication, you will see the error "URL is valid but cannot be reached" (seen in the pictures below). Here's how to resolve this using two authentication methods: + +#### Option 1: Using a Token for Git Authentication + +1. **Generate a Personal Access Token:** + + - **GitHub:** + - Go to your GitHub account settings. + - Navigate to "Developer settings" > "Personal access tokens". + - Click on "Generate new token". + - Select the scopes you need (typically, you'll need `repo` scope for private repositories). + - Generate the token and copy it. + + - **GitLab:** + - Go to your GitLab profile settings. + - Navigate to "Access Tokens". + - Give your token a name, select the required scopes (e.g., `api`, `read_repository`), and create the token. + - Copy the token. + +2. **Add the Token to Rahti:** + - Under "Source Secret" choose "Create new Secret" + - Name the secret, under "Authentication type" choose "Basic Authentication" + - Paste the token and create + +#### Option 2: Using a Private SSH Key for Git Authentication + +1. **Generate an SSH Key Pair (if you don't have one already):** + + - Open a terminal and run the following command to generate a new SSH key pair: + ```sh + ssh-keygen -t rsa -b 4096 -C "your_email@example.com" + ``` + - This will create two files: a private key (`id_rsa`) and a public key (`id_rsa.pub`). + +2. **Add Your Public Key to Your Git Hosting Service:** + + - **GitHub:** + - Go to your GitHub account settings. + - Navigate to "SSH and GPG keys". + - Click "New SSH key" and paste the contents of your `id_rsa.pub` file. + + - **GitLab:** + - Go to your GitLab profile settings. + - Navigate to "SSH Keys". + - Add a new SSH key and paste the contents of your `id_rsa.pub` file. + +3. **Add the Private SSH Key to Rahti:** + - Under "Source Secret" choose "Create new Secret" + - Name the secret, under "Authentication type" choose "SSH Key" + - Paste the contents of your private SSH key (`id_rsa`) and create + +![025a0cf1-2bdb-477e-bce0-9fe77f43b432](https://github.com/user-attachments/assets/2ea0dac4-de5d-4d6a-8853-9ffcbc3dcdc0) + +![fd4c203a-f8e3-4994-b1a4-9a2b4960d4be](https://github.com/user-attachments/assets/ea238069-de97-470f-bb86-03980456eb3a) + +![434bf283-c7f5-49d1-8f58-72480f084ce2](https://github.com/user-attachments/assets/1c17a62b-f3b6-404d-8568-24e05e00c1c4) + +### Import from Git (Private Repositories) using the CLI + +This assumes that the users has generated SSH keys and registered their public key with GitHub. + +#### Create and Configure OpenShift Project + +**Log into OpenShift CLI (`oc`)**: + ```bash + oc login + ``` + +**Create a New Project**: + ```bash + oc new-project + ``` + +**Create SSH Key Secret**: + ```bash + oc create secret generic --from-file=ssh-privatekey= --type=kubernetes.io/ssh-auth + ``` + +**Link the Secret to the Builder Service Account**: + ```bash + oc secrets link builder + ``` + + +#### Deploy and monitor the Application + +**Deploy the Application**: + ```bash + oc new-app --name= + ``` + +**Monitor the Build**: + - monitor logs + ```bash + oc logs -f buildconfig.build.openshift.io/ + ``` + - The initial build will probably fail due to authentication issues, set the build secret explicitly: + ```bash + oc set build-secret --source bc/ + ``` + - Trigger a new build: + ```bash + oc start-build --follow + ``` + +#### Expose and Access the Application + +1. **Expose the Application**: + ```bash + oc expose deployment --name= --port= --target-port= + oc expose svc/ + ``` + +2. **Access the Application**: +- Use the URL provided by: + ```bash + oc get route + ``` ## Troubleshooting From 4132106de94f6bcd8922bbbe0b6a35a6473af319 Mon Sep 17 00:00:00 2001 From: Dean Ruina <81315494+DeRuina@users.noreply.github.com> Date: Mon, 15 Jul 2024 09:16:46 +0300 Subject: [PATCH 2/7] Import from Git (private repositories) using Web GUI and CLI UPDATE Import from Git (private repositories) using Web GUI and CLI UPDATE --- docs/cloud/rahti2/images/creating.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/cloud/rahti2/images/creating.md b/docs/cloud/rahti2/images/creating.md index ef98d4b783..8505290dae 100644 --- a/docs/cloud/rahti2/images/creating.md +++ b/docs/cloud/rahti2/images/creating.md @@ -238,7 +238,6 @@ Deploying a private Git repository to Rahti involves setting up the necessary au This assumes that the users has generated SSH keys and registered their public key with GitHub. -#### Create and Configure OpenShift Project **Log into OpenShift CLI (`oc`)**: ```bash @@ -261,8 +260,6 @@ This assumes that the users has generated SSH keys and registered their public k ``` -#### Deploy and monitor the Application - **Deploy the Application**: ```bash oc new-app --name= @@ -282,15 +279,12 @@ This assumes that the users has generated SSH keys and registered their public k oc start-build --follow ``` -#### Expose and Access the Application - -1. **Expose the Application**: +**Expose the Application**: ```bash oc expose deployment --name= --port= --target-port= oc expose svc/ ``` - -2. **Access the Application**: +**Access the Application**: - Use the URL provided by: ```bash oc get route From 96d452ccfeab88a5641beed1ae09388e392c1085 Mon Sep 17 00:00:00 2001 From: Dean Ruina <81315494+DeRuina@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:50:33 +0300 Subject: [PATCH 3/7] Update creating.md --- docs/cloud/rahti2/images/creating.md | 139 ++++++++++++++------------- 1 file changed, 70 insertions(+), 69 deletions(-) diff --git a/docs/cloud/rahti2/images/creating.md b/docs/cloud/rahti2/images/creating.md index 8505290dae..e1495ad931 100644 --- a/docs/cloud/rahti2/images/creating.md +++ b/docs/cloud/rahti2/images/creating.md @@ -179,58 +179,59 @@ cat Dockerfile | oc new-build -D - Deploying a private Git repository to Rahti involves setting up the necessary authentication to access your private repository. Without proper authentication, you will see the error "URL is valid but cannot be reached" (seen in the pictures below). Here's how to resolve this using two authentication methods: + +![025a0cf1-2bdb-477e-bce0-9fe77f43b432](https://github.com/user-attachments/assets/2ea0dac4-de5d-4d6a-8853-9ffcbc3dcdc0) + #### Option 1: Using a Token for Git Authentication 1. **Generate a Personal Access Token:** - - **GitHub:** - - Go to your GitHub account settings. - - Navigate to "Developer settings" > "Personal access tokens". - - Click on "Generate new token". - - Select the scopes you need (typically, you'll need `repo` scope for private repositories). - - Generate the token and copy it. - - - **GitLab:** - - Go to your GitLab profile settings. - - Navigate to "Access Tokens". - - Give your token a name, select the required scopes (e.g., `api`, `read_repository`), and create the token. - - Copy the token. - -2. **Add the Token to Rahti:** - - Under "Source Secret" choose "Create new Secret" - - Name the secret, under "Authentication type" choose "Basic Authentication" - - Paste the token and create + - **GitHub:** + - Go to your GitHub account settings. + - Navigate to "Developer settings" > "Personal access tokens". + - Click on "Generate new token". + - Select the scopes you need (typically, you'll need `repo` scope for private repositories). + - Generate the token and copy it. + + - **GitLab:** + - Go to your GitLab profile settings. + - Navigate to "Access Tokens". + - Give your token a name, select the required scopes (e.g., `api`, `read_repository`), and create the token. + - Copy the token. + +3. **Add the Token to Rahti:** + - Under "Source Secret" choose "Create new Secret" + - Name the secret, under "Authentication type" choose "Basic Authentication" + - Paste the token and create + +![fd4c203a-f8e3-4994-b1a4-9a2b4960d4be](https://github.com/user-attachments/assets/ea238069-de97-470f-bb86-03980456eb3a) #### Option 2: Using a Private SSH Key for Git Authentication 1. **Generate an SSH Key Pair (if you don't have one already):** - - Open a terminal and run the following command to generate a new SSH key pair: - ```sh - ssh-keygen -t rsa -b 4096 -C "your_email@example.com" - ``` - - This will create two files: a private key (`id_rsa`) and a public key (`id_rsa.pub`). + - Open a terminal and run the following command to generate a new SSH key pair: + ```sh + ssh-keygen -t rsa -b 4096 -C "your_email@example.com" + ``` + - This will create two files: a private key (`id_rsa`) and a public key (`id_rsa.pub`). 2. **Add Your Public Key to Your Git Hosting Service:** - - **GitHub:** - - Go to your GitHub account settings. - - Navigate to "SSH and GPG keys". - - Click "New SSH key" and paste the contents of your `id_rsa.pub` file. - - - **GitLab:** - - Go to your GitLab profile settings. - - Navigate to "SSH Keys". - - Add a new SSH key and paste the contents of your `id_rsa.pub` file. - -3. **Add the Private SSH Key to Rahti:** - - Under "Source Secret" choose "Create new Secret" - - Name the secret, under "Authentication type" choose "SSH Key" - - Paste the contents of your private SSH key (`id_rsa`) and create + - **GitHub:** + - Go to your GitHub account settings. + - Navigate to "SSH and GPG keys". + - Click "New SSH key" and paste the contents of your `id_rsa.pub` file. -![025a0cf1-2bdb-477e-bce0-9fe77f43b432](https://github.com/user-attachments/assets/2ea0dac4-de5d-4d6a-8853-9ffcbc3dcdc0) + - **GitLab:** + - Go to your GitLab profile settings. + - Navigate to "SSH Keys". + - Add a new SSH key and paste the contents of your `id_rsa.pub` file. -![fd4c203a-f8e3-4994-b1a4-9a2b4960d4be](https://github.com/user-attachments/assets/ea238069-de97-470f-bb86-03980456eb3a) +4. **Add the Private SSH Key to Rahti:** + - Under "Source Secret" choose "Create new Secret" + - Name the secret, under "Authentication type" choose "SSH Key" + - Paste the contents of your private SSH key (`id_rsa`) and create ![434bf283-c7f5-49d1-8f58-72480f084ce2](https://github.com/user-attachments/assets/1c17a62b-f3b6-404d-8568-24e05e00c1c4) @@ -239,25 +240,25 @@ Deploying a private Git repository to Rahti involves setting up the necessary au This assumes that the users has generated SSH keys and registered their public key with GitHub. -**Log into OpenShift CLI (`oc`)**: - ```bash - oc login - ``` +**[Log into OpenShift CLI (`oc`)](https://docs.csc.fi/cloud/rahti2/usage/cli/#how-to-login-with-oc)**: + ```bash + oc login + ``` -**Create a New Project**: - ```bash - oc new-project - ``` +**[Create a New Project](https://docs.csc.fi/cloud/rahti2/usage/projects_and_quota/#creating-a-project)**: + ```bash + oc new-project --display-name= --description="csc_project:" + ``` **Create SSH Key Secret**: - ```bash - oc create secret generic --from-file=ssh-privatekey= --type=kubernetes.io/ssh-auth - ``` + ```bash + oc create secret generic --from-file=ssh-privatekey= --type=kubernetes.io/ssh-auth + ``` **Link the Secret to the Builder Service Account**: - ```bash - oc secrets link builder - ``` + ```bash + oc secrets link builder + ``` **Deploy the Application**: @@ -266,26 +267,26 @@ This assumes that the users has generated SSH keys and registered their public k ``` **Monitor the Build**: - - monitor logs - ```bash - oc logs -f buildconfig.build.openshift.io/ - ``` - - The initial build will probably fail due to authentication issues, set the build secret explicitly: - ```bash - oc set build-secret --source bc/ - ``` - - Trigger a new build: - ```bash - oc start-build --follow - ``` + - monitor logs + ```bash + oc logs -f buildconfig.build.openshift.io/ + ``` + - The initial build will probably fail due to authentication issues, set the build secret explicitly: + ```bash + oc set build-secret --source bc/ + ``` + - Trigger a new build: + ```bash + oc start-build --follow + ``` **Expose the Application**: - ```bash - oc expose deployment --name= --port= --target-port= - oc expose svc/ - ``` + ```bash + oc expose deployment --name= --port= --target-port= + oc expose svc/ + ``` **Access the Application**: -- Use the URL provided by: + - Use the URL provided by: ```bash oc get route ``` From 5bcff4c7e5dd31beafccb12aa90d181ae5140590 Mon Sep 17 00:00:00 2001 From: Dean Ruina <81315494+DeRuina@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:35:23 +0300 Subject: [PATCH 4/7] Update creating.md --- docs/cloud/rahti2/images/creating.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cloud/rahti2/images/creating.md b/docs/cloud/rahti2/images/creating.md index e1495ad931..c81b222f4c 100644 --- a/docs/cloud/rahti2/images/creating.md +++ b/docs/cloud/rahti2/images/creating.md @@ -240,12 +240,12 @@ Deploying a private Git repository to Rahti involves setting up the necessary au This assumes that the users has generated SSH keys and registered their public key with GitHub. -**[Log into OpenShift CLI (`oc`)](https://docs.csc.fi/cloud/rahti2/usage/cli/#how-to-login-with-oc)**: +**[Log into OpenShift CLI (`oc`)](../rahti2/usage/cli.md#how-to-login-with-oc)**: ```bash oc login ``` -**[Create a New Project](https://docs.csc.fi/cloud/rahti2/usage/projects_and_quota/#creating-a-project)**: +**[Create a New Project](usage/projects_and_quota.md#creating-a-project)**: ```bash oc new-project --display-name= --description="csc_project:" ``` From a1d56267748cf375e9bd4a4547b883bd59a53078 Mon Sep 17 00:00:00 2001 From: Dean Ruina <81315494+DeRuina@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:41:37 +0300 Subject: [PATCH 5/7] Update creating.md --- docs/cloud/rahti2/images/creating.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/cloud/rahti2/images/creating.md b/docs/cloud/rahti2/images/creating.md index c81b222f4c..aa6887f2fe 100644 --- a/docs/cloud/rahti2/images/creating.md +++ b/docs/cloud/rahti2/images/creating.md @@ -240,7 +240,7 @@ Deploying a private Git repository to Rahti involves setting up the necessary au This assumes that the users has generated SSH keys and registered their public key with GitHub. -**[Log into OpenShift CLI (`oc`)](../rahti2/usage/cli.md#how-to-login-with-oc)**: +**[Log into OpenShift CLI (`oc`)](/usage/cli.md#how-to-login-with-oc)**: ```bash oc login ``` From 75421b2d9592f9a3f04933b84cae15736faea6ae Mon Sep 17 00:00:00 2001 From: Dean Ruina <81315494+DeRuina@users.noreply.github.com> Date: Mon, 15 Jul 2024 15:46:02 +0300 Subject: [PATCH 6/7] Update creating.md --- docs/cloud/rahti2/images/creating.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/cloud/rahti2/images/creating.md b/docs/cloud/rahti2/images/creating.md index aa6887f2fe..c29862a937 100644 --- a/docs/cloud/rahti2/images/creating.md +++ b/docs/cloud/rahti2/images/creating.md @@ -240,12 +240,12 @@ Deploying a private Git repository to Rahti involves setting up the necessary au This assumes that the users has generated SSH keys and registered their public key with GitHub. -**[Log into OpenShift CLI (`oc`)](/usage/cli.md#how-to-login-with-oc)**: +**[Log into OpenShift CLI (`oc`)](../usage/cli.md#how-to-login-with-oc)**: ```bash oc login ``` -**[Create a New Project](usage/projects_and_quota.md#creating-a-project)**: +**[Create a New Project](../usage/projects_and_quota.md#creating-a-project)**: ```bash oc new-project --display-name= --description="csc_project:" ``` From 345ed47341e0b9c5e07574b698be876579fb3f00 Mon Sep 17 00:00:00 2001 From: Dean Ruina <81315494+DeRuina@users.noreply.github.com> Date: Tue, 16 Jul 2024 08:32:12 +0300 Subject: [PATCH 7/7] Import From Git UPDATE --- docs/cloud/rahti2/images/creating.md | 84 ++++++++++++++++------------ 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/docs/cloud/rahti2/images/creating.md b/docs/cloud/rahti2/images/creating.md index c29862a937..d9877fdb15 100644 --- a/docs/cloud/rahti2/images/creating.md +++ b/docs/cloud/rahti2/images/creating.md @@ -180,7 +180,8 @@ cat Dockerfile | oc new-build -D - Deploying a private Git repository to Rahti involves setting up the necessary authentication to access your private repository. Without proper authentication, you will see the error "URL is valid but cannot be reached" (seen in the pictures below). Here's how to resolve this using two authentication methods: -![025a0cf1-2bdb-477e-bce0-9fe77f43b432](https://github.com/user-attachments/assets/2ea0dac4-de5d-4d6a-8853-9ffcbc3dcdc0) +![oie_1671443U3OLpFT1](https://github.com/user-attachments/assets/a844e224-769e-4d9f-bba2-043ad5c9b258) + #### Option 1: Using a Token for Git Authentication @@ -204,7 +205,8 @@ Deploying a private Git repository to Rahti involves setting up the necessary au - Name the secret, under "Authentication type" choose "Basic Authentication" - Paste the token and create -![fd4c203a-f8e3-4994-b1a4-9a2b4960d4be](https://github.com/user-attachments/assets/ea238069-de97-470f-bb86-03980456eb3a) +![oie_1672121lETtYQ6J](https://github.com/user-attachments/assets/4bd9450f-170b-4a9e-ae8c-df4700fb0be4) + #### Option 2: Using a Private SSH Key for Git Authentication @@ -232,8 +234,9 @@ Deploying a private Git repository to Rahti involves setting up the necessary au - Under "Source Secret" choose "Create new Secret" - Name the secret, under "Authentication type" choose "SSH Key" - Paste the contents of your private SSH key (`id_rsa`) and create + - +![oie_16720584BbbOspb](https://github.com/user-attachments/assets/b1d47511-0ce6-4980-a732-895193895780) -![434bf283-c7f5-49d1-8f58-72480f084ce2](https://github.com/user-attachments/assets/1c17a62b-f3b6-404d-8568-24e05e00c1c4) ### Import from Git (Private Repositories) using the CLI @@ -241,52 +244,63 @@ This assumes that the users has generated SSH keys and registered their public k **[Log into OpenShift CLI (`oc`)](../usage/cli.md#how-to-login-with-oc)**: - ```bash - oc login - ``` + +```bash +oc login +``` **[Create a New Project](../usage/projects_and_quota.md#creating-a-project)**: - ```bash - oc new-project --display-name= --description="csc_project:" - ``` + +```bash +oc new-project --display-name= --description="csc_project:" +``` **Create SSH Key Secret**: - ```bash - oc create secret generic --from-file=ssh-privatekey= --type=kubernetes.io/ssh-auth - ``` + +```bash +oc create secret generic --from-file=ssh-privatekey= --type=kubernetes.io/ssh-auth +``` **Link the Secret to the Builder Service Account**: - ```bash - oc secrets link builder - ``` + +```bash +oc secrets link builder +``` **Deploy the Application**: - ```bash - oc new-app --name= - ``` + +```bash +oc new-app --name= +``` **Monitor the Build**: - - monitor logs - ```bash - oc logs -f buildconfig.build.openshift.io/ - ``` - - The initial build will probably fail due to authentication issues, set the build secret explicitly: - ```bash - oc set build-secret --source bc/ - ``` - - Trigger a new build: - ```bash - oc start-build --follow - ``` + +- monitor logs + ```bash + oc logs -f buildconfig.build.openshift.io/ + ``` + +- The initial build will probably fail due to authentication issues, set the build secret explicitly: + ```bash + oc set build-secret --source bc/ + ``` + +- Trigger a new build: + ```bash + oc start-build --follow + ``` **Expose the Application**: - ```bash - oc expose deployment --name= --port= --target-port= - oc expose svc/ - ``` + +```bash +oc expose deployment --name= --port= --target-port= +oc expose svc/ +``` + **Access the Application**: - - Use the URL provided by: + +- Use the URL provided by: ```bash oc get route ```