Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
9c023ab
create mongodb type in sharded storage factory
ssd04 Mar 8, 2023
ed7b309
setup for mongodb cluster with nginx proxy
ssd04 Mar 9, 2023
0bd6df3
Merge branch 'mongo-db-client' into integrate-mongo-db-client
ssd04 Mar 9, 2023
a22bd9a
user create mongo db client from factory
ssd04 Mar 9, 2023
b7cd62e
timeout options for mongo client
ssd04 Mar 9, 2023
b6d60e8
added separate index handler for mongo
ssd04 Mar 10, 2023
ba6f7a7
unit tests for mongo db index handler
ssd04 Mar 10, 2023
07ab18f
small setup changes
ssd04 Mar 10, 2023
74feef9
add second tcs instance in docker compose mongo full setup
ssd04 Mar 10, 2023
2bebb92
Merge branch 'feat/mongo-db-integration' into integrate-mongo-db-client
ssd04 Mar 13, 2023
4b88671
rename sharded storage with index interface
ssd04 Mar 13, 2023
a2cdb2c
fix reference to mongo in factory
ssd04 Mar 13, 2023
0834a8a
added update with checker implementation
ssd04 Mar 13, 2023
f32a513
fix unit tests in db otp handler
ssd04 Mar 14, 2023
e9809d6
use mtest package for mongo db client unit testing
ssd04 Mar 14, 2023
49103ce
mongodb unit tests - added parallel run
ssd04 Mar 14, 2023
3ceb780
add missing err check
ssd04 Mar 14, 2023
5b336f3
bump golang version in golangci-lint github workflow
ssd04 Mar 14, 2023
8a28600
Revert "bump golang version in golangci-lint github workflow"
ssd04 Mar 14, 2023
d028bbd
go mod tidy
ssd04 Mar 14, 2023
7506de3
revert changed to dbOTPHandler
ssd04 Mar 14, 2023
18d0978
fix db client unit test
ssd04 Mar 14, 2023
a184d54
fixes after review: handlers package - renamings, adding mutex protec…
ssd04 Mar 15, 2023
68933e1
refactor mongo operations with session and transaction
ssd04 Mar 16, 2023
bf57f7c
added mongo operations for otp db handler
ssd04 Mar 20, 2023
42589f2
add run tx with retry
ssd04 Mar 20, 2023
80572d6
added integration test for mongo with in memory testing db
ssd04 Mar 20, 2023
d1a080b
exclude integration test from CI run, fix linter issue
ssd04 Mar 20, 2023
5b90ba9
fix renaming in main
ssd04 Mar 20, 2023
0be0aab
renamings, refactorings, added consts to config
ssd04 Mar 24, 2023
e7424f3
refactor to use mongodb index operations
ssd04 Mar 25, 2023
0dd72cf
add more mongodb opearation + separate index collection
ssd04 Mar 29, 2023
47139ec
Merge branch 'feat/mongo-db-integration' into integrate-mongo-db-client
ssd04 Apr 3, 2023
da23584
manual session with transaction handling
ssd04 Apr 4, 2023
0660bd0
Revert "manual session with transaction handling"
ssd04 Apr 13, 2023
7b90ea0
Merge branch 'feat/mongo-db-integration' into integrate-mongo-db-client
ssd04 Apr 13, 2023
9a9f030
remove duplicated files
ssd04 Apr 13, 2023
e5651b8
restore bucket index handler changes
ssd04 Apr 13, 2023
2e20459
cleanup unused code
ssd04 Apr 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ docker-run:
-p 8080:8080 \
--name ${container_name} \
${image}:${image_tag}
docker rm ${container_name}

docker-new: docker-build docker-run

Expand All @@ -85,6 +86,8 @@ docker-rm: docker-stop
compose_file = docker/mongodb-cluster.yml
ifeq ($(db_setup),redis)
compose_file = docker/redis-cluster.yml
else ifeq ($(db_setup),mongodb-full)
compose_file = docker/mongodb-cluster-full.yml
endif

compose-new:
Expand Down
87 changes: 87 additions & 0 deletions docker/mongodb-cluster-full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
version: '3'

services:
mongodb0:
container_name: mongodb0
image: mongo
ports:
- 27017:27017
networks:
- mongo
depends_on:
- mongodb1
- mongodb2
links:
- mongodb1
- mongodb2
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "mongoReplSet" ]

mongoinit:
image: mongo
volumes:
- ./mongodb/init.sh:/scripts/init.sh
networks:
- mongo
depends_on:
- mongodb0
links:
- mongodb0
restart: "no"
entrypoint: [ "bash", "-c", "sleep 10 && /scripts/init.sh"]

mongodb1:
container_name: mongodb1
image: mongo
ports:
- 27018:27017
networks:
- mongo
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "mongoReplSet" ]

mongodb2:
container_name: mongodb2
image: mongo
ports:
- 27019:27017
networks:
- mongo
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "mongoReplSet" ]

tcs0:
build:
context: ..
dockerfile: Dockerfile
image: multi-factor-auth:latest
ports:
- 8080:8080
networks:
- mongo

tcs1:
build:
context: ..
dockerfile: Dockerfile
image: multi-factor-auth:latest
ports:
- 8081:8080
networks:
- mongo

nginx:
image: nginx:latest
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- tcs0
- tcs1
networks:
- mongo
ports:
- 5000:5000

networks:
mongo:
driver: bridge
58 changes: 58 additions & 0 deletions docker/nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
user www-data;
worker_processes auto;
worker_rlimit_nofile 32768;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
debug_points abort;

events {
worker_connections 8192;
}

http {
real_ip_header X-Forwarded-For;
set_real_ip_from 10.0.0.0/8;
proxy_cache_path /var/cache/nginx/cache keys_zone=elasticsearch:10m inactive=60m;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;

upstream tcs {
server tcs0:8080;
server tcs1:8080;
keepalive 16;
}

server {
listen 5000;
server_name tcs_proxy;

location / {
proxy_http_version 1.1;

proxy_connect_timeout 5s;
proxy_read_timeout 10s;

client_max_body_size 100M;

proxy_pass http://tcs;

# timeout for an idle keepalive connection to an upstream server will stay open
keepalive_timeout 50s;
}
}
}
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Ky
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
Expand Down
Loading