Adding a new project
This page shows how to move a project to Hosty, once the admins have created it. A new project starts from backups: you upload its database and files, and the first deployment of production imports them.
Some steps need the lead developer role: uploading backups and backing up production. The deployments are done by CI, with the release manager user of the project. See Roles & Permissions.
What you need
From the admins:
- the name of the project, the name of the cluster and its AWS region;
- your user with the lead developer role (see Setting up a new user);
- a release manager user for CI, with its access keys and VPN profile.
1. Prepare the code
- Add the Hosty configuration of the project in .hosty/hosty.yaml, with the project, the cluster and the region from the admins. See Project configuration and the examples there.
- Install the dependencies of the applications, i.e. composer install or npm ci, either in CI before the build or in the build hook of the application (hooks.build in hosty.yaml).
- Keep files that the site doesn't need to run out of the images: user content, caches, node_modules of a PHP site and so on. They make the images bigger and every deployment slower. Hosty builds the images from the folder of each application.
- Set up Hosty CLI and commit everything.
2. Upload the backups
The first deployment of production imports the latest full backup of the database and the backups of the files. Upload them with your lead developer user.
Upload the database dump. Supported formats are .sql, .sql.gz and .sql.zst:
hosty backup:database:upload --full ./backup.sql.gz -vUpload the files of each persistent storage from hosty.yaml. The path is relative to the root of the project:
hosty backup:files:upload public drupal/web/sites/default/files/ -vHosty CLI asks for a code from your authenticator app if you don't have a session of hosty auth. If the project has several applications, add --application to each command.
3. Deploy production from CI
Set up CI with the release manager user, as described in CI/CD configuration. For production, CI runs:
hosty build --push production -v
hosty deploy production -vCommit all changes before the build: Hosty CLI tells whether an image has to be built again by the last commit of the code, so it doesn't see changes that aren't committed.
The first deployment takes longer, as it imports the backups. Hosty CLI waits for the import up to 30 minutes by default. For a large database, set a longer time in hosty.yaml:
import:
# Minutes, from 30 to 1440.
timeout: 3004. Check production
Connect to the VPN and list the domains of production:
hosty domains production -vOpen the site and check that it works. If it doesn't, look at the logs with hosty logs production. To serve the site on its own domain, see Adding a custom domain.
5. Make the first backup
Development environments are created from the partial backup of the database, which is the database without the data of the tables listed in excludeTablesFromImportOnDevEnvs. The backup you uploaded is a full one, so make a backup of production before you create development environments:
hosty backup:create -vYou can also upload a partial dump you made yourself, with hosty backup:database:upload --partial. Otherwise the first scheduled backup makes it: by default, production is backed up at 0:00, 8:00 and 16:00 UTC. A development environment created before there is any partial backup starts with an empty database.
Before you make the backup, check the list of tables in excludeTablesFromImportOnDevEnvs. The partial backup must not have personal data, as developers can download it.