documentation/tools/deploying-drutopia-updates.md

106 lines
3.4 KiB
Markdown
Raw Normal View History

# Deploying Drutopia updates
## Prerequsites
A bit more PHP than you need, but this will definitely get you ready for composer and friends:
@TODO Switch these commands to PHP 8.1?
```bash
sudo apt-get install ansible rsync php7.4 php7.4-gd php7.4-mysql php7.4-xml php7.4-curl php7.4-fpm php7.4-sqlite3 php7.4-cli
```
Then follow the commands from:
[getcomposer.org/download](https://getcomposer.org/download/)
And then:
```bash
sudo mv composer.phar /usr/local/bin/composer
```
To make working with [Drutopia Platform's recommended Ansible setup](https://gitlab.com/drutopia-platform/drutopia_host#introduction) easier (and for the following instructions to work), install Ahoy per its instructions:
[github.com/ahoy-cli/ahoy](https://github.com/ahoy-cli/ahoy)
Get yourself added to the [Drutopia Platform project on GitLab](https://gitlab.com/groups/drutopia-platform/-/group_members) if you are not already, and [ensure your public SSH key is on Gitlab](https://gitlab.com/-/profile/keys).
Finally, [clone needed Drutopia repositories locally according to the recommended setup](creating-new-drutopia-site).
Now you are ready for deploying Drutopia updates on a regular basis.
## Ensure you are up-to-date
```bash
cd ~/Projects/drutopia-platform/drutopia_host/hosting_private
ahoy git-pull-all
```
2022-05-27 13:32:32 +00:00
```bash
ahoy new-site example
```
And, following the instructions that provides, copy the
2022-05-27 13:32:32 +00:00
```bash
ansible-vault edit host_vars/elizabeth.mayfirst.org/vault.yml
```
2022-05-27 13:54:47 +00:00
If using typical `sitename-test.drutopia.org` and `sitename-live.drutopia.org` domains pending the real site domain, add the subdomains to drutopia.org through the [May First control panel](https://members.mayfirst.org/cp/)
## Prepare appropriate base
2022-05-27 13:32:32 +00:00
```bash
ahoy deploy-build next
```
## Deploy your site
2022-05-27 13:32:32 +00:00
```bash
ahoy deploy-site example_test
```
2022-05-27 13:32:32 +00:00
And you can share back the record of the deployments in the `build_artifacts` repository with this:
```bash
ahoy artifacts
```
## Putting it all together
```bash
cd ~/Projects/drutopia-platform/drutopia_host/hosting_private
ahoy git-pull-all
ahoy deploy-build next
ahoy deploy-site example_live
2022-05-27 13:32:32 +00:00
ahoy artifacts
```
## If you need to override site configuration:
```bash
ahoy deploy-site-force example_test
```
2022-08-09 15:41:55 +00:00
## Sync live database to test
2022-08-09 15:41:55 +00:00
If you have new content on the live site that you want to see how your code works with, or if you have created entities on the test site that block the removal of configuration you changed your mind about, you will want to sync from live to test.
```bash
ssh d-example-live
sync_to_test.sh
```
This handles making a paranoia dump of the test site in `~/backups`, dropping the test database to ensure no tables are left to clutter and interfere, skipping the content of cache tables, and bringing over user files (skipping cache files like the twig folder).
## Bonus: Keep Drutopia builds with similar available modules
To try to keep various Drutopia-based distributions from diverging too much, at least insofar as available modules, even if they aren't installed, we can use the **meld** (`sudo apt-get install meld`) diff tool to compare and share when posssible.
```bash
meld ~/Projects/agaric/sites/crla/crla-org/composer.json ~/Projects/agaric/sites/geo/composer.json ~/Projects/drutopia-platform/build_source/composer.json ~/Projects/agaric/sites/agaric-com/composer.json
```
When these align in not needing special patches or versions, we can consider dropping a custom build in favor of collaborating on a single one.