Skip to content

Commit 0539716

Browse files
authored
Merge branch 'master' into Lietje-patch-1
2 parents f247d83 + 77a6f8f commit 0539716

File tree

4 files changed

+123
-114
lines changed

4 files changed

+123
-114
lines changed

.devcontainer/devcontainer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"image": "mcr.microsoft.com/devcontainers/universal:2",
3+
"hostRequirements": {
4+
"cpus": 1
5+
},
6+
"waitFor": "onCreateCommand",
7+
"updateContentCommand": "python3 -m pip install -r requirements/development.txt",
8+
"postCreateCommand": "",
9+
"customizations": {
10+
"codespaces": {
11+
"openFiles": []
12+
},
13+
"vscode": {
14+
"extensions": [
15+
"bierner.markdown-mermaid",
16+
"davidanson.vscode-markdownlint",
17+
"ms-python.python"
18+
]
19+
}
20+
}
21+
}

.devcontainer/icon.png

10.2 KB
Loading

docs/hypernode-platform/mysql/how-to-use-mysql-on-hypernode.md

Lines changed: 101 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ redirect_from:
1313

1414
# How to Use Mysql on Hypernode
1515

16-
This article explains how to use MySQL on Hypernode, from finding your credentials, whitelisting your IP address to using PHPMyAdmin.
16+
This article explains how to use MySQL on Hypernode, from finding your credentials, allowlisting your IP address, to using PHPMyAdmin.
1717

1818
## Finding Your Credentials
1919

2020
Your MySQL credentials are stored in the homedir of application user.
2121

2222
You find them in the file `.my.cnf` located in `/data/web`.
2323

24-
```nginx
24+
```bash
2525
cat ~/.my.cnf
2626
```
2727

28-
```nginx
28+
```ini
2929
[client]
3030
user = app
3131
password = JlogA1Sws6XMHmAj7QlP9vpfjlprtpE5
@@ -35,48 +35,11 @@ host = mysqlmaster.example.hypernode.io
3535
## What You Should Know
3636

3737
- There is no predefined database, so you should create your own.
38-
- The `app`user is the local superuser. This means you can (among other things):
39-
- Can create your own databases;
40-
- Create users;
38+
- The `app` user is the local superuser. This means you can (among other things):
39+
- Create your own databases;
40+
- Create users and manage passwords;
4141
- Define views and triggers.
42-
- If you want to use a GUI to work on your database we recommend using a local GUI ([HeidiSQL](../../best-practices/database/how-to-use-heidisql-on-hypernode.md)) instead of an online GUI ([PHPMyAdmin](../mysql/how-to-use-phpmyadmin.md)).
43-
44-
## Whitelisting Your IP Address
45-
46-
Port 3306 is fire-walled on all Hypernodes to prevent hackers and bruteforces from connecting to your MySQL instance. That's why if you want to externally connect to MySQL on the Hypernode, you’ll need to add a whitelisting entry first.
47-
48-
### Whitelist via the hypernode-systemctl CLI Tool
49-
50-
First check which IP addresses have been whitelisted already, if any.
51-
52-
```nginx
53-
hypernode-systemctl whitelist get
54-
```
55-
56-
### Adding to Whitelist
57-
58-
To add more values to your whitelists you can run the following. Please note that descriptions are optional:
59-
60-
```nginx
61-
hypernode-systemctl whitelist add database 1.2.3.4 --description "my description"
62-
```
63-
64-
### Removing From Whitelist
65-
66-
To remove values from your whitelists you can run the following:
67-
68-
```nginx
69-
hypernode-systemctl whitelist remove database 1.2.3.4
70-
```
71-
72-
### Whitelist via Your Service Panel
73-
74-
Only our Service Panel users have the option to whitelist an IP via the Service Panel.
75-
76-
1. Log on to your [Service Panel](https://auth.byte.nl).
77-
1. Select your Hypernode.
78-
1. Go to `Instellingen` > `Externe database toegang`.
79-
1. Add the IP addresses to the firewall whitelist.
42+
- If you want to use a GUI to work on your database we recommend using a local GUI (Such as [HeidiSQL](../../best-practices/database/how-to-use-heidisql-on-hypernode.md) on Windows) instead of an online GUI ([PHPMyAdmin](../mysql/how-to-use-phpmyadmin.md)).
8043

8144
## How to Connect to MySQL
8245

@@ -86,44 +49,83 @@ Because we’ve provided a `~/.my.cnf`, you’re all set to go.
8649

8750
Just type `mysql` and you’re in.
8851

89-
```nginx
52+
```bash
9053
mysql
9154
```
9255

9356
### Use the Command Line Shell From a Remote Host
9457

9558
Use your credentials to connect like so:
9659

97-
```nginx
60+
```bash
9861
mysql --host=mysqlmaster.example.hypernode.io --user=app --password=mypassword
9962
```
10063

64+
Please note you will need to add the remote host's IP address to the allowlist first, as described below
65+
10166
### Using HeidiSQL/PHPMyAdmin to Connect to MySQL
10267

10368
Read the following articles on how to use both HeidiSQL and PHPMyAdmin for Hypernode:
10469

105-
- Using HeidiSQL
106-
- Using PHPMyAdmin
70+
- Using [HeidiSQL](../../best-practices/database/how-to-use-heidisql-on-hypernode.md)
71+
- Using [PHPMyAdmin](../mysql/how-to-use-phpmyadmin.md)
10772

10873
### Using an SSH Tunnel to Circumvent Firewalls
10974

110-
If you are blocked by a firewall, you can tunnel the remote MySQL service to your local computer (Mac or Linux).
75+
If you are blocked by a firewall, you can create a temporary tunnel between the remote MySQL service and your local computer.
11176

11277
Use this command:
11378

114-
```nginx
79+
```bash
11580
ssh -NL 3306:mysqlmaster:3306 app@example.hypernode.io
11681
```
11782

11883
Voila, now your Hypernode database is reachable through localhost port 3306!
11984

85+
## Allowlisting Your IP Address
86+
87+
Port 3306 is firewalled on all Hypernodes to prevent hackers and bruteforces from connecting to your MySQL instance. That's why if you want to externally connect to MySQL on the Hypernode, you’ll need to add the remote IP address to the allowlist first.
88+
89+
### Allow an IP via the hypernode-systemctl CLI tool
90+
91+
First check which IP addresses have been whitelisted already, if any.
92+
93+
```bash
94+
hypernode-systemctl whitelist get
95+
```
96+
97+
### Adding to the Allowlist
98+
99+
To add more values to your allowlist you can run the following. Please note that descriptions are optional:
100+
101+
```bash
102+
hypernode-systemctl whitelist add database 203.0.113.4 --description "my description"
103+
```
104+
105+
### Removing From the Allowlist
106+
107+
To remove IP addresses from your allowlists you can run the following:
108+
109+
```bash
110+
hypernode-systemctl whitelist remove database 203.0.113.4
111+
```
112+
113+
### Manage the Allowlist via the Control Panel
114+
115+
It's also possible to whitelist an IP address via the Control Panel
116+
117+
1. Log on to the [Control Panel](https://my.hypernode.com).
118+
1. Select your Hypernode.
119+
1. Select `Allowlist` from the menu.
120+
1. Add the IP addresses to the database allowlist.
121+
120122
## Creating a MySQL Back-Up
121123

122124
### Using Magerun
123125

124126
Use the following command using SSH:
125127

126-
```nginx
128+
```bash
127129
magerun db:dump -n -c gz -s @stripped
128130
```
129131

@@ -150,22 +152,12 @@ You should consider using Magerun (see above), but you could use HeidiSQL to cre
150152

151153
## Using MySQL
152154

153-
### How to Upgrade the MySQL Version
154-
155-
Hypernode offers several version of MySQL to be able to meet te requirements of several Magento, Shopware and Akeneo versions. For example, if you want to install Magento 2.4, you'd have to run MySQL 5.7 or 8.0.
156-
157-
To upgrade your MySQL version you can use[the hypernode-systemctl tool](../tools/how-to-use-the-hypernode-systemctl-cli-tool.md#mysql) through the command line.
158-
159-
```nginx
160-
hypernode-systemctl settings mysql_version --value 5.7
161-
```
162-
163155
### How to Create a New Database
164156

165-
To create a new database, we’ll login using the MySQL client and drop the database using the command line.
157+
To create a new database, we’ll login using the MySQL client and create the database using the command line.
166158

167-
```nginx
168-
>DATABASE="new_database"
159+
```bash
160+
DATABASE="new_database"
169161
mysql -e "CREATE DATABASE IF NOT EXISTS $DATABASE"
170162
```
171163

@@ -179,12 +171,12 @@ To prevent incorrect deletion of database that are still in use, ensure yourself
179171

180172
- The database is not used anymore by checking it’s content.
181173
- The database is not defined in your application configuration anymore.
182-
(IE: Check the `local.xml` and/or your `wp-config.php).`
174+
(IE: Check the configuration in you `local.xml`, `env.php`, `wp-config.php`, etc).
183175
- You created a backup to ensure yourself you are able to restore the database if necessary.
184176

185177
When you are 100% sure it is safe to delete the database, issue the following command:
186178

187-
```nginx
179+
```bash
188180
DATABASE="old_database"
189181
mysql -e "DROP DATABASE $DATABASE"
190182
```
@@ -198,105 +190,101 @@ If you truncate a database table, all records are removed but the table structur
198190

199191
After you ensured yourself it is safe to delete all records of the table, use the following command:
200192

201-
```nginx
193+
```bash
202194
DATABASE="magento"
203195
TABLE="core_url_rewrite"
204196
mysql "$DATABASE" -e "TRUNCATE TABLE $TABLE"
205197
```
206198

207-
### Changing Your MySQL 5.6 Password
199+
## Changing Your Password
200+
201+
How you change the database password depends on what version of MySQL you are running on your Hypernode.
202+
203+
### Changing Your Password on MySQL 5.6
208204

209205
Login to your MySQL server via the following command:
210206

211-
```nginx
207+
```bash
212208
mysql
213209
```
214210

215-
This will get you into the MySQL prompt. Select the database which holds user accounts, here it’s called mysql;
211+
This will get you into the MySQL prompt. In this example we change the password for the `app` user to `p4ssw0rd`
216212

217-
```nginx
218-
use mysql;
213+
```mysql
214+
SET PASSWORD FOR 'app'@'%' = PASSWORD("p4ssw0rd");
219215
```
220216

221-
Now change the password for a given user account using this command:
217+
Your password has been updated. There’s no need to restart the MySQL demon. Exit the MySQL with
222218

223-
```nginx
224-
update user set password=PASSWORD('newpassword') where user='username';
219+
```mysql
220+
exit;
225221
```
226222

227-
Let’s assume here that your username is ‘trial’ and your new password is ‘hypernode’. Your actual command would look like this:
223+
### Changing Your Password on MySQL 5.7
224+
225+
Login to your MySQL server via the following command
228226

229-
```nginx
230-
update user set password=PASSWORD('hypernode') where user='trial';
227+
```bash
228+
mysql
231229
```
232230

233-
Now your password is changed in the database, but they haven’t filtered into memory yet. Change that by typing:
231+
This will get you into the MySQL prompt. In this example we change the password for the `app` user to `p4ssw0rd`
234232

235-
```nginx
236-
flush privileges;
233+
```mysql
234+
ALTER USER `app` IDENTIFIED BY 'p4ssw0rd';
237235
```
238236

239237
Your password has been updated. There’s no need to restart the MySQL demon. Exit the MySQL with
240238

241-
```nginx
239+
```mysql
242240
exit;
243241
```
244242

245-
## How to Upgrade Your MySQL Version
246-
247-
### Upgrading to MySQL 5.7
248-
249-
**Please note that once you have upgraded the MySQL version on your Hypernode, you won't be able to downgrade it.**
250-
251-
You can upgrade the MySQL version on your Hypernode from 5.6 to 5.7 with the following command:
252-
253-
```nginx
254-
hypernode-systemctl settings mysql_version 5.7
255-
```
256-
257-
You can then check with `livelog` when the process has finished and your MySQL version has been upgraded.
243+
Remember to update your `~/.my.cnf` with your new password so you could easily login your MySQL-CLI without entering the password each time.
258244

259-
### Changing Your MySQL 5.7 Password
245+
### Changing Your Password on MySQL 8.0
260246

261247
Login to your MySQL server via the following command
262248

263-
```nginx
249+
```bash
264250
mysql
265251
```
266252

267-
This will get you into the MySQL prompt. Select the database which holds user accounts, here it’s called mysql;
253+
This will get you into the MySQL prompt. In this example we change the password for the `app` user to `p4ssw0rd`
268254

269-
```nginx
270-
use mysql;
255+
```mysql
256+
ALTER USER `app` IDENTIFIED BY 'p4ssw0rd';
271257
```
272258

273-
Now change the password for a given user account using this command, in this case the `app` user:
259+
Your password has been updated. There’s no need to restart the MySQL demon. Exit the MySQL with
274260

275-
```nginx
276-
update user set authentication_string=password('newpassword') where user='app';
261+
```mysql
262+
exit;
277263
```
278264

279-
Now your password is changed in the database, but they haven’t filtered into memory yet. Change that by typing:
265+
Remember to update your `~/.my.cnf` with your new password so you could easily login your MySQL-CLI without entering the password each time.
280266

281-
```nginx
282-
flush privileges;
283-
```
267+
## How to Upgrade Your MySQL Version
284268

285-
Your password has been updated. There’s no need to restart the MySQL demon. Exit the MySQL with
269+
### Upgrading to MySQL 5.7
286270

287-
```nginx
288-
exit;
271+
**Please note that once you have upgraded the MySQL version on your Hypernode, you won't be able to downgrade it.**
272+
273+
You can upgrade the MySQL version on your Hypernode from 5.6 to 5.7 with the following command:
274+
275+
```bash
276+
hypernode-systemctl settings mysql_version 5.7
289277
```
290278

291-
Remember to update your `~/.my.cnf` with your new password so you could easily login your MySQL-CLI without entering the password each time.
279+
You can then check with `livelog` when the process has finished and your MySQL version has been upgraded.
292280

293281
### Upgrading to MySQL 8.0
294282

295283
**Please note that once you have upgraded the MySQL version on your Hypernode, you won't be able to downgrade it.**
296284

297-
Before you can upgrade to MySQL 8.0 you first need to upgrade the MySQL version to 5.7 and wait for this process to finish. Once You can upgrade the MySQL version on your Hypernode from 5.7 to 8.0 with the following command:
285+
Before you can upgrade to MySQL 8.0 you first need to upgrade the MySQL version to 5.7 and wait for this process to finish. Once that is done, you can upgrade the MySQL version on your Hypernode from 5.7 to 8.0 with the following command:
298286

299-
```nginx
287+
```bash
300288
hypernode-systemctl settings mysql_version 8.0
301289
```
302290

docs/hypernode-platform/nginx/how-to-resolve-rate-limited-requests-429-too-many-requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Both methods are implemented using [this module](http://nginx.org/en/docs/http/n
3333

3434
You can quickly determine which method of Rate Limiting was the cause of the request being 429'd since each time any of the rate-limiting methods are hit, a message with be logged in the Nginx error log.
3535

36-
To do so you first look up the request in the access logs, which can be done using the hypernode-parse-nginx-logs (**pnl**) command: `pnl --today --fields time,status,remote_addr,request --filter status=429`
36+
To do so you first look up the request in the access logs, which can be done using the hypernode-parse-nginx-logs (**pnl**) command: `pnl --today --fields time,status,remote_addr,request,ua --filter status=429`
3737

3838
Copy the IP address from the output generated by this command and look up the corresponding log entry in the aforementioned Nginx error log with `cat /var/log/nginx/error.log | grep "1.2.3.4"`
3939

0 commit comments

Comments
 (0)