Skip to content

Commit 3c07b06

Browse files
committed
Merge branch '7.0' into 7.1
# Conflicts: # Orm/Xtensive.Orm.Tests.Framework/Orm.config
2 parents b396403 + 7690404 commit 3c07b06

29 files changed

Lines changed: 2986 additions & 19 deletions

Containers/ReadMe.md

Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
# Containers
2+
3+
Containers here are ment to be used for running tests. When built correctly after run they will have required database structure.
4+
Dockerfiles and initialization scripts are grouped into folders and hereafter all examples of build commands assume that they are executed in context of one of the folders.
5+
6+
Across all instances of different RDBMSs we use 'dotest' user with 'dotest' password as cridentials for connection. In some cases user can be changed on container run, but not in all cases. We recommend using default settings, thought test connection password is weak it is fine for test environment and easy to remember.
7+
8+
## MS SQL Server
9+
10+
Dockerfiles are placed in 'mssql' folder.
11+
12+
### Build image
13+
14+
Assuming commands are executed in context of 'mssql' folder, images can be built as following
15+
16+
```console
17+
docker buildx build -f do-mssql-2017 -t do-mssql:2017 .
18+
```
19+
```console
20+
docker buildx build -f do-mssql-2019 -t do-mssql:2019 .
21+
```
22+
```console
23+
docker buildx build -f do-mssql-2022 -t do-mssql:2022 .
24+
```
25+
26+
Don't forget about the dot at the end.
27+
28+
More information about ```buildx build``` [in docker documentation](https://docs.docker.com/reference/cli/docker/buildx/build/).
29+
30+
### Run container
31+
32+
If images are built like in the examples above then containers can be run like so
33+
34+
```console
35+
docker run --name DO_SQL2017 -h DO_SQL2017 -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="<your sa password>" -e TZ=<timezone of host> -e MSSQL_INIT_WAIT=60 -p 1417:1433 -d do-mssql:2017
36+
```
37+
```console
38+
docker run --name DO_SQL2019 -h DO_SQL2019 -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="<your sa password>" -e TZ=<timezone of host> -e MSSQL_INIT_WAIT=60 -p 1419:1433 -d do-mssql:2019
39+
```
40+
```console
41+
docker run --name DO_SQL2022 -h DO_SQL2022 -e ACCEPT_EULA=Y -e MSSQL_PID="Developer" -e MSSQL_SA_PASSWORD="<your sa password>" -e TZ=<timezone of host> -e MSSQL_INIT_WAIT=60 -p 1422:1433 -d do-mssql:2022
42+
```
43+
44+
Here,
45+
46+
``` --name``` - name of the container, we use names like in the examples but you can choose any other name.
47+
48+
``` -h``` or ```--hostname``` - it will be required in connection strings, if you are familiar with MS SQL Server installation process then you probably know about named instances. The hosthame here will be name of instance.
49+
50+
``` -e ACCEPT_EULA=Y ``` - accepting EULA, more on [official docker page](https://hub.docker.com/r/microsoft/mssql-server)
51+
52+
``` -e MSSQL_PID="Developer"``` - the edition the container will run with. We develop so we use "Developer" edition (available options listed on [official docker page](https://hub.docker.com/r/microsoft/mssql-server) )
53+
54+
``` -e MSSQL_SA_PASSWORD="<your sa password>" ``` - password for 'sa' user. It should meet MS SQL Server password policies. (more on [official docker page](https://hub.docker.com/r/microsoft/mssql-server) )
55+
56+
``` -e TZ=<timezone of host>``` - Some of tests still assume that test runner and storage insance are in the same timezone. If you run and test locally on your machine, set it to host timezone, otherwise false falling tests appear.
57+
58+
``` -e MSSQL_INIT_WAIT=60 ``` - NOTE, this is not a standard variable. MS SQL Server takes some time to start and begin recieving connections, to not get false connection errors we need to wait for some time. This parameter defines how long we need to wait before first attempt to connect. Depending on how performant host machine is the value might require increase or let be decreased. Default wait time is 60 (seconds).
59+
60+
``` -p 1417:1433``` - host-to-container port mappings. If serveral containers are run on the same host they are required to have different host ports. We use following pattern - first two digits of default port (1433) and last two digits of MS SQL Server version e.g. 17 for 2017, 19 for 2019, so on.
61+
62+
63+
### Connect to instance in docker
64+
65+
To access an instance run in docker use "```<pc name or ip>\hostname, <host port>```" as ```DataSource```, similar to connections to named instances.
66+
67+
Say, Docker's host has name is "WILLY" and containers run with commands above, then connection strings may look like:
68+
69+
```
70+
Data Source=WILLY\DO_SQL2017,1417;Initial Catalog=DO-Tests;User Id=dotest;Password=dotest;MultipleActiveResultSets=True;
71+
```
72+
```
73+
Data Source=WILLY\DO_SQL2019,1419;Initial Catalog=DO-Tests;User Id=dotest;Password=dotest;MultipleActiveResultSets=True;
74+
```
75+
```
76+
Data Source=WILLY\DO_SQL2022,1422;Initial Catalog=DO-Tests;User Id=dotest;Password=dotest;MultipleActiveResultSets=True;
77+
```
78+
79+
80+
81+
## PostgreSQL
82+
83+
Dockerfiles are placed in 'postgres' folder.
84+
85+
### Build image
86+
87+
Assuming commands are executed in context of 'postgres folder, images can be built with following commands
88+
89+
```console
90+
docker buildx build -f do-postgre-9_0 -t do-postgres:9.0 .
91+
```
92+
```console
93+
docker buildx build -f do-postgre-9_1 -t do-postgres:9.1 .
94+
```
95+
```console
96+
docker buildx build -f do-postgre-9_2 -t do-postgres:9.2 .
97+
```
98+
```console
99+
docker buildx build -f do-postgre-9_6 -t do-postgres:9.6 .
100+
```
101+
```console
102+
docker buildx build -f do-postgre-10 -t do-postgres:10.0 .
103+
```
104+
```console
105+
docker buildx build -f do-postgre-11 -t do-postgres:11.0 .
106+
```
107+
```console
108+
docker buildx build -f do-postgre-12 -t do-postgres:12.0 .
109+
```
110+
```console
111+
docker buildx build -f do-postgre-13 -t do-postgres:13.0 .
112+
```
113+
```console
114+
docker buildx build -f do-postgre-14 -t do-postgres:14.0 .
115+
```
116+
```console
117+
docker buildx build -f do-postgre-15 -t do-postgres:15.0 .
118+
```
119+
120+
121+
NOTE Images older than 9.6 are unable to update tzdata so some tests can fail due to specific way of working with offset on ```TIMESTAMP WITH TIMEZONE```.
122+
123+
124+
### Run container
125+
126+
Assuming the images are built like in examples above containers can be run like so
127+
128+
```console
129+
docker run --name postgre-9.0 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 5490:5432 -d do-postgres:9.0
130+
```
131+
```console
132+
docker run --name postgre-9.1 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 5491:5432 -d do-postgres:9.1
133+
```
134+
```console
135+
docker run --name postgre-9.2 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 5492:5432 -d do-postgres:9.2
136+
```
137+
```console
138+
docker run --name postgre-9.6 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 5496:5432 -d do-postgres:9.6
139+
```
140+
```console
141+
docker run --name postgre-10 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 54100:5432 -d do-postgres:10.0
142+
```
143+
```console
144+
docker run --name postgre-11 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 54110:5432 -d do-postgres:11.0
145+
```
146+
```console
147+
docker run --name postgre-12 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 54120:5432 -d do-postgres:12.0
148+
```
149+
```console
150+
docker run --name postgre-13 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 54130:5432 -d do-postgres:13.0
151+
```
152+
```console
153+
docker run --name postgre-14 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 54140:5432 -d do-postgres:14.0
154+
```
155+
```console
156+
docker run --name postgre-15 -e POSTGRES_PASSWORD=<your password> -e POSTGRES_HOST_AUTH_METHOD=md5 -e TZ=<timezone of host> -p 54150:5432 -d do-postgres:15.0
157+
```
158+
159+
160+
Here,
161+
162+
``` --name postgre-15``` - name of the container
163+
164+
```-e POSTGRES_PASSWORD=<your password>``` - superuser password, required by base image.
165+
166+
```-e POSTGRES_HOST_AUTH_METHOD=md5``` - option that controlls 'auth-method'. For test purposes 'md5' ok.
167+
168+
```-e TZ=<timezone of host>``` - Some of tests still assume that test runner and storage insance are in the same timezone. If you run and test locally on your machine, set it to host timezone, otherwise false falling tests appear.
169+
170+
```-p 54150:5432``` - host-to-container port mappings. If serveral containers are run on the same host they require to have different ports. We use following pattern - first two digits of standard port (5432) and PostgreSQL version after that e.g. 150 for 15.0, 96 for 9.6.
171+
172+
173+
During first run of container database structure and users will be created. By default it creates 'dotest' user, 'dotest' database with several schemas within.
174+
We intentionally don't use superuser as owner of database and user for connections, if you change superuser name by using ```POSTGRES_USER``` variable, don't name it 'dotest', otherwise conflict will occur.
175+
176+
177+
More information about standard options [on official image page on docker hub](https://hub.docker.com/_/postgres)
178+
179+
180+
### Connect to instance in docker
181+
182+
To access an instance run in docker use host name and the port you have mapped container to. If we have docker on the same "WILLY" host then connection strings may look like:
183+
184+
```
185+
HOST=WILLY;PORT=5490;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest;
186+
```
187+
```
188+
HOST=WILLY;PORT=5496;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest;
189+
```
190+
```
191+
HOST=WILLY;PORT=54120;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest;
192+
```
193+
```
194+
"HOST=WILLY;PORT=54150;DATABASE=dotest;USER ID=dotest;PASSWORD=dotest;
195+
```
196+
197+
for containers postgre-9.0, postgre-9.6, postgre-12, postgre-15 respectively, you get the idea.
198+
199+
200+
# MySQL
201+
202+
Dockerfiles are located in 'mysql' folder.
203+
204+
### Build image
205+
206+
Assuming commands are executed in context of 'mysql' folder, images can be built with following commands
207+
208+
209+
```console
210+
docker buildx build -f do-mysq-5_5 -t do-mysql:5.5 .
211+
```
212+
```console
213+
docker buildx build -f do-mysq-5_6 -t do-mysql:5.6 .
214+
```
215+
```console
216+
docker buildx build -f do-mysq-5_7 -t do-mysql:5.7 .
217+
```
218+
```console
219+
docker buildx build -f do-mysq-8_0 -t do-mysql:8.0 .
220+
```
221+
222+
223+
### Run container
224+
225+
226+
```console
227+
docker run --name mysql-5.5 -p 3355:3306 -e MYSQL_ROOT_PASSWORD=<your password> -e MYSQL_DATABASE=dotest -e MYSQL_USER=dotest -e MYSQL_PASSWORD=dotest -d do-mysql:5.5
228+
```
229+
```console
230+
docker run --name mysql-5.6 -p 3356:3306 -e MYSQL_ROOT_PASSWORD=<your password> -e MYSQL_DATABASE=dotest -e MYSQL_USER=dotest -e MYSQL_PASSWORD=dotest -d do-mysql:5.6
231+
```
232+
```console
233+
docker run --name mysql-5.7 -p 3357:3306 -e MYSQL_ROOT_PASSWORD=<your password> -e MYSQL_DATABASE=dotest -e MYSQL_USER=dotest -e MYSQL_PASSWORD=dotest -d do-mysql:5.7
234+
```
235+
```console
236+
docker run --name mysql-8.0 -p 3380:3306 -e MYSQL_ROOT_PASSWORD=<your password> -e MYSQL_DATABASE=dotest -e MYSQL_USER=dotest -e MYSQL_PASSWORD=dotest -d do-mysql:8.0
237+
```
238+
239+
Here,
240+
241+
``` --name mysql-8.0``` - name of container, can be changed, affects nothing
242+
243+
``` -p 3380:3306``` - host-to-container port mapping. We use following pattern - two first digits from default port (3306) folowed by version of MySQL e.g. 55 for MySQL 5.5, 80 for MySQL.
244+
245+
``` -e MYSQL_ROOT_PASSWORD=<your password>``` - root password, required by base image.
246+
247+
``` -e MYSQL_DATABASE=dotest``` - database name to be created, can be changed (don't forget to change connection string) or omitted (initialization script will create 'dotest' database).
248+
249+
``` -e MYSQL_USER=dotest```- user name to be created for connections, can be changed (don't forget to change connection string) or omitted (initialization script will create 'dotest' user with 'dotest' password).
250+
251+
``` -e MYSQL_PASSWORD=dotest``` - password, required if MYSQL_USER is defined.
252+
253+
More information about standard options [on official image page on docker hub](https://hub.docker.com/_/mysql)
254+
255+
256+
257+
### Connect to instance in docker
258+
259+
To access an instance run in docker use host name and port you have mapped container to. If we have docker on the same "WILLY" host then connection strings may look like:
260+
261+
```
262+
Server=WILLY;Port=3355;Database=dotest;Uid=dotest;Pwd=dotest;Default Command Timeout=120;
263+
```
264+
```
265+
Server=WILLY;Port=3356;Database=dotest;Uid=dotest;Pwd=dotest;Default Command Timeout=120;
266+
```
267+
```
268+
Server=WILLY;Port=3357;Database=dotest;Uid=dotest;Pwd=dotest;Default Command Timeout=120;
269+
```
270+
```
271+
Server=WILLY;Port=3380;Database=dotest;Uid=dotest;Pwd=dotest;Default Command Timeout=120;
272+
```
273+
274+
275+
# Firebird
276+
277+
Dockerfiles are located in 'firebird' folder.
278+
279+
### Build image
280+
281+
Assuming commands are executed in context of 'firebird' folder, image can be built with following commands
282+
283+
284+
```console
285+
docker buildx build -f do-firebird-3_0 -t do-firebird:3.0 .
286+
```
287+
288+
289+
### Run container
290+
291+
Assuming the image is built like in the example above container can be run like so
292+
293+
294+
```console
295+
docker run --name firebird-3 -p 3053:3050 -e FIREBIRD_ROOT_PASSWORD=<your password> -e FIREBIRD_USER=dotest -e FIREBIRD_PASSWORD=dotest -e FIREBIRD_DATABASE=DOTEST.fdb -e FIREBIRD_DATABASE_PAGE_SIZE=8192 -d do-firebird:3.0
296+
```
297+
298+
Here,
299+
300+
```--name firebird-3``` - name of contaner, you can choose different name, it doesn't really matter.
301+
302+
```-e FIREBIRD_ROOT_PASSWORD=<your password>``` - root user password.
303+
304+
```-e FIREBIRD_USER=dotest``` - user for connections, can be changed.
305+
306+
```-e FIREBIRD_PASSWORD=dotest``` - user password. Required when user defined.
307+
308+
```-e FIREBIRD_DATABASE=DOTEST.fdb``` - database file name to create.
309+
310+
``` -e FIREBIRD_DATABASE_PAGE_SIZE=8192``` - page size for database.
311+
312+
```-p 3053:3050``` - host-to-container port mapping. We use following pattern - first three digits of standard port (3050) and major version of Firebird.
313+
314+
Pair ```FIREBIRD_USER``` / ```FIREBIRD_PASSWORD``` can be omitted, in this case initialization script will handle it and create 'dotest' user with 'dotest' password.
315+
316+
More information about standard options [on official image page on docker hub](https://hub.docker.com/r/firebirdsql/firebird)
317+
318+
319+
### Connect to instance in docker
320+
321+
To access an instance run in docker use host name and port you have mapped container to. If we have docker on the same "WILLY" host then connection string may look like:
322+
323+
```
324+
User=dotest;Password=dotest;Database=dotest;DataSource=WILLY;Port=3053;Dialect=3;Charset=UTF8;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;Packet Size=8192;ServerType=0
325+
```
326+
327+
If you changed user/password for connections then don't forget to update it in connection string.
328+
329+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM firebirdsql/firebird:3.0.10
2+
3+
COPY init-firebird-instance.sh /docker-entrypoint-initdb.d/
4+
5+
RUN chmod +x /docker-entrypoint-initdb.d/init-firebird-instance.sh
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
set -u
4+
5+
echo "Register aliases with default settings for databasees"
6+
7+
/opt/firebird/bin/registerDatabase.sh "DOTEST.fdb" "$FIREBIRD_DATABASE"
8+
echo "Alias DOTEST.fdb => $FIREBIRD_DATABASE registered"
9+
10+
/opt/firebird/bin/registerDatabase.sh "dotest" "$FIREBIRD_DATABASE"
11+
echo "Alias dotest => $FIREBIRD_DATABASE registered"

0 commit comments

Comments
 (0)