From 6084384383438ad70c903c8721090a17837c9c3a Mon Sep 17 00:00:00 2001 From: Daljit Singh Date: Wed, 13 Jan 2021 17:53:42 +1300 Subject: [PATCH] Completed install docker section. --- 2-configure-gcp-project.sh | 2 +- 3-create-virtual-machine.sh | 2 +- 4-install-docker.sh | 13 +++++++++++++ README.org | 12 +++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 4-install-docker.sh diff --git a/2-configure-gcp-project.sh b/2-configure-gcp-project.sh index 332706f..e3d40db 100755 --- a/2-configure-gcp-project.sh +++ b/2-configure-gcp-project.sh @@ -11,7 +11,7 @@ # #+NAME: Create a new google cloud project # Create a project id based on date -export gcp_project_id="gitlab-gcp-"$(date +"%Y-%m-%d") +export gcp_project_id="gitlab-gcp-"$(date +"%s") # Create new project using a random project id gcloud projects create $gcp_project_id diff --git a/3-create-virtual-machine.sh b/3-create-virtual-machine.sh index 1026dbc..399c7a6 100755 --- a/3-create-virtual-machine.sh +++ b/3-create-virtual-machine.sh @@ -11,7 +11,7 @@ gcloud services enable compute.googleapis.com # Create name for virtual machine based on date -export gcp_machine_name="gitlab-gcp-"$(date +"%Y-%m-%d") +export gcp_machine_name="gitlab-gcp-"$(date +"%s") # Create the new machine gcloud compute instances create $gcp_machine_name --zone australia-southeast1-a diff --git a/4-install-docker.sh b/4-install-docker.sh new file mode 100755 index 0000000..05bed30 --- /dev/null +++ b/4-install-docker.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# Step 3 - Install docker on virtual machine + +# Next up we need to install [[https://docker.com][Docker]] on the newly created virtual machine so that we can then deploy Gitlab as a container. + +# By default the virtual machine operating system for the vm we created on GCP is [[https://debian.org][Debian]]. There are instructions for installing Docker on a debian machine [[https://docs.docker.com/engine/install/debian/#install-using-the-repository][here]]. + + +# Retrieve the vm name + export gcp_machine_name=$(gcloud compute instances list --limit=1 --format='value(name.basename())') + +# Connect to the machine using ssh +gcloud compute ssh $gcp_machine_name --ssh-key-file ~/.ssh/$USER -- "curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh" diff --git a/README.org b/README.org index 698a223..c58e7d8 100644 --- a/README.org +++ b/README.org @@ -89,8 +89,18 @@ gcloud compute instances create $gcp_machine_name --zone australia-southeast1-a * Step 3 - Install docker on virtual machine -Coming soon... +Next up we need to install [[https://docker.com][Docker]] on the newly created virtual machine so that we can then deploy Gitlab as a container. +By default the virtual machine operating system for the vm we created on GCP is [[https://debian.org][Debian]]. There are instructions for installing Docker on a debian machine [[https://docs.docker.com/engine/install/debian/#install-using-the-repository][here]]. + +#+begin_src bash :shebang #!/bin/bash :tangle 4-install-docker.sh + # Retrieve the vm name + export gcp_machine_name=$(gcloud compute instances list --limit=1 --format='value(name.basename())') + + # Connect to the machine using ssh + gcloud compute ssh $gcp_machine_name --ssh-key-file ~/.ssh/$USER -- "curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh" + +#+end_src * Step 4 - Install gitlab via docker