Skip to content

Commit 3fa1ffa

Browse files
bug(nextjs): fix nextjs host mode dotenv (#27)
and some minor readme fixes
1 parent 5759932 commit 3fa1ffa

2 files changed

Lines changed: 39 additions & 24 deletions

File tree

README.md

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22

33
A [Workspace] harness is a way to ship files to a project without being part of the project.
44

5-
In this repository are a set of harnesses that have been created for the PHP language, reducing the maintenance overhead
6-
of the individual harnesses greatly. This is due to the "base" PHP harness being used as a common set of templates.
5+
In this repository are a set of harnesses that have been created for the NodeJS language, reducing the maintenance overhead
6+
of the individual harnesses greatly. This is due to the "base" node harness being used as a common set of templates.
77

88
Each framework will fully override a base harness file if differing behaviour is required.
99

1010
## Available Frameworks
1111

12-
* [Alokai](src/alokai/)
13-
* [NextJs](src/nextjs/)
12+
- [NextJs](src/nextjs/)
1413

1514
## Features of each harness
1615

17-
* Local docker compose development environment
18-
* Skeleton for simple set-up of new projects
19-
* Pipeline docker compose environment for use in Jenkins or other tools to run tests
20-
* TODO: Helm chart for deploying QA, UAT and Production environments to Kubernetes clusters
16+
- Local docker compose development environment
17+
- Skeleton for simple set-up of new projects
18+
- Pipeline docker compose environment for use in Jenkins or other tools to run tests
19+
- TODO: Helm chart for deploying QA, UAT and Production environments to Kubernetes clusters
2120

2221
## Harness Upgrade Instructions
2322

@@ -28,36 +27,42 @@ A developer for a project can follow these steps to upgrade their harness versio
2827
2. Check what harness is in use for the project. This is usually line 2 or 3 in `workspace.yml`.
2928
3. Update the `workspace.yml` harness version (usually line 2 or 3) to the new tagged version.
3029
4. Download the new harness version:
30+
3131
```bash
3232
rm -rf .my127ws
3333
ws harness download
3434
```
35+
3536
5. Perform a recursive diff between the new release from the checked out harness from step 1 and any "overlay"
3637
directories such as `tools/workspace/`.
37-
1. Remove any files from the project that are now the same as the harness.
38-
2. Port over any changes from the harness to override files that must stay.
38+
1. Remove any files from the project that are now the same as the harness.
39+
2. Port over any changes from the harness to override files that must stay.
3940
6. Render the templates and apply the overlay directory:
41+
4042
```bash
4143
ws harness prepare
4244
```
45+
4346
7. Perform a recursive diff between the `.my127ws/application/skeleton/` folder to the project root:
44-
1. If a skeleton file (that isn't in a `_twig` folder or named `*.twig`) is missing, copy it to the project
45-
2. If a project file is missing some changes from the skeleton, try applying the change from the skeleton.
46-
3. Port over new features such as new standard dev tooling in composer.json.
47-
4. Ensure the README.md is up to date, though keep any changes made to the project's README.md over time.
47+
1. If a skeleton file (that isn't in a `_twig` folder or named `*.twig`) is missing, copy it to the project
48+
2. If a project file is missing some changes from the skeleton, try applying the change from the skeleton.
49+
3. Port over new features such as new standard dev tooling in composer.json.
50+
4. Ensure the README.md is up to date, though keep any changes made to the project's README.md over time.
4851
8. Compare the overrides for attributes in the project's `workspace.yml` to the harness's `harness.yml` and `harness/attributes/*.yml`.
49-
1. Port over any additional build, init or migrate steps.
50-
2. Remove any attribute overrides from workspace.yml that are now the same as the harness.
52+
1. Port over any additional build, init or migrate steps.
53+
2. Remove any attribute overrides from workspace.yml that are now the same as the harness.
5154
9. Test with `ws harness update existing`
5255
10. Open a pull request with the project and ensure CI checks (such as Jenkins) pass.
5356
11. Note on the pull request that to apply the changes, the following needs to be done by the project team:
57+
5458
```markdown
5559
To keep your existing database:
5660
`ws harness update existing`
5761

5862
To do a fresh installation:
5963
`ws harness update fresh`
6064
```
65+
6166
12. Ask for someone else to test the pull request.
6267
13. Once the pull request has been merged to the default branch of the project, remind the project team to apply the changes with the `ws harness update existing` or `ws harness update fresh` commands.
6368

@@ -87,6 +92,7 @@ folder. This is used for testing in Jenkins.
8792
### Quality check
8893

8994
We run shellcheck and hadolint across shell scripts and Dockerfiles. These can be run via:
95+
9096
```bash
9197
./quality
9298
```
@@ -96,8 +102,9 @@ The `./test` script described below also runs these quality checks against rende
96102

97103
### End to end tests with the secret key
98104

99-
If you have access to the secret key needed to decrypt the src/.ci/*/workspace.yml encrypted attributes, you can run
105+
If you have access to the secret key needed to decrypt the src/.ci/\*/workspace.yml encrypted attributes, you can run
100106
the following to test the given framework in the given mode like Jenkins does:
107+
101108
```bash
102109
./build && ./test <framework> <static|dynamic> [mutagen]
103110
```
@@ -111,24 +118,33 @@ If you don't have access to the key, you can still bring up a test environment:
111118

112119
1. Run `./build`
113120
2. Create and change to a tests directory
121+
114122
```bash
115123
mkdir tests
116124
cd tests
117125
ws create <framework>-test inviqa/<framework> --no-install
118126
```
119-
3. Copy the built version of harness-base-php's ``./dist/<framework>`` dir to `<framework>-test/.my127ws` directory
127+
128+
3. Copy the built version of harness-base-node's `./dist/<framework>` dir to `<framework>-test/.my127ws` directory
129+
120130
```bash
121131
cp -pR ../dist/harness-<framework>/ <framework>-test/.my127ws/
122132
```
133+
123134
4. Change directory to `<framework>-test`
135+
124136
```bash
125137
cd `<framework>-test`
126138
```
139+
127140
5. Update the override file in `<framework>-test`:
141+
128142
```bash
129143
echo "attribute('mutagen'): no" >> workspace.override.yml
130144
```
145+
131146
6. Run in `pipeline` mode to activate `static` mode
147+
132148
```bash
133149
MY127WS_ENV=pipeline ws install
134150
```
@@ -147,27 +163,26 @@ We use Gitlab release notes to generate and store changelogs.
147163

148164
When ready to tag a release, make a new branch from the `0.5.x` branch for the changelog entries:
149165

150-
1. Draft a release (don't publish it) https://github.com/inviqa/harness-base-php/releases/new?tag=0.5.0&title=0.5.0target=main
166+
1. Draft a release (don't publish it) https://github.com/inviqa/harness-base-node/releases/new?tag=0.5.0&title=0.5.0target=main
151167
2. Click `Generate release notes`
152168
3. Examine the release notes. For every entry in the `Other Changes` section, examine the Pull Requests
153169
and assign each pull request either a `enhancement` label for a new feature, `bug` for a bugfix or `deprecated` for
154170
a deprecation.
155171
4. For each Pull Request in the release, assign an appropriate `harness-*` label.
156172
5. Re-generate the changelog using step 2 as needed. Clearing the release notes to allow regeneration.
157-
7. Commit the resulting changes, push and raise a pull request.
158-
8. Once merged, continue with the release process below.
173+
6. Commit the resulting changes, push and raise a pull request.
174+
7. Once merged, continue with the release process below.
159175

160176
### Performing a Release
161177

162178
When you're ready to release:
163179

164-
1. Draft a new release https://github.com/inviqa/harness-base-php/releases/new?tag=2.0.0&title=2.0.0&target=2.0.x
180+
1. Draft a new release https://github.com/inviqa/harness-base-node/releases/new?tag=0.5.0&title=0.5.0&target=main
165181
2. Click `Generate release notes`
166182
3. Publish the release
167183
4. Submit a pull request to [my127/my127.io] which adds the new release version and asset download URL for the
168184
nodejs-based harnesses to `harnesses.json`
169185

170186
[Workspace]: https://github.com/my127/workspace
171-
[inviqa/harness-alokai]: https://github.com/inviqa/harness-base-node/tree/main/src/alokai
172187
[inviqa/harness-nextjs]: https://github.com/inviqa/harness-base-node/tree/main/src/nextjs
173188
[my127/my127.io]: https://github.com/my127/my127.io

src/nextjs/_twig/nextjs.env.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% if @('app.build') == 'host' %}
2-
{% for name, value in @('services.app.environment')|merge(@('services.app.environment_secrets')) %}
2+
{% for name, value in @('services.nextjs.environment')|merge(@('services.nextjs.environment_secrets')) %}
33
{{ name }}={{ value }}
44
{% endfor %}
55
{% endif %}

0 commit comments

Comments
 (0)