Skip to content

Commit 9e51f50

Browse files
committed
many improvements to cli scripts
1 parent 98432d5 commit 9e51f50

File tree

18 files changed

+576
-445
lines changed

18 files changed

+576
-445
lines changed

README.md

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ NB: if you don't have a bash shell interpreter on your host computer, look at th
4747

4848
### Installation
4949

50-
./bin/stack.sh build
50+
./bin/dbstack build
5151

5252
*NB*: this will take a _long_time. Also, a fast, unmetered internet connection will help.
5353

@@ -59,25 +59,25 @@ docker/.env
5959

6060
Example: executing the sql statement `select current_date` in parallel on all databases:
6161

62-
./bin/stack.sh start
63-
./bin/stack.sh dbconsole sql:execute --sql='select current_date'
64-
./bin/stack.sh stop
62+
./bin/dbstack start
63+
./bin/dbconsole sql:execute --sql='select current_date'
64+
./bin/dbstack stop
6565

6666
A slightly longer sql snippet:
6767

68-
./bin/stack.sh dbconsole sql:execute --sql="create table persons(name varchar(255), age int); insert into persons values('significant other', 99); select name as person, age - 60 as conventional_age from persons;"
68+
./bin/dbconsole sql:execute --sql="create table persons(name varchar(255), age int); insert into persons values('significant other', 99); select name as person, age - 60 as conventional_age from persons;"
6969

7070
If you have a bigger set of SQL statements to execute than it is practical to put in a command-line, you can save them
7171
to a file and then execute it in parallel on all databases:
7272

73-
./bin/stack.sh dbconsole sql:execute --file=./shared/my_huge_script.sql
73+
./bin/dbconsole sql:execute --file=./shared/my_huge_script.sql
7474

7575
*NB*: to share files between the host computer and the container, put them in the `shared` folder.
7676

7777
*NB*: you can also execute different sql commands for each database type by saving them to separate files. The `sql:execute`
7878
command does replace some tokens in the values of the `--file` option. Eg:
7979

80-
./bin/stack.sh dbconsole sql:execute --file='./shared/test_{dbtype}.sql'
80+
./bin/dbconsole sql:execute --file='./shared/test_{dbtype}.sql'
8181

8282
will look for files `test_mariadb.sql`, `test_mssql.sql`, `test_mysql.sql`, `test_postgresql.sql`, `test_sqlite.sql`
8383

@@ -91,16 +91,20 @@ against the same data set, you have to follow a multiple-step process:
9191

9292
You can also list all available database instances and databases:
9393

94-
./bin/stack.sh dbconsole instance:list
94+
./bin/dbconsole instance:list
9595

96-
./bin/stack.sh dbconsole database:list
96+
./bin/dbconsole database:list
9797

98-
As well as test connecting to them using the standard clients:
98+
As well as connect to them using the standard command-line clients with a shortcut command:
9999

100-
./bin/stack.sh run mysql -h mysql_5_5 -u 3v4l -p -e 'select current_date'
101-
./bin/stack.sh run psql -h postgresql_9_4 -U postgres -c 'select current_date'
102-
./bin/stack.sh run sqlcmd -S mssqlserver_2019_ga -U sa -Q "select GETDATE() as 'current_date'"
103-
./bin/stack.sh run sqlite3 /home/db3v4l/data/sqlite/3.27/3v4l.sqlite 'select current_date'
100+
./bin/dbconsole database:shell --instance=mysql_5_5
101+
102+
If you want to connect to the databases using all the cli options available to the standard clients, you can do it too:
103+
104+
./bin/dbstack run mysql -h mysql_5_5 -u 3v4l -p -e 'select current_date'
105+
./bin/dbstack run psql -h postgresql_9_4 -U postgres -c 'select current_date'
106+
./bin/dbstack run sqlcmd -S mssqlserver_2019_ga -U sa -Q "select GETDATE() as 'current_date'"
107+
./bin/dbstack run sqlite3 /home/db3v4l/data/sqlite/3.27/3v4l.sqlite 'select current_date'
104108

105109
The default password for those commands is '3v4l' for all databases except ms sql server, for which it is 3v4l3V4L.
106110

@@ -110,29 +114,29 @@ your browser is executing).
110114

111115
Last but not least, you have access to other command-line tools which can be useful in troubleshooting SQL queries:
112116

113-
./bin/stack.sh run ./app/vendor/bin/highlight-query 'and now'
114-
./bin/stack.sh run ./app/vendor/bin/lint-query 'for something'
115-
./bin/stack.sh run ./app/vendor/bin/tokenize-query 'completely different'
117+
./bin/dbstack run ./app/vendor/bin/highlight-query 'and now'
118+
./bin/dbstack run ./app/vendor/bin/lint-query 'for something'
119+
./bin/dbstack run ./app/vendor/bin/tokenize-query 'completely different'
116120

117121
Or you can just log in to the container where all the command-line tools are, and execute any command you like from there
118122

119-
./bin/stack.sh shell
123+
./bin/dbstack shell
120124
php bin/console --help
121125

122126

123127
## Details
124128

125129
### Troubleshooting
126130

127-
After starting the containers via `./bin/stack.sh build`, you can:
131+
After starting the containers via `./bin/dbstack build`, you can:
128132

129-
- check if they are all running: `./bin/stack.sh ps`
130-
- check if they all bootstrapped correctly: `./bin/stack.sh logs`
131-
- check if a specific container bootstrapped correctly, eg: `./bin/stack.sh logs worker`
133+
- check if they are all running: `./bin/dbstack ps`
134+
- check if they all bootstrapped correctly: `./bin/dbstack logs`
135+
- check if a specific container bootstrapped correctly, eg: `./bin/dbstack logs worker`
132136
- check the processes running in one container, eg: `docker exec -ti db3v4l_postgresql_9_4 ps aux`
133137

134-
*NB*: if the `stack.sh` command fails, you can use `docker` and `docker-compose` commands for troubleshooting.
135-
See the section 'Alternative commands to stack.sh' below for examples.
138+
*NB*: if the `dbstack` command fails, you can use `docker` and `docker-compose` commands for troubleshooting.
139+
See the section 'Alternative commands to dbstack' below for examples.
136140

137141
### Maintenance
138142

@@ -176,18 +180,18 @@ More details about advanced use cases are given in the section below.
176180
See the separate [FAQ](./doc/FAQ.md) document.
177181

178182

179-
## Alternative commands to stack.sh
183+
## Alternative commands to dbstack and dbconsole
180184

181-
The `stack.sh` command requires a working bash shell interpreter as well as a few, common unix command-line tools.
182-
In case those are not available on your platform (eg. if you are running DB-3v4l on Windows), or if `stack.sh` fails
185+
The `dbstack` and `dbconsole` commands require a working bash shell interpreter as well as a few, common unix command-line tools.
186+
In case those are not available on your platform (eg. if you are running DB-3v4l on Windows), or if `dbstack` fails
183187
you can run alternative commands, as detailed here:
184188

185-
./bin/stack.sh build => cd docker && touch containers.env.local && docker-compose build
186-
./bin/stack.sh start => cd docker && docker-compose up -d
187-
./bin/stack.sh shell => docker exec -ti db3v4l_worker su - db3v4l
188-
./bin/stack.sh stop => cd docker && docker-compose stop
189+
./bin/dbstack build => cd docker && touch containers.env.local && docker-compose build
190+
./bin/dbstack start => cd docker && docker-compose up -d
191+
./bin/dbstack shell => docker exec -ti db3v4l_worker su - db3v4l
192+
./bin/dbstack stop => cd docker && docker-compose stop
189193

190-
./bin/stack.sh dbconsole ... =>
194+
./bin/dbconsole ... =>
191195
docker exec -ti db3v4l_worker su - db3v4l
192196
php bin/dbconsole ...
193197

0 commit comments

Comments
 (0)