Improve docker entry point script.

Change default port to 6379.
Log data directory path.
This commit is contained in:
Roman Gershman 2022-04-08 08:54:53 +03:00
parent 49781e8daf
commit d2b6907f2d
3 changed files with 29 additions and 14 deletions

View file

@ -37,7 +37,7 @@ extern "C" {
// TODO: to move to absl flags and keep legacy flags only for glog library.
// absl flags allow parsing of custom types and allow specifying which flags appear
// for helpshort.
DEFINE_uint32(port, 6380, "Redis port");
DEFINE_uint32(port, 6379, "Redis port");
DEFINE_uint32(memcache_port, 0, "Memcached port");
DECLARE_string(requirepass);
DEFINE_uint64(maxmemory, 0, "Limit on maximum-memory that is used by the database");
@ -997,18 +997,20 @@ void Service::RegisterCommands() {
server_family_.Register(&registry_);
LOG(INFO) << "Multi-key commands are: ";
registry_.Traverse([](std::string_view key, const CI& cid) {
if (cid.is_multi_key()) {
string key_len;
if (cid.last_key_pos() < 0)
key_len = "unlimited";
else
key_len = absl::StrCat(cid.last_key_pos() - cid.first_key_pos() + 1);
LOG(INFO) << " " << key << ": with " << key_len << " keys";
}
});
if (VLOG_IS_ON(1)) {
LOG(INFO) << "Multi-key commands are: ";
registry_.Traverse([](std::string_view key, const CI& cid) {
if (cid.is_multi_key()) {
string key_len;
if (cid.last_key_pos() < 0)
key_len = "unlimited";
else
key_len = absl::StrCat(cid.last_key_pos() - cid.first_key_pos() + 1);
LOG(INFO) << " " << key << ": with " << key_len << " keys";
}
});
}
}
} // namespace dfly

View file

@ -103,6 +103,18 @@ void ServerFamily::Init(util::AcceptServer* acceptor) {
};
task_10ms_ = pb_task_->AwaitBrief([&] { return pb_task_->AddPeriodic(10, cache_cb); });
fs::path data_path = fs::current_path();
if (!FLAGS_dir.empty()) {
data_path = FLAGS_dir;
error_code ec;
data_path = fs::canonical(data_path, ec);
}
LOG(INFO) << "Data directory is " << data_path;
}
void ServerFamily::Shutdown() {

View file

@ -2,9 +2,10 @@
set -e
# first arg is `--some-option`
# first arg is `-some-option`
if [ "${1#-}" != "$1" ]; then
set -- dragonfly "$@"
# override arguments by prepending "dragonfly --logtostderr" to them.
set -- dragonfly --logtostderr "$@"
fi
# allow the docker container to be started with `--user`