Create custom server
Creates a new custom server in your account.
POST api/servers/custom
Required scopes:
Create servers
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 | required | The server's IP address |
ssh_port | integer | required | The SSH port the server runs on |
database_type | string | required | The type of database to install, must be either: none , mysql , mariadb , postgresql or postgresql13 |
php_version | string | required | 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 , 8.0 , 8.1 , 8.2 , 8.3 |
description | string | optional | Allows you to send in an additional description for your server as note |
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."
}
If you don't want to install this server anymore after this step, you can still remove it using the delete server endpoint.
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 or with any of the optional parameters.
Parameter | Type | Status | Description |
---|---|---|---|
install_monitoring | boolean | optional | Allows you to install Ploi monitoring as well, requires Pro plan or higher |
webhook_url | url | optional | This URL gets triggered by Ploi when installation has completed, you can use this for your own system, this will only send 1 signal, there is no retry schedule |
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."
}