Go - Echoip
EchoIP is a simple service for looking up your IP address.
This doc explains how to install and configure EchoIP from source, and how to deploy it as a Go application on Clever Cloud.
How to Configure and Deploy EchoIP on Clever Cloud
Download EchoIP
You can download EchoIP from https://github.com/mpolden/echoip and create a new origin.
First clone EchoIP’s repository:
~ $ git clone https://github.com/mpolden/echoip.git
~ $ cd echoip
Configure clevercloud/go.json
Create the necessary files to build and run the application:
echoip/ ~ $ mkdir clevercloud
echoip/ ~ $ cat << EOF > clevercloud/go.json
{
"deploy": {
"makefile": "Makefile",
"main": "../go_home/bin/echoip"
}
}
EOF
echoip/ ~ $ git add clevercloud/
echoip/ ~ $ git commit -m "add clevercloud files" clevercloud/
Setting up environment variables on Clever Cloud
With the Clever Cloud console
- Go to the Clever Cloud console, and find the app you want to fine tune under it’s organization.
- Find the Environment variables menu and select it.
- In this menu, you will see a form with VARIABLE_NAME and variable value fields.
- Fill them with the desired values then select Add.
- Don’t forget to “Update Changes” at the end of the menu.
With the Clever Tools CLI
- Make sure you have clever-tools installed locally. Refer to our CLI getting started.
- In your code folder, do
clever env set <variable-name> <variable-value>
Refer to environment variables reference for more details on available environment variables on Clever Cloud.
You can of course create custom ones with the interface we just demonstrated, they will be available for your application.
Define necessary environment variables (this is specific to EchoIP):
echoip/ ~ $ clever env set CC_RUN_COMMAND "~/go_home/bin/echoip -H X-Forwarded-For"
Your environment variable has been successfully saved
Git Deployment on Clever Cloud
You need Git on your computer to deploy via this tool. Here is the official website of Git to get more information: git-scm.com
Setting up your remotes
The “Information” page of your app gives you your Git deployment URL, it looks like this:
git+ssh://git@push.clever-cloud.com/<your_app_id>.git
- Copy it in your clipboard
Locally, under your code folder, type in
git init
to set up a new git repository or skip this step if you already have oneAdd the deploy URL with
git remote add <name> <your-git-deployment-url>
Add your files via
git add <files path>
and commit them viagit commit -m <your commit message>
Now push your application on Clever Cloud with
git push <name> master
Refer to git deployments for more details.
Add the clevercloud git remote:
echoip/ ~ $ git remote add clevercloud $(jq -r '.apps[0].git_ssh_url' < .clever.json)
Push the app for deployment:
echoip/ ~ $ git push clevercloud master
Check the deployment logs:
echoip/ ~ $ clever logs
Did this documentation help you ?