Skip to content

Commit

Permalink
Add v1.0 Upgrade Instructions (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
kierenevans authored Feb 3, 2021
1 parent 902104b commit a0ff156
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

**Breaking changes:**

- Update ingress api version [\#535](https://github.com/inviqa/harness-base-php/pull/535) ([kierenevans](https://github.com/kierenevans))
- Rename AWS Credentials [\#533](https://github.com/inviqa/harness-base-php/pull/533) ([kierenevans](https://github.com/kierenevans))
- Remove docker-sync support [\#530](https://github.com/inviqa/harness-base-php/pull/530) ([kierenevans](https://github.com/kierenevans))
- Rename magento.static\_content.backend to magento.static\_content.adminhtml [\#526](https://github.com/inviqa/harness-base-php/pull/526) ([kierenevans](https://github.com/kierenevans))
Expand All @@ -43,7 +44,6 @@
- Rename aws.id and aws.key and env vars to match aws's standard env var naming [\#100](https://github.com/inviqa/harness-base-php/issues/100)
- Join lighthouse to the private network [\#537](https://github.com/inviqa/harness-base-php/pull/537) ([kierenevans](https://github.com/kierenevans))
- \#508 Use drush [\#536](https://github.com/inviqa/harness-base-php/pull/536) ([kierenevans](https://github.com/kierenevans))
- Update ingress api version [\#535](https://github.com/inviqa/harness-base-php/pull/535) ([kierenevans](https://github.com/kierenevans))
- Add a command hook to cleanup built images [\#534](https://github.com/inviqa/harness-base-php/pull/534) ([andytson-inviqa](https://github.com/andytson-inviqa))
- Update magento2 NGINX config to 2.4.1 [\#532](https://github.com/inviqa/harness-base-php/pull/532) ([kierenevans](https://github.com/kierenevans))
- Update magento2 VCL to 2.4.1 [\#531](https://github.com/inviqa/harness-base-php/pull/531) ([kierenevans](https://github.com/kierenevans))
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,37 @@ Each framework will fully override a base harness file if differing behaviour is

A developer for a project can follow these steps to upgrade their harness version:

1. Clone the repository for the harness in use for the project and check out the new tagged version. For example:
1. Check the [version specific upgrade instructions] for the new version to see if there are any specific steps. If
upgrading through multiple versions, check the previous version's instructions too!
2. Clone the repository for the harness in use for the project and check out the new tagged version. For example:
```bash
git clone git@github.com:inviqa/harness-php.git
cd harness-php
git checkout 1.0.3
pwd # Use this path for the diff in step 3
```
2. Update the `workspace.yml` harness version (usually line 2 or 3) to the new tagged version.
3. Perform a recursive diff between the new release from the checked out harness from step 1 and any "overlay"
3. Update the `workspace.yml` harness version (usually line 2 or 3) to the new tagged version.
4. Perform a recursive diff between the new release from the checked out harness from step 1 and any "overlay"
directories such as `tools/workspace/`.
1. Remove any files from the project that are now the same as the harness.
2. Port over any changes from the harness to override files that must stay.
4. Download the new harness version and render the twig templates:
5. Download the new harness version and render the twig templates:
```bash
rm -rf .my127ws
ws harness download
ws harness prepare
```
5. Perform a recursive diff between the `.my127ws/application/skeleton/` folder to the project root:
6. Perform a recursive diff between the `.my127ws/application/skeleton/` folder to the project root:
1. If a skeleton file (that isn't in a `_twig` folder or named `*.twig`) is missing, copy it to the project
2. If a project file is missing some changes from the skeleton, try applying the change from the skeleton.
3. Port over new features such as new standard dev tooling in composer.json.
4. Ensure the README.md is up to date, though keep any changes made to the project's README.md over time.
6. Compare the overrides for attributes in the project's `workspace.yml` to the harness's `harness.yml` and `harness/attributes/*.yml`.
7. Compare the overrides for attributes in the project's `workspace.yml` to the harness's `harness.yml` and `harness/attributes/*.yml`.
1. Port over any additional build, init or migrate steps.
2. Remove any attribute overrides from workspace.yml that are now the same as the harness.
7. Test with `ws harness update existing`
8. Open a pull request with the project and ensure CI checks (such as Jenkins) pass.
9. Ask for someone else to test the pull request.
8. Test with `ws harness update existing`
9. Open a pull request with the project and ensure CI checks (such as Jenkins) pass.
10. Ask for someone else to test the pull request.

## Helm charts

Expand Down Expand Up @@ -215,3 +217,4 @@ If the next release does not make sense to be in the current 1.0.x branch:
[inviqa/harness-symfony]: https://github.com/inviqa/harness-symfony
[inviqa/harness-wordpress]: https://github.com/inviqa/harness-wordpress
[my127/my127.io]: https://github.com/my127/my127.io
[version specific upgrade instructions]: https://github.com/inviqa/harness-base-php/blob/1.1.x/UPGRADE.md
116 changes: 116 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Upgrade Guide

In addition to the README's [Harness Upgrade Instructions], please note these specific version upgrade instructions.

## Upgrading from 0.12.x to 1.0.x

### Removal of docker-sync

If you use docker-sync on macOS, you can convert to mutagen with the following commands:
```bash
docker-sync stop
docker rm "<workspace-project-name>-sync"
ws switch mutagen
```

### Removed attributes

* `attribute('pipeline.publish.chart.git.key')` - replaced with `attribute('pipeline.publish.chart.git.ssh_private_key')`
* `attribute('docker.config')` - replaced with `attribute('docker.image_pull_config')`
* `attribute('git.main_branch')` - replaced with `attribute('git.default_branch')`
* `attribute('resources.cpu.requests.<service>')` - no equivalent
* `attribute('resources.cpu.limits.<service>')` - no equivalent
* `attribute('resources.memory.<service>')` - replaced with `attribute('services.<service>.resources.memory')`
* `attribute('resources.memory.app_init')` - replaced with `attribute('services.console.resources.init_memory')`
* `attribute('resources.memory.app_migrate')` - replaced with `attribute('services.console.resources.migrate_memory')`
* `attribute('pipeline.preview.resources.memory.<service>')` - replaced with `attribute('pipeline.preview.services.<service>.resources.memory')`
* `attribute('pipeline.production.resources.memory.<service>')` - replaced with `attribute('pipeline.production.services.<service>.resources.memory')`

### Removed functions

* The function `deep_merge_to_yaml` has been removed. Please convert from:
```yaml
deep_merge_to_yaml([...], 2, 2)
```
to:
```yaml
to_nice_yaml(deep_merge([...]), 2, 2)
```

### Renamed attributes

* If you use AWS for asset downloads, rename `attribute('aws.id')` to `attribute('aws.access_key_id')` and
`attribute('aws.key')` to `attribute('aws.secret_access_key')`
* Magento 2's static content deploy attribute `attribute('magento.static_content.backend')` is now
`attribute('magento.static_content.adminhtml')`
* Any attributes mentioning `redis_session` should be renamed to `redis-session`

### Removed templates

The following templates have been removed:
* _twig/docker-compose.yml/application.yml.twig - replaced with _twig/docker-compose.yml/service/console.yml.twig and _twig/docker-compose.yml/service/webapp.yml.twig
* _twig/docker-compose.yml/environment.yml.twig - replaced with `attribute('services.php-base.environment')` and `attribute('services.php-base.environment_secrets')`
* helm/app/_twig/values.yaml/environment.yml.twig - replaced with `harness/attributes/docker*.yml` which can be used via `attribute('services.<service>.environment')`
* helm/app/_twig/values.yaml/resources.yml.twig - replaced with `.Values.services.<service>.resources.memory`
* Akeneo's helm/app/values.yaml.twig - now using version from _base
* Spryker's _twig/docker-compose.yml/environment.yml.twig - replaced with `attribute('services.php-base.environment_dynamic')` which sets up appropriate store-specific hostnames.
* Spryker's _twig/docker-compose.yml/nginx_environment.yml.twig - replaced with `attribute('services.nginx.environment_dynamic')` which sets up appropriate store-specific hostnames.
* Spryker's helm/app/_twig/values.yaml/environment.yml.twig - replaced with `attribute('services.php-base.environment_dynamic')` which sets up appropriate store-specific rabbitmq vhost environment variables.
* Spryker's helm/app/values.yaml.twig - now using version from _base.
* Spryker's helm/qa/values.yaml.twig - now using version from _base.

### Helm charts

* `.Values.service.<service>` true/false enabled array is now `.Values.services.<service>.enabled`, as set by `attribute('services.<service>.enabled')`
* `.Values.docker.services` is now `.Values.services`, as set by `attribute('services')` run through a `filter_local_services()` function call, which restricts which keys are available to helm to exclude environment_secrets.
* `.Values.docker.image.<service>` is now `.Values.services.<service>.image`
* `.Values.resources.memory.<service>` is now `.Values.services.<service>.resources.memory`
* Now only compatible with Kubernetes 1.16+ due to ingress API version changes

#### Spryker

Spryker's values.yaml.twig now uses the version from _base, shared across all frameworks.

The default value for `resourcePrefix` was previously `{{ @('workspace.name') ~ '-' }}`.

To avoid setting up new services as a different name in kubernetes, add the following to the project's `workspace.yml`:
```yaml
attribute('pipeline.base.resourcePrefix'): = @('workspace.name') ~ '-'
```
## Upgrading from 0.11.x to 0.12.x
### Composer
* Composer version 2 necessitates upgrading of composer packages that act as plugins. If you cannot upgrade at this
time, you can revert to Composer version 1 in `workspace.yml` like so:
```yaml
attribute('php.composer.major_version'): 1
```

* Composer version 2 no longer autoloads classes that do not conform to the PSR-0 or PSR-4 autoloading specification.
Double check any messages you get from the autoloader step of `composer install` or `composer dump-autoload`.

* With the switch to composer's authoritative classmap, even with version 1, projects should ensure all classes that
need to be autoloadable via composer are available in composer.json's autoload or autoload-dev sections.

* For Drupal 8, this entails adding the `fenetikm/autoload-drupal` composer plugin.
* For Magento 2, ensure `generated/code/` is present in the autoload section.

### Helm charts

Helm-standard labels have been added to all resources which will cause a redeployment of all services. This will incur
downtime for any services that use persistent storage backed by ReadWriteOnce volume (i.e. anything that isn't NFS).

### Magento 2

In app/etc/config.php, if you set system->default->general->locale->code to something other than en_US, ensure you
set up `attribute('magento.static_content')` to cover that locale, or there will be 404s for static assets.

### Opcache

A file based opcache is now in use for command line applications when in production mode. If you change any PHP file
that a subsequent command needs to access the new content of, clear `/tmp/php-file-cache/*`. This is handled during the
build of docker images in relation to composer and new autoloader files, but a project may have custom setup.

[Harness Upgrade Instructions]: https://github.com/inviqa/harness-base-php#harness-upgrade-instructions

0 comments on commit a0ff156

Please sign in to comment.