SemenMartynov / Software-Engineering-2022

Peter the Great St. Petersburg Polytechnic University: Software Engineering course 2022
MIT License
4 stars 1 forks source link

Blockchain #295

Closed zadorotskas closed 1 year ago

zadorotskas commented 1 year ago

Student, group: Nikita Zadorotskas, 3530901/90203 URL: https://github.com/zadorotskas/Blockchain Any comments: tbd, kotlin + ktor

SemenMartynov commented 1 year ago

Прокидывать параметры таким образом -- плохая практика. Их нужно передавать через переменные окружения, чтобы были значения по умолчанию.

smart@thinkpad$ docker compose --verbose up
[+] Running 3/0
 ✔ Container node-1  Created                                                                                                                                                                                                             0.0s 
 ✔ Container node-3  Created                                                                                                                                                                                                             0.1s 
 ✔ Container node-2  Created                                                                                                                                                                                                             0.0s 
Attaching to node-1, node-2, node-3
node-2  | Value for option --nonce should be always provided in command line.
node-2  | Usage: Blockchain node options_list
node-2  | Options: 
node-2  |     --address, -a -> this node address and port (always required) { String }
node-2  |     --network, -n -> other node addresses in network (always required) { String }
node-2  |     --nonce, -nf -> function that will be used for nonce generation (always required) { String }
node-2  |     --genesis, -g [false] -> Generate genesis 
node-2  |     --help, -h -> Usage info 
node-2  | 
node-1  | Value for option --nonce should be always provided in command line.
node-3  | Value for option --nonce should be always provided in command line.
node-1  | Usage: Blockchain node options_list
node-1  | Options: 
node-1  |     --address, -a -> this node address and port (always required) { String }
node-3  | Usage: Blockchain node options_list
node-1  |     --network, -n -> other node addresses in network (always required) { String }
node-3  | Options: 
node-3  |     --address, -a -> this node address and port (always required) { String }
node-3  |     --network, -n -> other node addresses in network (always required) { String }
node-3  |     --nonce, -nf -> function that will be used for nonce generation (always required) { String }
node-3  |     --genesis, -g [false] -> Generate genesis 
node-1  |     --nonce, -nf -> function that will be used for nonce generation (always required) { String }
node-1  |     --genesis, -g [false] -> Generate genesis 
node-1  |     --help, -h -> Usage info 
node-1  | 
node-3  |     --help, -h -> Usage info 
node-3  | 
node-2 exited with code 127
node-1 exited with code 127
node-3 exited with code 127
zadorotskas commented 1 year ago

Поправил

SemenMartynov commented 1 year ago

Окей.

Есть разница между параметрами, которые используются при сборке контейнера, и при запуске. Те, что используются при сборке (в Dockerfile) могут использоваться системой сборки, к примеру, для включения/отключения какой-то отладночной информации или чего-то подобного. Нам достаточно переменные окружения передавать при запуске контейнера (в компоуз-файле) как ты и сделал.

И можно обойтись без костыля, в виде network_mode: host