Loading...

This is taking longer than expected.

Servers and applications

Keep the list of servers and the web applications on them, and set up an application on Ploi.

Servers lists the machines the company runs its projects on, and Server Applications lists the web applications installed on them, one per project and environment. From an application's page you can set it up on Ploi, the tool that manages the servers, and follow the setup step by step.

Both are in the Infrastructure group of the side menu, and each one appears only if you have been given access to it. Super administrators also have Ploi tools in the administration area, described in Sync users with Ploi and The Ploi env tool.

Servers

A server has:

  • Name and IP, both required.
  • DB Link, the link to manage its databases.
  • Provider, also required: Linode or Hetzner.
  • Ploi Id, the server's identifier on Ploi. An application cannot be set up on Ploi until its server has one.

A server's page also lists its Web Applications.

Add a web application

  1. Open Server Applications and click Create Server Application.
  2. Choose the Server and the Project.
  3. Choose the Environment: Production, Staging or Development.
  4. Type the Domain and, if the application stores files there, the AWS S3 Bucket.
  5. Click Add Server Application.

A project can have only one application per environment on each server. If it already has one, you see This project already has a web application for the selected environment on this server.

The licences are chosen afterwards. Edit the application to set:

  • Licence, the project's hosting licence.
  • Aws Licence, the project's file storage licence.

Each one offers only licences of that project: Licence those whose service name includes the word "hosting", and Aws Licence those whose service name includes the word "espacio" (storage space). See Clients, services and licences for how licences are kept. Ploi Id and Db Id are also shown when editing; they are filled in when the application is set up on Ploi.

Weekly storage check

Every Sunday at midnight, Mexico City time, each application with both an AWS S3 Bucket and an Aws Licence has its bucket measured. The space it may use is the number of GB in the name of its Aws Licence, such as 10 for a licence named "Simple 10GB". A message is posted to the company's operations channel in Slack when:

  • the bucket exists but the Aws Licence is cancelled or its End Date has arrived, so you can check whether the bucket should be deleted;
  • the bucket uses more GB than its licence allows.

A bucket that does not exist sends no message.

What happens when you save or delete an application

These only happen when the application's server has a Ploi Id:

  • Once the application has a Ploi Id and a Db Id, changing its Server, Project, Environment, Ploi Id or Db Id gives the people who have database access to the project their user on its database. This also happens when the setup on Ploi fills in those two fields.
  • Deleting an application that was created that same day and already set up on Ploi deletes its site and its database on Ploi too. Deleting any other application only removes the people's access to its database; its site and database stay on Ploi.

Set up an application on Ploi

  1. Open the application.
  2. Click Execute on Ploi.

The setup starts straight away, without a confirmation. Before starting, it checks that everything it needs is in place, and stops with a message when something is missing:

  • The selected server must have a Ploi ID before executing deploy
  • The project must have a GitLab repository before executing deploy
  • The project must have a Slack channel before executing deploy
  • For a project of any client other than the company's own first client record (a project of another client marked Is Internal still needs these licences):
    • You must define the AWS license when the application has an S3 bucket, when the application has an AWS S3 Bucket but no Aws Licence.
    • In Production: You must define the AWS license for production applications and You must define the hosting license for production applications.
  • The selected license is invalid; it must say Simple or Max, when the hosting licence's name does not include either word.
  • The selected AWS license is invalid; it must include the capacity in GB, when the storage licence's name does not say its size in GB.

You can run it again at any time. Steps already done are confirmed rather than done twice. Each run also leaves a Ploi deploy requested entry, with the person who clicked, in the activity log of the administration area.

Once the setup connects the project's GitLab repository, it also adds a webhook to that repository, so every push to the environment's branch deploys the site on Ploi: master for Production, staging for Staging and develop for Development. Running the setup again keeps that one webhook instead of adding another. When the webhook cannot be added, the setup carries on without it, and the activity log says why; run Execute on Ploi again to retry. An application set up before this existed gets its webhook the next time you run Execute on Ploi on it.

Follow the setup

The Ploi Deploy Monitor on the application's page shows how the setup is going, and refreshes itself while it runs:

  • Status: idle, pending, running, completed or failed.
  • Current step and when it was last Updated.
  • Deploy steps, each with its own status: Confirm site and repository, Confirm database, Retry database creation, Sync database users, Configure .env, Configure deploy script, Finalize deploy script, Configure queue worker, Configure scheduler, Apply final Ploi settings and Configure SSL. A step shows pending, queued, running, completed or failed; Configure SSL shows skipped when it was not needed.
  • Execution log, every message of the run with its time.

When the setup fails, Failure diagnosis says what went wrong and, when it knows them:

  • Step, where it failed.
  • Endpoint and Method, the request to Ploi that failed.
  • Attempted value and Attempted branch, what was sent.
  • Expected and Actual, what Ploi should have answered and what it answered.
  • What to review before running it again.

The monitor keeps a run for 6 hours after its last update while it is going, and for 12 hours once it has finished or failed. After that it shows idle again, with no steps or log.

Back