From 0794f19f944f83ff7409fc28572cb104f8102393 Mon Sep 17 00:00:00 2001 From: Daljit Singh Date: Mon, 8 Feb 2021 16:40:38 +1300 Subject: [PATCH] Step 5 added to install gitlab via composer --- 5-install-gitlab-via-composer.sh | 15 +++++++++++++++ README.org | 22 ++++++++++++++++++---- docker-compose.yaml | 8 ++++---- 3 files changed, 37 insertions(+), 8 deletions(-) create mode 100755 5-install-gitlab-via-composer.sh diff --git a/5-install-gitlab-via-composer.sh b/5-install-gitlab-via-composer.sh new file mode 100755 index 0000000..9b45d88 --- /dev/null +++ b/5-install-gitlab-via-composer.sh @@ -0,0 +1,15 @@ +#!/bin/bash + + +# Next up we need to copy file to gloud vm + + +# Retrieve the vm name +export gcp_machine_name=$(gcloud compute instances list --limit=1 --format='value(name.basename())') + +# Copy file to vm +gloud compute scp docker-compose.yaml $gcp_machine_name --ssh-key-file ~/.ssh/$USER --strict-host-key-checking=no + +# Install gotlan with docker compose +sleep 2 +gcloud compute ssh $gcp_machine_name --ssh-key-file ~/.ssh/$USER -- 'sudo docker compose up -d' diff --git a/README.org b/README.org index 1b071aa..8abb3c9 100644 --- a/README.org +++ b/README.org @@ -78,6 +78,7 @@ name: projects/gitlab-gcp-1611720361/billingInfo projectId: gitlab-gcp-1611720361 #+end_src + * Step 3 - Create vertual machine Once we have a project we can create a new virtual machine. To create a virtual machine we need to ensure compute engine apis are enabled. @@ -122,17 +123,17 @@ Next step to create docker compose file for gitlab #+begin_src yaml :tangle docker-compose.yaml web: - image: 'gitlab/gitlab-ee:latest' + image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | - external_url 'https://gitlab.example.com' + external_url 'https://gitlab.example.com:3200' # Add any other gitlab.rb configuration here, each on its own line ports: - - '80:80' + - '3200:3200' - '443:443' - - '22:22' + - '2222:22' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab' @@ -140,6 +141,19 @@ Next step to create docker compose file for gitlab #+end_src +Next up we need to copy file to gloud vm + +#+begin_src bash :shebang #!/bin/bash :tangle 5-install-gitlab-via-composer.sh +# Retrieve the vm name +export gcp_machine_name=$(gcloud compute instances list --limit=1 --format='value(name.basename())') + +# Copy file to vm +gloud compute scp docker-compose.yaml $gcp_machine_name --ssh-key-file ~/.ssh/$USER --strict-host-key-checking=no + +# Install gotlan with docker compose +sleep 2 +gcloud compute ssh $gcp_machine_name --ssh-key-file ~/.ssh/$USER -- 'sudo docker compose up -d' +#+end_src * Step 6 - Teardown cloud resources diff --git a/docker-compose.yaml b/docker-compose.yaml index 49100db..c8a29d5 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,17 +4,17 @@ web: - image: 'gitlab/gitlab-ee:latest' + image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | - external_url 'https://gitlab.example.com' + external_url 'https://gitlab.example.com:3200' # Add any other gitlab.rb configuration here, each on its own line ports: - - '80:80' + - '3200:3200' - '443:443' - - '22:22' + - '2222:22' volumes: - '$GITLAB_HOME/config:/etc/gitlab' - '$GITLAB_HOME/logs:/var/log/gitlab'