How can I deploy 1-Click Apps from the CLI?
Is there any way to create a One-Click OpenVPN App from the Linode CLI?
I see the list here, but there are only default distributions and no Open VPN listed here -> https://www.linode.com/docs/platform/api/linode-cli/#setup
Please let me know if it's possible.
1 Reply
It is indeed possible to deploy a 1-Click OpenVPN App from the Linode CLI along with any of our other 1-Click Apps. I see you linked to our old deprecated guide for our V3 API, here is the updated guide for our new V4 API.
First, our 1-Click Apps are all StackScripts. So you can get a full list of possible StackScripts to deploy by using this command:
linode-cli stackscripts list
This will bring up a rather large list, but there are a few methods you can use to sort through them to find just our One-Click Apps.
The first is to grep for the string you wish to find, in this case we can use OpenVPN as an example. The one caveat to this method is you have to search through all the pages individually. I was unable to find a method that searched through all 13 pages at once. I found the OpenVPN listed on page 13, so the command to list this One-Click App would be as follows:
linode-cli stackscripts list --page 13 | grep "Click"
This returns the following information and includes the distributions used:
│ 401719 │ linode │ OpenVPN - Latest One-Click │ linode/debian9
│ 401701 │ linode │ LAMP One-Click │ linode/debian9
│ 401697 │ linode │ WordPress - Latest One-Click │ linode/debian9
If you know the exact name of the App you wish to install you can also query just for that App using this command:
linode-cli stackscripts list --label "OpenVPN - Latest One-Click"
Which then outputs the following:
|id │ username │ label │ images |
│ 401719 │ linode │ OpenVPN - Latest One-Click │ linode/debian9 │
I trimmed the output a bit to make it more readable, but when you run the command you will also have the creation and update date of the StackScript and whether or not the StackScript is public. All of our One-Click Apps are public so everyone can use them.
Now this is a bit of a time consuming method, so I dug a bit more. This next way will require installation of a tool called jq. Jq is a lightweight and flexible command-line JSON processor. Instructions to download can be found here on their site.
Once installed you can run this query which will list all of our StackScripts that contain the label "One-Click":
curl -k https://api.linode.com/v4/linode/stackscripts -H ‘X-Filter: {“label”: {“+contains”: “One-Click”}}’ -H “Content-Type: application/json” | jq ‘.data | .[] | .label,.id’
Which will return at this time a result like this:
"Linux GSM One-Click Helpers"
401711
"One-Click Helpers"
401712
"Ark - Latest One-Click"
401699
"TF2 - Latest One-Click"
401704
"Terraria - Latest One-Click"
401705
"CS:GO - Latest One-Click"
401700
"Rust - Latest One-Click"
401703
"MERN One-Click"
401702
"Drupal - Latest One-Click"
401698
"GitLab - Latest One-Click"
401707
"WooCommerce - Latest One-Click"
401708
"WireGuard - Latest One-Click"
401706
"Minecraft - Latest One-Click"
401709
"OpenVPN - Latest One-Click"
401719
"LAMP One-Click"
401701
"WordPress - Latest One-Click"
401697
This shows a full list of the One-Click apps available along with their ID's. Now since we want to install the OpenVPN app, we merely take the ID number from this list '401719' and pop it into our CLI command. This next portion will change depending on what app you want. Since we are working on OpenVPN currently this will be the bare minimum of information you need to provide. You can then use our API to specify a variety of different arguements, including data center location or Linode size. Our API documentation provides a thorough explanation of all the configuration options available.
linode-cli linodes create \
> --stackscript_id 401719 \
> --root_pass Password \
> --stackscript_data '{"vpnuser_password": "password"}'
For both the password segments, you will want to replace my complex passwords with something much more secure. But, after running this you will have a Linode with OpenVPN installed!
There is a lot of fine tuning that can be done or added, but this should provide a good starting point for deploying our One-Click Apps with the Linode CLI.