The Shipa Developer Hub

Welcome to the Shipa developer hub. You'll find comprehensive guides and documentation to help you start working with Shipa as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Changelog

Consuming Services

Shipa provides applications with native services that can be consumed globally by applications deployed in Shipa.

For detailed information about currently supported and available Shipa services, please visit the Services page, which is part of this documentation

Service Consumption

In Shipa, service workflow can be described in two steps:

  • Create a service instance
  • Bind the service instance to the application

To start exploring and consuming available services from Shipa, list all services currently available by using the service list command:

$ shipa service list
+----------------+-----------+
| Services       | Instances |
+----------------+-----------+
| mongodb        |           |
| mysql          |           |
| redis          |           |
| rabbitmq       |           |
+----------------+-----------+

The output from service list above shows four available services and no instances created on any of them. To create our MySQL instance, run the command service instance add:

$ shipa service instance add mysql db_instance
Service successfully added.

Now, if we run service list again, we see the new service instance available in the list:

$ shipa service list
+----------------+----------------------+
| Services       | Instances            |
+----------------+----------------------+
| mongodb        |                      |
| mysql          | db_instance          |
| redis          |                      |
| rabbitmq       |                      |
+----------------+----------------------+

To bind the service instance to an application, use the service instance bind command.

$ shipa service instance bind mysql db_instance -a myapp
Instance mysql is now bound to the app myapp.

The following environment variables are now available for use in your app:

- MYSQL_PORT
- MYSQL_PASSWORD
- MYSQL_USER
- MYSQL_HOST
- MYSQL_DATABASE_NAME

As shown in the command output, the environment variables are used to connect to the MySQL server.

Next, update the application to use these variables when connecting to the database.

After updating the application, deploy the new version of the application, which allows it to communicate with the service.

Service Information

To get more information about a service, use the service info <service_name> command.

$ shipa service info mysql
Info for "mysql"

Instances
+-------------+---------+-------+
| Instances   | Plan    | Apps  |
+-------------+---------+-------+
| db_instance | default | myapp |
+-----------------------+-------+

Plans
+---------+------------+
| Name    | Description|
+---------+------------+
| medium  | 2G Memory  |
| default | 1G Memory  |
+---------+------------+

Occasionally, creating a new service instance may take some time to complete. To see the state of a service instance, use service instance status <service_name> <service_instance>:

$ shipa service instance-status mysql db_instance
Service instance "db_instance" is pending

As soon as service-instance-status command returns as up, the application is ready to use.

Updated 3 months ago


Consuming Services


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.