glesys / one-click-installers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GleSYS One-Click Installers License: CC0-1.0

The scripts that powers the one-click installers on GleSYS Cloud (cloud.glesys.com).

Example

To use a one click installer you need to have access to a project in GleSYS Cloud. Create a user at https://cloud.glesys.com and have the information at hand.

When interacting with the API you need to have an API key, this can either be generated in GleSYS Cloud or you use a temporary obtained via a login command. Remember to supply the time based one time password (TOTP) token for 2 factor login protection.

A login request

curl -X POST --header "content-type: application/json" --data-binary "{
    \"username\": \"user@example.com\",
    \"password\": \"theSecretSauce\",
    \"otp\": \"123456\"
}" https://api.glesys.com/user/login

And the response looks something like this

{
  "response": {
    "status": {
      "code": 200,
      "timestamp": "2023-08-18T10:10:08+02:00",
      "text": "OK"
    },
    "login": {
      "username": "user@example.com",
      "apikey": "133bba632da64102b84d4e0d8-883ebdbf-944542f7-93a14555298963865a0afa73",
      "accounts": [
        {
          "account": "cl12345",
          "description": null,
          "roles": [
            "FullAccess"
          ]
        }
      ],
      "customers": [
        {
          "customernumber": "12345",
          "description": null,
          "roles": [
            "Owner"
          ]
        }
      ]
    },
    "debug": {
      "input": {
        "username": "user@example.com",
        "password": "theSecretSauce",
        "otp": "123456"
      }
    }
  }
}

Take the apikey field and use that together with the project key to form a base64 encoded authorization string, note that the project + apikey string must not be new line terminated (the -n flag to echo below).

authstring=$(echo -n "cl12345:133bba632da64102b84d4e0d8-883ebdbf-944542f7-93a14555298963865a0afa73" | base64)
curl -X POST \
    --header "content-type: application/json" \
    --header "authorization: Basic $authstring" \
    --data-binary "{
    \"cloudconfig\": \"runcmd: \\n  - wget https://raw.githubusercontent.com/glesys/one-click-installers/master/rancher/install-rancher.sh \\n  - chmod +x install-rancher.sh \\n\"
}" https://api.glesys.com/server/previewcloudconfig

The previewcloudconfig endpoint is used to validate the script input and won't launch a server based of the command. Use server/create for that. An expanded example on using cloud config when creating a server can be found at the API documentation wiki.

Guidelines

  1. The one-click installer should be placed in a folder which is named after a rundown of what it does. Eg. wordpress-nginx-mariadb.
  2. The folder should include a cloud-config.yaml, which should include the cloud-init code. And a README.md, which should include a summary of what it does.
  3. Include other license information in your cloud-config.yaml if the global license isn't applicable for your contribution (see License section below).
  4. When your cloud-init is merged, it still has to be integrated in the GleSYS Cloud interface. This doesn't happen automatically.

Contributing

  1. Fork it (https://github.com/yourname/yourproject/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

License

GleSYS one click installers is open sourced software licensed under the CC0 1.0 Universal. Separate one-click installers may use other licenses and if so, they should be visible in their cloud-config.yaml.

About