Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ update-dockers: ## Update docker images
fi
@echo "🐳 Building nebula-database docker image. Do you want to continue (overrides existing image)? (y/n)"
@read ans; if [ "$${ans:-N}" = y ]; then \
docker build -t nebula-database -f nebula/database/Dockerfile .; \
docker build -t nebula-database -f nebula/database/adapters/postgress/docker/Dockerfile .; \
docker build -t nebula-pgweb -f nebula/database/pgweb/Dockerfile .; \
else \
echo "Skipping nebula-database docker build."; \
Expand Down
24 changes: 14 additions & 10 deletions app/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from watchdog.observers import Observer

from nebula.addons.env import check_environment
from nebula.controller.web_app_controller import TermEscapeCodeFormatter
from nebula.controller.hub import TermEscapeCodeFormatter
from nebula.controller.scenarios import ScenarioManagement
from nebula.utils import DockerUtils, FileUtils, SocketUtils

Expand Down Expand Up @@ -638,7 +638,7 @@ def __init__(self, args):
sys.exit(1)

self.controller_port = int(args.controllerport) if hasattr(args, "controllerport") else 5050
self.federation_controller_port = int(args.federationcontrollerport) if hasattr(args, "federationcontrollerport") else 5051
self.federation_controller_port = int(args.federationcontrollerport) if hasattr(args, "federationcontrollerport") else 5052
self.waf_port = int(args.wafport) if hasattr(args, "wafport") else 6000
self.frontend_port = int(args.webport) if hasattr(args, "webport") else 6060
self.grafana_port = int(args.grafanaport) if hasattr(args, "grafanaport") else 6040
Expand Down Expand Up @@ -853,7 +853,7 @@ def start(self):
# Check ports available
if not SocketUtils.is_port_open(self.controller_port):
self.controller_port = SocketUtils.find_free_port(start_port=self.controller_port)

if not SocketUtils.is_port_open(self.federation_controller_port):
self.federation_controller_port = SocketUtils.find_free_port(start_port=self.federation_controller_port)

Expand Down Expand Up @@ -1045,17 +1045,24 @@ def run_database(self):
"POSTGRES_USER": "nebula",
"POSTGRES_PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"POSTGRES_DB": "nebula",
"NEBULA_DATABASE_LOG": "/nebula/app/logs/database.log",
"DB_HOST": "localhost",
"DB_PORT": 5432,
"DB_USER": "nebula",
"DB_PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"NEBULA_ADMIN_PASSWORD": os.environ.get("NEBULA_ADMIN_PASSWORD")
}
host_sql_path = os.path.join(self.root_path, "nebula/database/init-configs.sql")
host_sql_path = os.path.join(self.root_path, "nebula/database/adapters/postgress/docker/init-configs.sql")
db_data_path = os.path.join(self.databases_dir, "postgres-data")
os.makedirs(db_data_path, exist_ok=True)

pg_host_config = client.api.create_host_config(
binds=[
f"{self.root_path}:/nebula",
f"{host_sql_path}:/docker-entrypoint-initdb.d/init-configs.sql",
f"{db_data_path}:/var/lib/postgresql/data",
],
port_bindings={5432: 5432},
port_bindings={5432: 5432, 5051: 5051},
)
pg_networking_config = client.api.create_networking_config(
{f"{network_name}": client.api.create_endpoint_config(ipv4_address=f"{base}.125")}
Expand All @@ -1068,6 +1075,7 @@ def run_database(self):
environment=pg_environment,
host_config=pg_host_config,
networking_config=pg_networking_config,
ports=[5432, 5051],
)
client.api.start(pg_container)
Deployer._add_container_to_metadata(pg_container_name)
Expand Down Expand Up @@ -1132,11 +1140,7 @@ def run_controller(self):
"NEBULA_FEDERATION_CONTROLLER_PORT" : self.federation_controller_port,
"NEBULA_CONTROLLER_HOST": self.controller_host,
"NEBULA_FRONTEND_PORT": self.frontend_port,
"DB_HOST": self.get_container_name("nebula-database"),
"DB_PORT": 5432,
"DB_USER": "nebula",
"DB_PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"NEBULA_ADMIN_PASSWORD": os.environ.get("NEBULA_ADMIN_PASSWORD")
"NEBULA_DATABASE_API_URL": f"http://{self.get_container_name('nebula-database')}:5051"
}

volumes = ["/nebula", "/var/run/docker.sock"]
Expand Down
4 changes: 2 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"-fcp",
"--federationcontrollerport",
dest="federationcontrollerport",
default=5051,
help="federation controller port port (default: 5051)",
default=5052,
help="federation controller port port (default: 5052)",
)

argparser.add_argument(
Expand Down
Loading