Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Register
Sign in
Toggle navigation
Menu
Николай Степанов
2023_1_DDT
Commits
08ebe2db
Commit
08ebe2db
authored
1 year ago
by
Denis
Browse files
Options
Download
Patches
Plain Diff
change docker-compose
parent
29a66421
service_fix
dev
2 merge requests
!24
MVP+
,
!18
RK: MVP
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
docker-compose.yml
+22
-11
docker-compose.yml
server/internal/dbManager/src/dbConnection.cpp
+1
-1
server/internal/dbManager/src/dbConnection.cpp
server/internal/dbManager/src/dbManager.cpp
+1
-1
server/internal/dbManager/src/dbManager.cpp
server/internal/httpServer/main.cpp
+3
-1
server/internal/httpServer/main.cpp
server/internal/httpServer/src/Router.cpp
+1
-1
server/internal/httpServer/src/Router.cpp
with
28 additions
and
15 deletions
+28
-15
docker-compose.yml
+
22
−
11
View file @
08ebe2db
...
@@ -4,27 +4,38 @@ volumes:
...
@@ -4,27 +4,38 @@ volumes:
database-volume
:
database-volume
:
services
:
services
:
postgres
:
db
:
image
:
postgres
container_name
:
db
restart
:
always
build
:
build
:
context
:
./Docker
context
:
./Docker
dockerfile
:
db.Dockerfile
dockerfile
:
db.Dockerfile
restart
:
always
image
:
postgres
environment
:
environment
:
POSTGRES_DB
:
"
tmp"
POSTGRES_DB
:
"
temp"
POSTGRES_USER
:
"
tmp"
POSTGRES_USER
:
"
temp"
POSTGRES_PASSWORD
:
"
tmp"
POSTGRES_PASSWORD
:
"
temp"
volumes
:
-
database-volume:/var/lib/postgresql/data
ports
:
ports
:
-
"
5432:5432"
-
"
5432:5432"
volume
s
:
network
s
:
-
d
atabase-volume:/var/lib/postgresql/data
-
d
b-network
server
:
server
:
image
:
raiden454/cpp-app:latest
image
:
raiden454/cpp-app:latest
networks
:
-
db-network
volumes
:
volumes
:
-
.:/project
-
.:/project
command
:
make server-run
command
:
make server-run
restart
:
always
ports
:
ports
:
-
"
808
1
:808
1
"
-
"
808
0
:808
0
"
depends_on
:
depends_on
:
-
postgres
-
db
links
:
-
db:db
networks
:
db-network
:
driver
:
bridge
name
:
db_network
This diff is collapsed.
Click to expand it.
server/internal/dbManager/src/dbConnection.cpp
+
1
−
1
View file @
08ebe2db
...
@@ -14,7 +14,7 @@ std::shared_ptr<pqxx::connection> dbConnection::connection() const {
...
@@ -14,7 +14,7 @@ std::shared_ptr<pqxx::connection> dbConnection::connection() const {
}
}
void
dbConnection
::
establish_connection
()
{
void
dbConnection
::
establish_connection
()
{
pqxx
::
connection
c
(
"dbname =mydb"
"user =
postgres
password =
root
hostaddr =
127.0.0.1
port = 5432"
);
pqxx
::
connection
c
(
"dbname =mydb"
"user =
temp
password =
temp
hostaddr =
db
port = 5432"
);
m_connection
.
reset
(
&
c
);
m_connection
.
reset
(
&
c
);
}
}
This diff is collapsed.
Click to expand it.
server/internal/dbManager/src/dbManager.cpp
+
1
−
1
View file @
08ebe2db
...
@@ -11,7 +11,7 @@ void dbManager::createPool() {
...
@@ -11,7 +11,7 @@ void dbManager::createPool() {
for
(
auto
i
=
0
;
i
<
POOL_SIZE
;
i
++
)
{
for
(
auto
i
=
0
;
i
<
POOL_SIZE
;
i
++
)
{
connection_pool
.
emplace
(
std
::
make_shared
<
pqxx
::
connection
>
(
connection_pool
.
emplace
(
std
::
make_shared
<
pqxx
::
connection
>
(
"dbname =mydb user =
postgres
password =
root
hostaddr =
172.28.224.1
port = 5432"
));
"dbname =mydb user =
temp
password =
temp
hostaddr =
db
port = 5432"
));
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
server/internal/httpServer/main.cpp
+
3
−
1
View file @
08ebe2db
...
@@ -19,13 +19,15 @@ int main(int argc, char* argv[])
...
@@ -19,13 +19,15 @@ int main(int argc, char* argv[])
// return EXIT_FAILURE;
// return EXIT_FAILURE;
// }
// }
std
::
cout
<<
"SERVER RUN"
<<
std
::
endl
;
std
::
cout
<<
"SERVER RUN
12
"
<<
std
::
endl
;
auto
const
address
=
net
::
ip
::
make_address
(
"0.0.0.0"
);
auto
const
address
=
net
::
ip
::
make_address
(
"0.0.0.0"
);
auto
const
port
=
static_cast
<
unsigned
short
>
(
std
::
atoi
(
"8080"
));
auto
const
port
=
static_cast
<
unsigned
short
>
(
std
::
atoi
(
"8080"
));
auto
const
doc_root
=
std
::
make_shared
<
std
::
string
>
(
"."
);
auto
const
doc_root
=
std
::
make_shared
<
std
::
string
>
(
"."
);
auto
const
threads
=
std
::
max
<
int
>
(
1
,
std
::
atoi
(
"1"
));
auto
const
threads
=
std
::
max
<
int
>
(
1
,
std
::
atoi
(
"1"
));
std
::
cout
<<
"SERVER INIT"
<<
std
::
endl
;
// The io_context is required for all I/O
// The io_context is required for all I/O
net
::
io_context
ioc
{
threads
};
net
::
io_context
ioc
{
threads
};
...
...
This diff is collapsed.
Click to expand it.
server/internal/httpServer/src/Router.cpp
+
1
−
1
View file @
08ebe2db
...
@@ -13,7 +13,7 @@ Router::Router(std::string_view doc_root_) :
...
@@ -13,7 +13,7 @@ Router::Router(std::string_view doc_root_) :
http
::
message_generator
Router
::
handleRequest
(
http
::
request
<
http
::
string_body
>
&&
req
)
{
http
::
message_generator
Router
::
handleRequest
(
http
::
request
<
http
::
string_body
>
&&
req
)
{
std
::
cout
<<
req
<<
std
::
endl
;
if
(
req
.
method
()
!=
http
::
verb
::
get
&&
req
.
method
()
!=
http
::
verb
::
post
)
if
(
req
.
method
()
!=
http
::
verb
::
get
&&
req
.
method
()
!=
http
::
verb
::
post
)
return
getBadRequest
(
req
,
"Unknown HTTP-method"
);
return
getBadRequest
(
req
,
"Unknown HTTP-method"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets