You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/hypernode-deploy/getting-started/configure-ci-cd.md
+29-95Lines changed: 29 additions & 95 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,34 @@ There are many CI/CD pipelines available, but it's probably best to stick with t
13
13
14
14
In this example we'll be covering the Github Actions CI/CD configuration.
15
15
16
+
## How Hypernode Deploy pipelines work
17
+
18
+
Hypernode Deploy uses a **two-step architecture** designed to keep your server runtime fast and efficient:
19
+
20
+
### 1. Build step (runs in the CI/CD pipeline)
21
+
22
+
The build step runs entirely within your CI/CD pipeline's infrastructure (GitHub Actions, GitLab CI, or Bitbucket Pipelines) and **never touches your production server**. This is where all the heavy, resource-intensive work happens:
23
+
The build step handles all resource-intensive operations: installing dependencies with `composer install`, compiling frontend assets and themes, running code minification and image optimization, and performing any other heavy preparation tasks needed to ready your application for deployment.
24
+
25
+
By performing these heavy operations in the pipeline, you avoid consuming precious server resources. Your production server stays responsive and dedicated to serving customer requests, not compiling code or building assets.
26
+
27
+
The build step produces a **build artifact** (typically `build.tgz`) containing your ready-to-deploy application.
28
+
29
+
### 2. Deploy step (runs in the CI/CD pipeline, deploys to server)
30
+
31
+
The deploy step also runs in your CI/CD pipeline infrastructure, but this time it:
32
+
33
+
- Downloads the build artifact created in the build step
34
+
- Connects to your Hypernode server via SSH
35
+
- Transfers the pre-built application to the server
36
+
- Runs deployment tasks like:
37
+
- Database migrations
38
+
- Cache clearing
39
+
- Symlink switching (zero-downtime deployments)
40
+
- Running post-deployment hooks
41
+
42
+
This way your artifact deploys in seconds, seserver resources stay focused on serving customers, and you can deploy the same tested build to multiple environments without rebuilding.
43
+
16
44
## Prepare the secrets
17
45
18
46
Hypernode Deploy needs a few 'credentials' to be able to function. The necessary credentials are:
@@ -68,104 +96,10 @@ Then go to your Github repository on Github.com and go to **Settings -> Secrets
68
96
69
97
***Optional step***
70
98
71
-
We assume you want to use the Hypernode Brancher feature to spin up temporary nodes based on a specific Hypernode. SSH into that Hypernode and copy the contents of the `/etc/hypernode/hypernode_api_token` file.
99
+
We assume you may want to use the Hypernode Brancher feature to spin up temporary nodes based on a specific Hypernode. SSH into that Hypernode and copy the contents of the `/etc/hypernode/hypernode_api_token` file.
72
100
73
101
Then go to your Github repository on Github.com and go to **Settings -> Secrets -> Actions**. Click the **New repository secret**, fill in `HYPERNODE_API_TOKEN` as the name, paste the contents of your `hypernode_api_token` file and press **Save**.
74
102
75
-
## Create the workflow file
76
-
77
-
Create the `.github/workflows` directory structure:
78
-
79
-
```console
80
-
$ mkdir -p .github/workflows
81
-
```
82
-
83
-
In that directory, create a file named `deploy.yaml` and fill in the following contents:
84
-
85
-
```yaml
86
-
name: Build and deploy application
87
-
88
-
on:
89
-
push:
90
-
branches:
91
-
- 'master'# Your main/master/production branch
92
-
- 'staging'# Your staging/acceptance branch
93
-
94
-
run-name: Build and deploy application – ${{ github.ref_name }}
95
-
```
96
-
97
-
### Build step
98
-
99
-
The first thing we want to run is the `build` step, which does all the dirty work to prepare the application for the web. Add the following configuration to the `deploy.yaml` file.
100
-
101
-
```yaml
102
-
env:
103
-
COMPOSER_CACHE_DIR: /tmp/composer-cache
104
-
105
-
jobs:
106
-
build:
107
-
runs-on: ubuntu-latest
108
-
timeout-minutes: 60
109
-
# Here we use the latest Hypernode Deploy image with PHP 8.4 and Node.js 22
Copy file name to clipboardExpand all lines: docs/hypernode-deploy/pipelines/bitbucket-pipelines.md
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# Bitbucket Pipelines
2
2
3
+
```{note}
4
+
This guide assumes you have already configured Hypernode Deploy with a `deploy.php` file in your project root. If you haven't set this up yet, please follow the [installation and configuration guide](../getting-started/install-and-configure-hypernode-deploy.md) first.
5
+
```
6
+
3
7
## Configuring deployment environments
4
8
5
9
To start using Bitbucket Pipelines, we need to prepare the environments we want to deploy to.
@@ -23,7 +27,7 @@ Bitbucket allows you to create an SSH key from the Repository Settings, you do t
23
27
24
28
#### Generating own pair of SSH Keys
25
29
26
-
You cangenerate an SSH keypair on the server, copy the public key to the `~/.ssh/authorized_keys` file
30
+
You can generate an SSH keypair on the server, copy the public key to the `~/.ssh/authorized_keys` file
27
31
and encode the private key with base64. We'll use this base64-encoded private key later on.
28
32
29
33
```console
@@ -110,3 +114,9 @@ pipelines:
110
114
script:
111
115
- hypernode-deploy deploy staging
112
116
```
117
+
118
+
## Next steps
119
+
120
+
After you've added these files, commit your changes and make sure the changes are newly present on the branches configured in your pipeline files. By default, these branches are `master` (or `main`) and `acceptance`.
121
+
122
+
Once pushed, you will see a Pipeline automatically run in your repository's "Pipelines" tab.
Copy file name to clipboardExpand all lines: docs/hypernode-deploy/pipelines/github-actions.md
+29-30Lines changed: 29 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,15 @@
1
1
# GitHub Actions
2
2
3
-
## Configuring deployment environments
4
-
5
-
To start using GitHub Actions, we need to prepare the environments we want to deploy to.
6
-
7
-
For example, these environments can be:
8
-
9
-
- production
10
-
- acceptance (or staging)
11
-
- test
3
+
```{note}
4
+
This guide assumes you have already configured Hypernode Deploy with a `deploy.php` file in your project root. If you haven't set this up yet, please follow the [installation and configuration guide](../getting-started/install-and-configure-hypernode-deploy.md) first.
5
+
```
12
6
13
-
###Configuring the production environment
7
+
## Configuring SSH authentication
14
8
15
9
Hypernode Deploy will need a pair of SSH keys for authentication to the server.
16
10
17
-
First, we generate an SSH keypair on the production server, copy the public key to the `~/.ssh/authorized_keys` file
18
-
and encode the private key with base64. We'll use this base64-encoded private key later on.
11
+
First, we generate an SSH keypair on one of your servers (e.g., production), copy the public key to the `~/.ssh/authorized_keys` file
12
+
on all servers you want to deploy to, and encode the private key with base64. We'll use this base64-encoded private key later on.
Now go to your GitHub project and go to **Settings -> Environments**.
21
+
```{note}
22
+
If you have multiple environments (production, acceptance, staging), make sure to add the public key to each server through the Control Panel.
23
+
```
24
+
25
+
Now go to your GitHub project and go to **Settings -> Secrets and variables -> Actions**.
28
26
29
-
1. Create a new environment called `production`, if it doesn't exist yet.
30
-
1. Click the `production` environment and click `Add secret`.
27
+
1. Click **New repository secret**.
31
28
1. Set the **Name** to `SSH_PRIVATE_KEY`.
32
29
1. Set the **Value** to the base64-encoded private key we generated earlier.
33
30
1. Click **Add secret**.
34
31
35
-
### Configuring the acceptance environment
36
-
37
-
If you have an acceptance (or staging) environment, repeat the same steps for the production environment, but now for
38
-
your acceptance environment, with the GitHub environment name `acceptance`.
39
-
40
32
## Build
41
33
42
34
To get started, we need to make sure the `.github/workflows` directory structure exists.
@@ -65,10 +57,10 @@ jobs:
65
57
with:
66
58
path: /tmp/composer-cache
67
59
key: ${{ runner.os }}-composer
68
-
- uses: webfactory/ssh-agent@v0.7.0
69
-
with:
70
-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
60
+
- run: mkdir -p $HOME/.ssh
71
61
- run: hypernode-deploy build -vvv
62
+
env:
63
+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
72
64
- name: archive production artifacts
73
65
uses: actions/upload-artifact@v4
74
66
with:
@@ -98,11 +90,13 @@ name: Deploy application to production
98
90
on:
99
91
push:
100
92
branches:
101
-
- 'master' # production branch
93
+
- 'master'
94
+
- 'main'
102
95
103
96
jobs:
104
97
build:
105
98
uses: ./.github/workflows/build.yml
99
+
secrets: inherit
106
100
107
101
deploy:
108
102
needs: build
@@ -125,11 +119,10 @@ jobs:
125
119
with:
126
120
path: /tmp/composer-cache
127
121
key: ${{ runner.os }}-composer
128
-
- uses: webfactory/ssh-agent@v0.7.0
129
-
with:
130
-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
131
122
- run: mkdir -p $HOME/.ssh
132
123
- run: hypernode-deploy deploy production -vvv # Deploy production stage defined in deploy.php
124
+
env:
125
+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
133
126
```
134
127
135
128
## Deploy to acceptance
@@ -147,6 +140,7 @@ on:
147
140
jobs:
148
141
build:
149
142
uses: ./.github/workflows/build.yml
143
+
secrets: inherit
150
144
151
145
deploy:
152
146
needs: build
@@ -169,9 +163,14 @@ jobs:
169
163
with:
170
164
path: /tmp/composer-cache
171
165
key: ${{ runner.os }}-composer
172
-
- uses: webfactory/ssh-agent@v0.7.0
173
-
with:
174
-
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
175
166
- run: mkdir -p $HOME/.ssh
176
167
- run: hypernode-deploy deploy acceptance -vvv # Deploy acceptance/staging stage defined in deploy.php
168
+
env:
169
+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
177
170
```
171
+
172
+
## Next steps
173
+
174
+
After you've added these files, commit your changes and make sure the changes are newly present on the branches configured in your pipeline files. By default, these branches are `master` (or `main`) and `acceptance`.
175
+
176
+
Once pushed, you will see a GitHub Action automatically run in your repository's "Actions" tab.
Copy file name to clipboardExpand all lines: docs/hypernode-deploy/pipelines/gitlab-ci.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,9 @@
1
1
# Gitlab CI
2
2
3
+
```{note}
4
+
This guide assumes you have already configured Hypernode Deploy with a `deploy.php` file in your project root. If you haven't set this up yet, please follow the [installation and configuration guide](../getting-started/install-and-configure-hypernode-deploy.md) first.
5
+
```
6
+
3
7
## Configuring deployment environments
4
8
5
9
To start using Gitlab CI, we need to prepare the environments we want to deploy to.
@@ -109,3 +113,9 @@ deploy_acceptance:
109
113
name: acceptance
110
114
url: https://acceptance.example.com
111
115
```
116
+
117
+
## Next steps
118
+
119
+
After you've added these files, commit your changes and make sure the changes are newly present on the branches configured in your pipeline files. By default, these branches are `master` (or `main`) and `acceptance`.
120
+
121
+
Once pushed, you will see a Pipeline automatically run in your repository's "Build" -> "Pipelines" or "CI/CD" -> "Pipelines" tab.
0 commit comments