Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaUnisikhin committed Mar 18, 2024
1 parent 50f7070 commit cf491d8
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 1,359 deletions.
115 changes: 83 additions & 32 deletions config-examples/odyssey-dev.conf
Original file line number Diff line number Diff line change
@@ -1,53 +1,97 @@

storage "postgres_server" {
type "remote"

host "localhost"
port 5432
}

database default {
user default {
authentication "none"

storage "postgres_server"
# storage_db "db"
# storage_user "user"
# storage_password "password"

pool "session"

client_fwd_error yes
}
}
pid_file "/tmp/odyssey.pid"
daemonize yes

unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"
log_debug yes

log_to_stdout no

log_syslog no
log_syslog_ident "odyssey"
log_syslog_facility "daemon"

log_debug no
log_config yes
log_session yes
log_query yes
log_query no
log_stats yes
daemonize yes
stats_interval 60
log_general_stats_prom yes
log_route_stats_prom no
promhttp_server_port 7777

log_file "/home/nikunis/odyssey/logs.txt"
workers "auto"
resolvers 1

locks_dir "/tmp/odyssey"
graceful_die_on_errors yes
enable_online_restart no
bindwith_reuseport yes
readahead 8192

stats_interval 60
cache_coroutine 0

pid_file "/tmp/odyssey.pid"
coroutine_stack_size 16

nodelay yes

keepalive 15
keepalive_keep_interval 75
keepalive_probes 9

keepalive_usr_timeout 0

listen {
host "*"
port 6432
backlog 128
compression yes
tls "disable"
}


storage "postgres_server" {
type "remote"
host "[localhost]:5432,localhost"
port 5550
}

database default {
user default {
authentication "md5"

password "md588cb17a149f659b9a78ec4a33cbb3c7f"

storage "postgres_server"
pool "transaction"
pool_size 0

# auth_query "SELECT usename, passwd FROM pg_shadow WHERE usename=$1"
# auth_query_db "postgres"
# auth_query_user "reshke"
# storage_password "reshke"

pool_timeout 0

pool_ttl 1201

pool_discard no

pool_cancel yes

pool_rollback yes
# seconds
pool_client_idle_timeout 20
# seconds
pool_idle_in_transaction_timeout 20

client_fwd_error yes
application_name_add_host yes
server_lifetime 1901
log_debug no

quantiles "0.99,0.95,0.5"
client_max 107
}
}

storage "local" {
type "local"
Expand All @@ -61,3 +105,10 @@ database "console" {
storage "local"
}
}


locks_dir "/tmp/odyssey"

graceful_die_on_errors yes
enable_online_restart no
bindwith_reuseport yes
2 changes: 0 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ COPY ./docker/gorm /gorm

COPY ./docker/entrypoint.sh /usr/local/bin/entrypoint.sh

RUN touch ./logs.txt

RUN chmod a+x /usr/local/bin/entrypoint.sh

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
150 changes: 75 additions & 75 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -ex

# cd /test_dir/test && /usr/bin/odyssey_test
cd /test_dir/test && /usr/bin/odyssey_test

setup

Expand All @@ -11,79 +11,79 @@ ody-start
/gorm/test.sh
ody-stop

# # odyssey rule-address test
# /rule-address/test.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # odyssey target session attrs test
# /tsa/tsa.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# ody-start
# /config-validation
# ody-stop

# #ldap
# /ldap/test_ldap.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # scram
# /scram/test_scram.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # auth query
# /auth_query/test_auth_query.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# # odyssey hba test
# /hba/test.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# #prepared statements in transaction pooling
# /usr/bin/odyssey /etc/odyssey/pstmts.conf
# sleep 1
# /pstmts-test

# ody-stop

# # lag polling
# /lagpolling/test-lag.sh
# if [ $? -eq 1 ]
# then
# exit 1
# fi

# /usr/bin/odyssey-asan /etc/odyssey/odyssey.conf
# ody-stop

# # TODO: rewrite
# #/shell-test/test.sh
# /shell-test/console_role_test.sh
# /shell-test/parse_pg_options_test.sh
# /shell-test/override_pg_options_test.sh
# /shell-test/pool_size_test.sh
# ody-stop

# ody-start
# /ody-integration-test
# ody-stop
# odyssey rule-address test
/rule-address/test.sh
if [ $? -eq 1 ]
then
exit 1
fi

# odyssey target session attrs test
/tsa/tsa.sh
if [ $? -eq 1 ]
then
exit 1
fi

ody-start
/config-validation
ody-stop

#ldap
/ldap/test_ldap.sh
if [ $? -eq 1 ]
then
exit 1
fi

# scram
/scram/test_scram.sh
if [ $? -eq 1 ]
then
exit 1
fi

# auth query
/auth_query/test_auth_query.sh
if [ $? -eq 1 ]
then
exit 1
fi

# odyssey hba test
/hba/test.sh
if [ $? -eq 1 ]
then
exit 1
fi

#prepared statements in transaction pooling
/usr/bin/odyssey /etc/odyssey/pstmts.conf
sleep 1
/pstmts-test

ody-stop

# lag polling
/lagpolling/test-lag.sh
if [ $? -eq 1 ]
then
exit 1
fi

/usr/bin/odyssey-asan /etc/odyssey/odyssey.conf
ody-stop

# TODO: rewrite
#/shell-test/test.sh
/shell-test/console_role_test.sh
/shell-test/parse_pg_options_test.sh
/shell-test/override_pg_options_test.sh
/shell-test/pool_size_test.sh
ody-stop

ody-start
/ody-integration-test
ody-stop

teardown
12 changes: 5 additions & 7 deletions docker/odyssey.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ unix_socket_dir "/tmp"
unix_socket_mode "0644"

log_format "%p %t %l [%i %s] (%c) %m\n"
log_debug yes
log_debug no
log_config yes
log_session yes
log_query yes
log_session no
log_query no
log_stats yes
daemonize yes

log_file "./logs.txt"

locks_dir "/tmp/odyssey"
graceful_die_on_errors yes
enable_online_restart no
enable_online_restart yes
bindwith_reuseport yes

stats_interval 60
Expand All @@ -60,4 +58,4 @@ database "console" {
pool "session"
storage "local"
}
}
}
Loading

0 comments on commit cf491d8

Please sign in to comment.