This content originally appeared on DEV Community and was authored by ADITYA OKKE SUGIARSO
Setup git on gcp
Set up personal SSH keys on Linux
Use Git cmd to manage repo
Install docker so we can use docker compose
Create SSL certificate
GCP IP Address
Setup git on gcp
To install Git on Ubuntu, follow these steps:
Update the package index:
sudo apt update
Install Git:
sudo apt install git
Verify the installation:
git --version
You should see the installed Git version.
Set up personal SSH keys on Linux
To clone a repo on bitbucket, you need to set up personal SSH keys
- Install OpenSSH on your device.
- Start the SSH Agent.
- Create an SSH key pair.
- Add your key to the SSH agent.
- Provide Bitbucket Cloud with your public key.
- Check that your SSH authentication works.
Use Git cmd to manage repo
- clone the repo using clone command
git clone git@bitbucket.org:{org-name}/{repo-name}.git
above is just sample, you can get the command from clone button in bitbucket repository
- move to repository folder using cd command
cd {repo-name}
- use git status to check changes and your current branch
git status
- change current branch using git checkout
git checkout {branch-name}
- update your local branch and local commit history according to remote
git fetch
- pull the changes from remote using git pull
git pull
Install docker so we can use docker compose
full step to install docker on ubuntu are in here
summarize steps:
- Run the following command to uninstall all conflicting packages:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done
- Set up Docker’s
apt
repository. the step are divided by 2:
First, Add Docker’s official GPG key, run these commands:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
Second, Add the repository to Apt sources, run these commands:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install the Docker packages.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify that the Docker Engine installation is successful by running the hello-world image.
docker --version
Create SSL certificate
Step-by-step instructions to install Certbot on linux
Install snapd
sudo apt update
sudo apt install snapd
Update snapd
sudo snap install core
Remove previous Certbot packages
sudo apt-get remove certbot
Install Certbot
sudo snap install --classic certbot
Once certbot is installed, execute the following command to ensure the certbot
command can be run:
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Generate SSL Certificate with Let’s Encrypt
sudo certbot certonly --manual --preferred-challenges dns -d *.domain.com -d domain.com
you will get acme value to put on your DNS, in above example, you will get 2 acme that need to put orderly one by one, below are sample DNS TXT acme
Please deploy a DNS TXT record under the name:
_acme-challenge.domain.com.
with the following value:
pdUqtrqSHGKKPv3x2yDyvi0hZhMEUmJtxay82Fhd29f
you need to put value above to your DNS dashboard, my DNS dashboard are look like this
after you add the record, you can enter on the cmd to continue to the next acme or the next step
Success generated SSL will have this info
Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/domain.com/fullchain.pem
Key is saved at: /etc/letsencrypt/live/domain.com/privkey.pem
This certificate expires on 2024-12-17.
These files will be updated when the certificate renews.
use both according your approach how to apply SSL on your domain
GCP IP Address
Upgrade your internal and external IP address on GCP to static, so it will not changing when the instance got restart
register your external address to your dns
This content originally appeared on DEV Community and was authored by ADITYA OKKE SUGIARSO