Goal
To fully manage the life cycle of sites on Upsun, including the creation of new projects, initializing from a hosted GitHub repository, and deleting projects.
Assumptions
- SSH key configured on account
- The Upsun CLI installed
- Your default/production git branch is named
main
Problems
You will need a public GitHub project that already has the required YAML files to work with Upsun.
Steps
1. Creating projects
To create a new project, use the upsun create command.
2. Initializing projects from a GitHub repository
The upsun environment:init command requires both the Project ID of the newly created project and the URL of the GitHub project. Note that as of version 3.40.8 of the Upsun CLI, the environment:init command is considered beta and not listed via upsun list.
upsun environment:init -p <Project ID> -e main <GitHub URL>
Note that the GitHub URL is the https: URL from the browser, not the git: URL.
Open the new site in your browser with the following command:
upsun url -p <Project ID>
upsun url -p ov4iu6fcb35jg Environment ID [main]: Enter a number to open a URL [0] https://main-7rqtwti-ov4iu6fcb35jg.de-2.upsun.site/ [1] https://www.main-7rqtwti-ov4iu6fcb35jg.de-2.upsun.site/ [2] http://main-7rqtwti-ov4iu6fcb35jg.de-2.upsun.site/ [3] http://www.main-7rqtwti-ov4iu6fcb35jg.de-2.upsun.site/ > 0 https://main-7rqtwti-ov4iu6fcb35jg.de-2.upsun.site/

3. Deleting projects
Delete the project with the following command:
upsun project:delete -p <Project ID>
You will be prompted to type the name of the project as a security confirmation, since deleting a project is irreversible.
upsun project:delete -p ov4iu6fcb35jg You are about to delete the project: New Drupal Site (ov4iu6fcb35jg) * This action is irreversible. * Your site will no longer be accessible. * All data associated with this project will be deleted, including backups. * You will be charged at the end of the month for any remaining project costs. Are you sure you want to delete this project? [y/N] y Type the project title to confirm: New Drupal Site
Conclusion
The Upsun CLI enables full life cycle management of your sites. It is not even necessary to use Git directly when creating, initializing, and deleting sites.
Comments
Please sign in to leave a comment.