11# Hypernode Deploy Configuration
2- These documentation is the guide to painlessly setup an automated deploy on the [ Hipex B.V.] ( https://www.hipex.io/ )
3- platform.
2+ These documentation is the guide to painlessly setup an automated deploy on the [ Hypernode] ( https://www.hypernode.com/ ) platform.
43The repository contains:
54
65- Configuration objects
76- Documentation
87
98## Whats inside?
109- Deployer configuration hosts / tasks
11- - Hipex server setup
10+ - Hypernode server setup
1211- Email / New Relic notification
13- - CloudFlare flush
12+ - Cloudflare flush
1413
1514## Configuration
16- 1 . Composer ` require hipex /deploy-configuration --dev ` package. Only needed when you want to have autocomplete in your ` deploy.php `
15+ 1 . Composer ` require hypernode /deploy-configuration --dev ` package. Only needed when you want to have autocomplete in your ` deploy.php `
1716file.
18172 . Copy the deploy templates inside the root of your project as ` deploy.php ` . You can find the template in
19- [ templates/deploy.php] ( ./templates/deploy.php ) .
20- As you can see a ` $configuration ` variable is assigned a instance of a ` Configuration ` class.
18+ [ templates/deploy.php] ( ./templates/deploy.php ) .
19+ As you can see a ` $configuration ` variable is assigned a instance of a ` Configuration ` class.
2120This configuration object contains the whole deploy configuration and can be altered to your needs using getters/setters.
2221Change configuration matching you use case, and refer to the documentation for other build in configurations and tasks.
23223 . Setup your CI server
24- 1 . GitLab CI [ templates/.gitlab-ci.yml] ( ./templates/.gitlab-ci.yml ) .
25- 3 . Bitbucket [ templates/bitbucket-pipelines.yml] ( ./templates/bitbucket-pipelines.yml ) .
23+ 1 . GitLab CI [ templates/.gitlab-ci.yml] ( ./templates/.gitlab-ci.yml ) .
24+ 2 . Bitbucket [ templates/bitbucket-pipelines.yml] ( ./templates/bitbucket-pipelines.yml ) .
25+ 3 . ** Github Actions workflow coming soon!**
26264 . For Magento 2 your first build will fail due to missing configuration. Login to the server and depending on your project file edit
27- the ` app/etc/env.php ` or ` app/etc/local.xml ` . You will find these files in ` ~/domains /<domain>/application/ shared/ ` .
27+ the ` app/etc/env.php ` or ` app/etc/local.xml ` . You will find these files in ` ~/apps /<domain>/shared/ ` .
2828
2929## Build steps
3030
@@ -34,11 +34,13 @@ Builds the application to prepare to run in a production environment.
3434
3535You can define commands which needs to be executed during the build stage as follows:
3636
37- ` $configuration->addBuildCommand(new \HipexDeployConfiguration\Command\Build\Composer()) `
37+ ``` php
38+ $configuration->addBuildCommand(new \Hypernode\DeployConfiguration\Command\Build\Composer());
39+ ```
3840
3941This command will execute a ` composer install ` in your project folder install all project dependencies.
40-
41- All possible commands can be found in the ` HipexDeployConfiguration \Command\Build` namespace.
42+
43+ All possible commands can be found in the ` Hypernode\DeployConfiguration \Command\Build` namespace.
4244Refer to the API docs for usage and options.
4345
4446This repository contains a few application templates which specifies the common tasks and their order to get the application build correctly.
@@ -50,64 +52,62 @@ Deploys the application which was build in the build stage to a given set of hos
5052
5153First you need to define your environments / infrastructure.
5254
53- ```
54- $stageAcceptance = $configuration->addStage('acceptance', 'acceptance.mydomain.com', 'my_ssh_username');
55- $stageAcceptance->addServer('productionxxx.hipex.io', [
56- ServerRole::APPLICATION_FIRST,
57- ServerRole::APPLICATION,
58- ServerRole::LOAD_BALANCER,
59- ServerRole::VARNISH,
60- ServerRole::REDIS,
61- ]);
55+ ``` php
56+ $stageAcceptance = $configuration->addStage('acceptance', 'acceptance.mydomain.com');
57+ $stageAcceptance->addServer('appname.hypernode.io');
6258```
6359
6460To set extra SSH options (https://www.ssh.com/academy/ssh/config ) for your server you can also provide these.
6561For example:
6662
67- ```
63+ ``` php
6864$stage->addServer(
69- 'productionxxx.hipex .io',
70- [ServerRole::APPLICATION ],
65+ 'appname.hypernode .io',
66+ [],
7167 [],
7268 ['LogLevel' => 'verbose']
69+ );
7370```
7471
7572You can define commands which needs to be executed during the deploy stage as follows:
7673
77- ` $configuration->addDeployCommand(new \HipexDeployConfiguration\Command\Deploy\Magento2\CacheFlush()) `
74+ ``` php
75+ $configuration->addDeployCommand(new \Hypernode\DeployConfiguration\Command\Deploy\Magento2\CacheFlush());
76+ ```
7877
79- All possible commands can be found in the ` HipexDeployConfiguration \Command\Deploy` namespace.
78+ All possible commands can be found in the ` Hypernode\DeployConfiguration \Command\Deploy` namespace.
8079Refer to the API docs for usage and options.
8180
8281### 3. Provision Platform services / configurations
8382
84- Optionally you can have some services and application configurations setup automatically from your git repository to the Hipex platform
83+ Optionally you can have some services and application configurations setup automatically from your git repository to the Hypernode platform
8584
8685For example you could maintain your cron configuration in your GIT repository and have it automatically deployed to particular servers.
8786
88- ```
89- $configuration
90- ->addPlatformConfiguration(
91- (new \HipexDeployConfiguration\PlatformConfiguration\CronConfiguration())
87+ ``` php
88+ $configuration ->addPlatformConfiguration(
89+ (new \Hypernode\DeployConfiguration\PlatformConfiguration\CronConfiguration())
9290 ->setStage('production')
93- )
91+ );
9492```
9593
9694Or setup a varnish instance
9795
98- ```
99- $configuration->addPlatformService(new \HipexDeployConfiguration\ PlatformService\VarnishService())
96+ ``` php
97+ $configuration->addPlatformService(new \Hypernode\DeployConfiguration\ PlatformService\VarnishService());
10098```
10199
102100For all possible tasks and configuration please refer to the API docs.
103101
104- ### 4 . AfterDeploy tasks
102+ ### 3 . AfterDeploy tasks
105103
106104After deploy tasks are triggered after a succesfull deployment.
107105For example notifications are available.
108106
109107Usage:
110- ` $configuration->addAfterDeployTask(\HipexDeployConfiguration\AfterDeployTask\SlackWebhook()) `
108+ ``` php
109+ $configuration->addAfterDeployTask(new \Hypernode\DeployConfiguration\AfterDeployTask\SlackWebhook());
110+ ```
111111
112112## Application template
113113
@@ -117,9 +117,10 @@ You could use those so you don't have to specify each task manually.
117117Available templates:
118118- Magento 1
119119- Magento 2
120+ - Shopware 6
120121
121122Example usage:
122- ` $configuration = new Magento2('git@git.foo.bar:magento-2/project.git', ['nl '], ['nl ']) `
123+ ` $configuration = new Magento2('git@git.foo.bar:magento-2/project.git', ['nl_NL '], ['nl_NL ']) `
123124
124125## Required environment variables
125126Some specific environment variables are required to allow the deploy image access to the git repository
@@ -129,44 +130,16 @@ or to be able to send out notifications.
129130- ` SSH_PRIVATE_KEY ` Unencrypted SSH key. The key needs to have access to: main git repository, private packages
130131and the SSH user. Must be base64 encoded like this:
131132
132- ``` bash
133+ ``` bash
133134cat ~ /.ssh/deploy_key | base64
134135```
135136
136- ## ServerRoles and Stages
137-
138- Servers are defined with a given set of server roles
139-
140- ```
141- $stage = $configuration->addStage('production', 'www.mydomain.com', 'my_ssh_username');
142- $stage->addServer('production1.hipex.io', [
143- ServerRole::APPLICATION,
144- ]);
145- $stage->addServer('production2.hipex.io', [
146- ServerRole::LOADBALANCER,
147- ]);
148- ```
149-
150- Most of the configurations can be specifically set for a given serverrole and/or stage.
151-
152- ```
153- $nginxConfiguration = (new NginxConfiguration('/etc/nginx/production'))
154- ->setServerRoles([ServerRole::APPLICATION])
155- ->setStage('production')
156- $configuration->addPlatformConfiguration($nginxConfiguration)
157- ```
158-
159- This nginx configuration task will only be executed on production1, because this is the only one having server role ` APPLICATION `
160-
161- Most tasks are assigned logical server roles already, so no need to specify them in those cases.
162-
163-
164137## Testing
165138To test your build & deploy you can run your deploy locally.
166139
167140First make sure you have all the required env variables setup using.
168141
169- ``` bash
142+ ``` bash
170143export SSH_PRIVATE_KEY=***
171144export DEPLOY_COMPOSER_AUTH=***
172145.... etc
@@ -175,10 +148,10 @@ export DEPLOY_COMPOSER_AUTH=***
175148Then start your build / deployment run command from root of the project.
176149
177150* repeat -e <ENV > for all env vars that are present during build*
178- ``` bash
179- docker run -it -e SSH_PRIVATE_KEY -e DEPLOY_COMPOSER_AUTH -v ` pwd` :/build hipex /deploy hipex -deploy build -vvv
151+ ``` bash
152+ docker run -it -e SSH_PRIVATE_KEY -e DEPLOY_COMPOSER_AUTH -v ` pwd` :/build hypernode /deploy hypernode -deploy build -vvv
180153```
181154
182- ``` bash
183- docker run -it -e SSH_PRIVATE_KEY -e DEPLOY_COMPOSER_AUTH -v ` pwd` :/build hipex /deploy hipex -deploy deploy acceptance -vvv
155+ ``` bash
156+ docker run -it -e SSH_PRIVATE_KEY -e DEPLOY_COMPOSER_AUTH -v ` pwd` :/build hypernode /deploy hypernode -deploy deploy acceptance -vvv
184157```
0 commit comments