Roles & Permissions
Each user of a project has one of three roles. The admins of the hosting give the roles per project, so you can be a lead developer on one project and a developer on another. Ask the admins when someone joins or leaves the team, or needs another role.
- Developer works on development environments and never sees production or its personal data.
- Lead developer can also look into production, back it up and handle its backups, i.e. full database dumps.
- Release manager is the user of CI (CircleCI, GitHub Actions and so on). It builds and deploys all environments, and has no access to backups.
People don't deploy: all deployments go through CI. This way every change of an environment comes from Git and passes the same checks.
Who can do what
| Developer | Lead developer | Release manager (CI) |
|---|---|---|---|
Development environments | | | |
List them, see their domains | yes | yes | yes |
Logs, shell, exec, run, copy files | yes | yes | yes |
Build and push images, deploy | no | no | yes |
Delete | yes | yes | yes |
Production | | | |
See it in the list, see its domains | no | yes | yes |
Logs, shell, exec, run, copy files | no | yes | yes |
Build and push images, deploy | no | no | yes |
Back up now (backup:create) | no | yes | yes |
Delete | no | no | no |
Backups (need two-factor authentication) | | | |
Download partial database backups | yes | yes | no |
Download full database backups | no | yes | no |
Download files backups | yes | yes | no |
Upload database and files backups | no | yes | no |
Only the admins can delete production. Deleting it takes the site down, and its database and files go with it after a final backup.
Backups of databases can't be deleted by anyone on the project, only added. Backups of files can be changed by lead developers, as an upload makes the backup the same as the uploaded folder.
Good to know
- Commands with backups need a session of hosty auth with a code from your authenticator app. CI can't enter codes, and release managers have no access to backups anyway.
- Developers don't see production in hosty ls, and any command on production fails for them.
- Development environments are created from partial database backups, so developers never get the data of the tables excluded from them (see Working with environments). Lead developers list these tables in hosty.yaml.
- Projects are isolated from each other: users of one project can't reach the environments, databases, files or images of another.
How it works
For the admins, and for the curious:
- The roles are lists of AWS users in the project in main.tf: developers, lead_developers and release_managers. Each list is an IAM group, <project>-developers, <project>-lead-developers and <project>-release-managers, and a group in Kubernetes, <project>:developers and so on.
- Access to backups is given by IAM policies of the groups, and works only with an MFA session. Only release managers can push images to the repository of the project in ECR.
- In the cluster, each project has a namespace for development environments, <project>-development, and one for production, <project>-production. Release managers get the cluster role project-development-deploy or project-production-deploy there, people get project-development-user or project-production-user. Developers have no role in the production namespace.
- Admission policies (helm/access-policies) add what roles can't express. For example, only admins can delete production, and the jobs of people can't use the service account that writes backups.