Create custom server
Creates a new custom server in your account.
POST api/servers/custom
Parameters
Parameter | Type | Status | Description |
---|---|---|---|
type | string | required | The server type, must be any of these values: server , load-balancer , database-server , redis-server , storage-server |
name | string | optional | The server name, cannot contain any special characters and is alpha-numeric, if left empty a random name will be used |
ip | string | optional | The server's IP address |
database_type | string | optional | The database type, only applicable on the server type. Must be any of these values: mysql , mariadb , postgresql |
php_version | string | optional | The PHP version installed, only applicable on the server type. Must be any of these values: 5.6 , 7.0 , 7.1 , 7.2 , 7.3 , 7.4 |
Example request:
curl -X POST "https://ploi.io/api/servers/custom" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
--data '{
"type": "server",
"name": "awesome-server",
"ip": "12.34.56.78"
}'
After running this request, you will have to add the public key of the Ploi worker to your server. We include this in the response with a 1-line command within the ssh_command
key.
Example response:
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"name": "awesome-server",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA.... ploi-worker@ploi.io",
"ssh_command": "mkdir -p /root/.ssh && touch /root/.ssh/authorized_keys && echo ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABA.... ploi-worker@ploi.io >> /root/.ssh/authorized_keys",
"start_installation_url": "https://ploi.io/api/servers/custom/1/start",
"message": "Server has been created! Please run the \"ssh_command\" inside this response on your server as root user. After that trigger the \"start_installation_url\" with a POST request to start the actual installation."
}
After doing this, you can trigger the URL in the response with key start_installation_url
, this URL accepts a POST request with an empty body.
Example request:
curl -X POST "https://ploi.io/api/servers/custom/1/start" \
-H "Authorization: Bearer {token}" \
-H "Content-Type: application/json" \
-H "Accept: application/json"
Example response after triggering installation:
HTTP/1.1 200 OK
Content-Type: application/json
{
"message" : "Server installation has started. Please make sure to not to reboot the server or do any actions on it while installation is running."
}