diff --git a/docker/dpkg/Dockerfile b/docker/dpkg/Dockerfile index 9dadd3df..4f24e1cc 100644 --- a/docker/dpkg/Dockerfile +++ b/docker/dpkg/Dockerfile @@ -17,7 +17,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libpam0g-dev \ debhelper debootstrap devscripts make equivs \ libssl-dev vim valgrind cmake \ - locales + locales; \ + apt-get clean autoclean; \ + apt-get autoremove --yes; \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ RUN mkdir -p /pdbuild && mkdir -p /pgbin && mv /root/odys/tmp /pdbuild diff --git a/docker/dpkg/entrypoint.sh b/docker/dpkg/entrypoint.sh index 2175f496..a8175c0c 100755 --- a/docker/dpkg/entrypoint.sh +++ b/docker/dpkg/entrypoint.sh @@ -4,7 +4,7 @@ set -ex export DEBIAN_FRONTEND=noninteractive export TZ=Europe/Moskow -sudo bash -c "echo $TZ > /etc/timezone" +echo $TZ >/etc/timezone /root/odys/docker/dpkg/tzdata.sh @@ -12,12 +12,11 @@ sudo bash -c "echo $TZ > /etc/timezone" #====================================================================================================================================== cd /pdbuild/tmp -mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control +mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control ./configure --prefix=/pgbin && make -j12 && make install -j12 #====================================================================================================================================== - #compile odyssey (Scalable postgresql connection pooler) cd /root/odys @@ -29,7 +28,7 @@ VERSION=$VERSION BUILD_NUMBER=$BUILD_NUMBER timeout 300 cmake -S -DBUILD_DEBIAN= #====================================================================================================================================== -mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control +mk-build-deps --build-dep --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control dpkg-buildpackage -us -uc diff --git a/docker/ldap/test_ldap.sh b/docker/ldap/test_ldap.sh index 31b8795f..4054e436 100755 --- a/docker/ldap/test_ldap.sh +++ b/docker/ldap/test_ldap.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x ldapadd -x -H ldap://192.168.233.16 -D "cn=admin,dc=example,dc=org" -wadmin -f /ldap/usr1.ldif # wait for ldap server to do smt @@ -9,28 +9,28 @@ sleep 1 /usr/bin/odyssey /ldap/odyssey.conf -PGPASSWORD=lolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db > /dev/null 2>&1 || { +PGPASSWORD=lolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db >/dev/null 2>&1 || { echo "error: failed to successfully auth with correct password" ody-stop cat /var/log/odyssey.log exit 1 } -PGPASSWORD=notlolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db > /dev/null 2>&1 && { +PGPASSWORD=notlolol psql -h localhost -p 6432 -U user1 -c "select 1" ldap_db >/dev/null 2>&1 && { echo "error: successfully auth with incorrect password" ody-stop cat /var/log/odyssey.log exit 1 } -PGPASSWORD=default psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db > /dev/null 2>&1 && { +PGPASSWORD=default psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db >/dev/null 2>&1 && { echo "error: failed to successfully auth with correct password as default user" ody-stop cat /var/log/odyssey.log exit 1 } -PGPASSWORD=notdefault psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db > /dev/null 2>&1 && { +PGPASSWORD=notdefault psql -h localhost -p 6432 -U user3 -c "select 1" ldap_db >/dev/null 2>&1 && { echo "error: successfully auth with incorrect password as default user" ody-stop cat /var/log/odyssey.log diff --git a/docker/scram/test_scram.sh b/docker/scram/test_scram.sh index 6b59d1ab..4f08e746 100755 --- a/docker/scram/test_scram.sh +++ b/docker/scram/test_scram.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x /usr/bin/odyssey /scram/config.conf diff --git a/docker/scram/test_scram_backend.sh b/docker/scram/test_scram_backend.sh index 2a94027c..f3221701 100755 --- a/docker/scram/test_scram_backend.sh +++ b/docker/scram/test_scram_backend.sh @@ -1,26 +1,27 @@ +#!/bin/bash -x -psql -h localhost -p 6432 -U backend_auth_with_incorrect_password -c "SELECT 1" scram_db > /dev/null 2>&1 && { +psql -h localhost -p 6432 -U backend_auth_with_incorrect_password -c "SELECT 1" scram_db >/dev/null 2>&1 && { echo "ERROR: successfully backend auth with incorrect password" - + cat /var/log/odyssey.log echo " - - + + " cat /var/log/postgresql/postgresql-14-main.log - + exit 1 } -psql -h localhost -p 6432 -U backend_auth_with_correct_password -c "SELECT 1" scram_db > /dev/null 2>&1 || { +psql -h localhost -p 6432 -U backend_auth_with_correct_password -c "SELECT 1" scram_db >/dev/null 2>&1 || { echo "ERROR: failed backend auth with correct password" - + cat /var/log/odyssey.log echo " - - + + " cat /var/log/postgresql/postgresql-14-main.log - + exit 1 } diff --git a/docker/scram/test_scram_frontend.sh b/docker/scram/test_scram_frontend.sh index 310a3893..9de9f939 100755 --- a/docker/scram/test_scram_frontend.sh +++ b/docker/scram/test_scram_frontend.sh @@ -1,23 +1,24 @@ +#!/bin/bash -x -PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db > /dev/null 2>&1 && { +PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db >/dev/null 2>&1 && { echo "ERROR: successfully auth with incorrect password and plain password in config" ody-stop exit 1 } -PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db > /dev/null 2>&1 || { +PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_plain -c "SELECT 1" scram_db >/dev/null 2>&1 || { echo "ERROR: failed auth with correct password and plain password in config" ody-stop exit 1 } -PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db > /dev/null 2>&1 && { +PGPASSWORD=incorrect_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db >/dev/null 2>&1 && { echo "ERROR: successfully auth with incorrect password and scram secret in config" ody-stop exit 1 } -PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db > /dev/null 2>&1 || { +PGPASSWORD=correct_password psql -h localhost -p 6432 -U frontend_auth_scram_secret -c "SELECT 1" scram_db >/dev/null 2>&1 || { echo "ERROR: failed auth with correct password and scram secret in config" ody-stop exit 1 diff --git a/docker/shell-test/shell-test/log_error_rate_test.sh b/docker/shell-test/shell-test/log_error_rate_test.sh index f2f3307a..6f3fb64f 100755 --- a/docker/shell-test/shell-test/log_error_rate_test.sh +++ b/docker/shell-test/shell-test/log_error_rate_test.sh @@ -1,14 +1,13 @@ -#!/bin/bash -#kill -9 $(ps aux | grep odyssey | awk '{print $2}') +#!/bin/bash -x +#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}') sleep 1 #ody-start #./odyssey ./ody.conf -for _ in $(seq 1 4000000) -do +for _ in $(seq 1 4000000); do for __ in $(seq 1 3000); do -# psql -U user1 -d postgres -h localhost -p 6432 -c 'SELECT 1/0' & + # psql -U user1 -d postgres -h localhost -p 6432 -c 'SELECT 1/0' & psql -U user1 -d postgres -h localhost -p 6432 -c 'select pg_sleep(0.01)' & done done diff --git a/docker/shell-test/shell-test/test-ldap.sh b/docker/shell-test/shell-test/test-ldap.sh index ce320c12..27d71c84 100755 --- a/docker/shell-test/shell-test/test-ldap.sh +++ b/docker/shell-test/shell-test/test-ldap.sh @@ -1,12 +1,11 @@ -#!/bin/bash -#kill -9 $(ps aux | grep odyssey | awk '{print $2}') -for _ in $(seq 1 40) -do +#!/bin/bash -x +#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}') +for _ in $(seq 1 40); do sleep 0.1 for __ in $(seq 1 10); do - PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select 3' & - PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select pg_sleep(1)' & + PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select 3' & + PGPASSWORD=lolol psql -h localhost -p6432 -dpostgres2 -Uuser1 -c 'select pg_sleep(1)' & done done diff --git a/docker/shell-test/shell-test/test.sh b/docker/shell-test/shell-test/test.sh index ddb46fa0..7ccedc9f 100755 --- a/docker/shell-test/shell-test/test.sh +++ b/docker/shell-test/shell-test/test.sh @@ -1,28 +1,27 @@ -#!/bin/bash -#kill -9 $(ps aux | grep odyssey | awk '{print $2}') +#!/bin/bash -x +#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}') sleep 1 #ody-start ./build/sources/odyssey ./odyssey-dev.conf -for _ in $(seq 1 40) -do - sleep 0.1 +for _ in $(seq 1 40); do + sleep 0.1 - for __ in $(seq 1 10); do - psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' & - psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' & - psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' & - done + for __ in $(seq 1 10); do + psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' & + psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' & + psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' & + done - #ody-restart - ps uax | grep odys - ./build/sources/odyssey ./odyssey-dev.conf + #ody-restart + ps uax | grep odys + ./build/sources/odyssey ./odyssey-dev.conf - for __ in $(seq 1 30); do - psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' & - psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' & - psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' & - done + for __ in $(seq 1 30); do + psql -U postgres -d postgres -h localhost -p 6432 -c 'select 1' & + psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(39)' & + psql -U postgres -d postgres -h 0.0.0.0 -p 6432 -c 'select pg_sleep(1)' & + done done diff --git a/docker/shell-test/shell-test/test_sleep.sh b/docker/shell-test/shell-test/test_sleep.sh index 7c323a8d..9a0e0181 100755 --- a/docker/shell-test/shell-test/test_sleep.sh +++ b/docker/shell-test/shell-test/test_sleep.sh @@ -1,11 +1,10 @@ -#!/bin/bash -#kill -9 $(ps aux | grep odyssey | awk '{print $2}') +#!/bin/bash -x +#kill -9 $(ps aux | grep odyssey | grpe -v grep | awk '{print $2}') sleep 1 #ody-start -for i in `seq 1 100` -do +for _ in $(eq 1 100); do psql -h localhost -p 6432 -c 'select 1' -U user1 -d postgres & psql -h 0.0.0.0 -p 6432 -c 'select pg_sleep(100)' -U user1 -d postgres & done