Skip to content

Commit d1ea842

Browse files
authored
Merge pull request #118 from ByteInternet/update_brancher_docs
2 parents b47a85b + cd7b1a5 commit d1ea842

File tree

1 file changed

+53
-19
lines changed

1 file changed

+53
-19
lines changed

docs/hypernode-platform/tools/hypernode-brancher.md

Lines changed: 53 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,22 @@ The appname specified in the request url is the appname on which the Brancher no
100100

101101
Once the Brancher node becomes available, you can control it via the `/v2/app/<appname>-eph123456` endpoint just like a regular Hypernode.
102102

103-
### Hypernode-deploy
103+
To specify `labels` and/or `clear_services` in the API call, you can set the header `Content-Type: application/json` with a content body like:
104104

105-
Hypernode-deploy is our recommended way of deploying your webshop to Hypernode. which makes it easier for you to manage your application’s codebase. This platform is fully integrated with Hypernode Brancher, which makes it a breeze for you to try out upgrade scenarios, or pushes to the Staging environment.
105+
```json
106+
{
107+
"labels": ["some_label"],
108+
"clear_services": ["cron", "elasticsearch", "mysql", "supervisor"]
109+
}
110+
```
111+
112+
### Hypernode Deploy
106113

107-
Once you set up your Hypernode to make use of Hypernode-deploy, you can run your tests against a Brancher node with just a single command. This will then run against your fresh Branched version of the Node, making sure that your tests are passing before deploying to production.
114+
Hypernode Deploy is our recommended way of deploying your webshop to Hypernode. which makes it easier for you to manage your application’s codebase. This platform is fully integrated with Hypernode Brancher, which makes it a breeze for you to try out upgrade scenarios, or pushes to the Staging environment.
108115

109-
You can use Brancher in your Hypernode-deploy deploy.php file like this:
116+
Once you set up your Hypernode to make use of Hypernode Deploy, you can run your tests against a Brancher node with just a single command. This will then run against your fresh Branched version of the Node, making sure that your tests are passing before deploying to production.
117+
118+
You can use Brancher in your Hypernode Deploy `deploy.php` file like this:
110119

111120
```php
112121
<?php
@@ -120,51 +129,76 @@ $testStage = $configuration->addStage('test', 'example.com');
120129
// We use an automatically created Brancher node based on the parent for the 'test' stage.
121130
// In your testing pipeline, you can simply use the 'test' stage to push changes to the Brancher server,
122131
// and run your tests. Cancel it when your tests fail or after your tests pass to incur minimal costs.
123-
$testStage->addBrancherServer('appname')
124-
->setSettings(['cron_enabled' => false, 'supervisor_enabled' => false]);
132+
$testStage->addBrancherServer('example')
133+
->setLabels(['stage=test'])
134+
->setSettings(['clear_services' => ['cron', 'supervisor']);
125135
126136
return $configuration;
127137
```
128138

129139
This will automatically create a Brancher node based on the parent Hypernode and push to it, allowing you to test the changes before making them on the production Hypernode.
130140

141+
In this example, we also set the label `stage=test` and the setting `clear_services` with value `cron` and `supervisor`, which means that the `cron` and `supervisor` configurations found on `example` will not be actively present on the Brancher instance.
142+
131143
### Hypernode-systemctl brancher
132144

133-
You can use the command hypernode-systemctl brancher tool to quickly interact with the Hypernode API in a validated and controlled manner. Creating a Brancher node goes like this:
145+
You can use the command hypernode-systemctl brancher tool to quickly interact with the Hypernode API in a validated and controlled manner.
146+
147+
```{note}
148+
There's an alias `hypernode-brancher` for the command `hypernode-systemctl brancher`, this might save you some keystrokes :).
149+
```
150+
151+
#### Creating a Brancher node
134152

135153
```console
136154
$ hypernode-systemctl brancher --create
137-
Brancher App created for app 'testalex'. See hypernode-systemctl brancher --list for the progress
138-
app_name: testalex-eph123456
139-
parent: testalex
140-
Host: testalex-eph123456.hypernode.io
155+
Brancher App created for app 'example'. See hypernode-systemctl brancher --list for the progress
156+
app_name: example-eph123456
157+
parent: example
158+
Host: example-eph123456.hypernode.io
159+
Labels: None
160+
Services with data to be cleared: cron
141161
IP: will become available in a couple of minutes
142162
```
143163

144-
You can then list the available Brancher nodes:
164+
In the above example you see the details of the created Brancher instance. The output also contains the given labels and services to be cleared, which have the respective defaults of `None` and `cron`.
165+
166+
To apply one or more label(s) to the Brancher instance, you can specify one or more `--label` options when creating the instance:
167+
168+
```console
169+
$ hypernode-systemctl brancher --create --label my_brancher_instance --label 'user=johndoe'
170+
```
171+
172+
To override the services that are cleared by default, pass the `--clear-services` option:
173+
174+
```console
175+
$ hypernode-systemctl brancher --create --clear-services cron elasticsearch mysql supervisor
176+
```
177+
178+
#### Listing available Brancher nodes
145179

146180
```console
147181
$ hypernode-systemctl brancher --list
148182
+--------------------+----------------+---------------------------------+---------+
149183
| Name | IP | Host | Minutes |
150184
+--------------------+----------------+---------------------------------+---------+
151-
| testalex-ephjopv59 | 83.217.88.80 | testalex-ephjopv59.hypernode.io | 4592 |
152-
| testalex-ephw4zcjr | 185.111.198.18 | testalex-ephw4zcjr.hypernode.io | 4345 |
153-
| testalex-ephsbuos6 | 37.72.165.123 | testalex-ephsbuos6.hypernode.io | 1866 |
185+
| example-ephjopv59 | 83.217.88.80 | example-ephjopv59.hypernode.io | 4592 |
186+
| example-ephw4zcjr | 185.111.198.18 | example-ephw4zcjr.hypernode.io | 4345 |
187+
| example-ephsbuos6 | 37.72.165.123 | example-ephsbuos6.hypernode.io | 1866 |
154188
+--------------------+----------------+---------------------------------+---------+
155189
```
156190

157-
Finally, you can delete it:
191+
#### Deleting a brancher node
158192

159193
```console
160194
$ hypernode-systemctl brancher --delete
161-
Brancher App 'testalex-eph123456' deleted. See hypernode-systemctl brancher --list for the list of remaining brancher apps.
195+
Brancher App 'example-eph123456' deleted. See hypernode-systemctl brancher --list for the list of remaining brancher apps.
162196
```
163197

164198
And with some creativity you can come up with a one-liner to remove all active Brancher nodes:
165199

166200
```console
167201
$ hypernode-systemctl brancher --list | awk '{print$2}' | grep -eph | xargs -n1 hypernode-systemctl brancher --delete
168-
Brancher App 'testalex-eph123456' deleted. See hypernode-systemctl brancher --list for the list of remaining brancher apps.
169-
Brancher App 'testalex-eph234567' deleted. See hypernode-systemctl brancher --list for the list of remaining brancher apps.
202+
Brancher App 'example-eph123456' deleted. See hypernode-systemctl brancher --list for the list of remaining brancher apps.
203+
Brancher App 'example-eph234567' deleted. See hypernode-systemctl brancher --list for the list of remaining brancher apps.
170204
```

0 commit comments

Comments
 (0)