Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8a7f650

Browse filesBrowse files
committed
Improve _cleanup; Add 2.logical_generic
1 parent 3880dc3 commit 8a7f650
Copy full SHA for 8a7f650

File tree

4 files changed

+50
-3
lines changed
Filter options

4 files changed

+50
-3
lines changed

‎test/1.synthetic.sh

Copy file name to clipboardExpand all lines: test/1.synthetic.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ sudo docker rm dblab_pg_initdb
3636
### Step ?. Configure and launch the Database Lab server
3737
mkdir -p ~/.dblab
3838
cp ./configs/config.example.physical_generic.yml ~/.dblab/server_test.yml
39-
sed -ri 's/^(\s*)(port:.*$)/\1port: 12345/' ~/.dblab/server_test.yml
39+
sed -ri 's/^(\s*)(port: 2345$)/\1port: 12345/' ~/.dblab/server_test.yml
4040
sed -ri 's/^(\s*)(debug:.*$)/\1debug: true/' ~/.dblab/server_test.yml
4141
sed -ri 's/^(\s*)(pool:.*$)/\1pool: "test_pool"/' ~/.dblab/server_test.yml
4242
sed -ri 's/^(\s*)(pool:.*$)/\1pool: "test_pool"/' ~/.dblab/server_test.yml

‎test/2.logical_generic.sh

Copy file name to clipboard
+42Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
set -euxo pipefail
3+
4+
DIR=${0%/*}
5+
IMAGE2TEST="registry.gitlab.com/postgres-ai/database-lab/dblab-server:master"
6+
SOURCE_DBNAME="test"
7+
SOURCE_HOST="XXX"
8+
SOURCE_PASSWORD="XXX"
9+
10+
### Step 1: Prepare a machine with two disks, Docker and ZFS
11+
12+
source "${DIR}/_prerequisites.ubuntu.sh"
13+
source "${DIR}/_zfs.file.sh"
14+
15+
### Step 2. Prepare database data directory
16+
17+
### Step ?. Configure and launch the Database Lab server
18+
mkdir -p ~/.dblab
19+
cp ./configs/config.example.logical_generic.yml ~/.dblab/server_test.yml
20+
sed -ri 's/^(\s\s)(port:.*$)/\1port: 12345/' ~/.dblab/server_test.yml
21+
sed -ri 's/^(\s*)(debug:.*$)/\1debug: true/' ~/.dblab/server_test.yml
22+
sed -ri 's/^(\s*)(pool:.*$)/\1pool: "test_pool"/' ~/.dblab/server_test.yml
23+
sed -ri "s/^(\s*)(host: 34\.56\.78\.90$)/\1host: \"${SOURCE_HOST}\"/" ~/.dblab/server_test.yml
24+
sed -ri "s/^(\s*)(dbname:.*$)/\1dbname: \"${SOURCE_DBNAME}\"/" ~/.dblab/server_test.yml
25+
sed -ri "s/^(\s*)(password:.*$)/\1password: \"${SOURCE_PASSWORD}\"/" ~/.dblab/server_test.yml
26+
sed -ri "s/^(\s*)(parallelJobs:.*$)/\1parallelJobs: 1/" ~/.dblab/server_test.yml
27+
sed -ri "s/^(\s*)(forceInit:.*$)/\1forceInit: true/" ~/.dblab/server_test.yml
28+
29+
# TMP: turn off "initialize" completely
30+
31+
sudo docker run \
32+
--detach \
33+
--name dblab_test \
34+
--label dblab_control \
35+
--privileged \
36+
--publish 12345:12345 \
37+
--volume /var/run/docker.sock:/var/run/docker.sock \
38+
--volume /var/lib/dblab/data:/var/lib/dblab/data:rshared \
39+
--volume ~/.dblab/server_test.yml:/home/dblab/configs/config.yml \
40+
"${IMAGE2TEST}"
41+
42+
### Step ?. Setup Database Lab client CLI

‎test/_cleanup.sh

Copy file name to clipboardExpand all lines: test/_cleanup.sh
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ set -euxo pipefail
33

44
ZFS_FILE="$(pwd)/zfs_file"
55

6-
sudo docker rm -f dblab_pg_initdb || true
6+
# TODO: docker rm for all containers that are related to dblab
7+
sudo docker ps --filter 'label=dblab_control' \
8+
| grep -v CONTAINER \
9+
| awk '{print $1}' \
10+
| sudo xargs --no-run-if-empty docker rm -f \
11+
|| true
712
sudo zpool destroy test_pool || true
813
sudo umount /var/lib/dblab/data || true
914
sudo rm -f "${ZFS_FILE}"

‎test/_prerequisites.ubuntu.sh

Copy file name to clipboardExpand all lines: test/_prerequisites.ubuntu.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ docker --version || sudo apt-get update && sudo apt-get install -y \
2020
docker-ce \
2121
docker-ce-cli \
2222
containerd.io \
23-
zfsutils-linux
23+
zfsutils-linux

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.