From f1aa8eb8d98ed0b3e9bd63dca4f5b3eddc0bb541 Mon Sep 17 00:00:00 2001 From: zhravan Date: Wed, 10 Sep 2025 15:21:47 +0530 Subject: [PATCH 01/17] test From 60d248b73611f3475462b170b87eaaf4649cb456 Mon Sep 17 00:00:00 2001 From: zhravan Date: Wed, 10 Sep 2025 15:22:52 +0530 Subject: [PATCH 02/17] test From c4e969f1808f0ad6d0a067df3d36b850e1262e85 Mon Sep 17 00:00:00 2001 From: zhravan Date: Wed, 10 Sep 2025 15:23:31 +0530 Subject: [PATCH 03/17] test From 15e4005cd9e060856e35ef3bb947a6f3e8b44f64 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 00:25:24 +0530 Subject: [PATCH 04/17] hotfix(view): AppInfo Env naming for client side config --- view/app/config/appInfo.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/app/config/appInfo.ts b/view/app/config/appInfo.ts index 2b5abdb01..1146046d7 100644 --- a/view/app/config/appInfo.ts +++ b/view/app/config/appInfo.ts @@ -1,8 +1,8 @@ export const appInfo = { // learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo appName: 'Nixopus', - apiDomain: process.env.API_URL?.replace('/api', '') || 'http://localhost:8080', - websiteDomain: process.env.WEBSITE_DOMAIN || 'http://localhost:3000', + apiDomain: process.env.NEXT_PUBLIC_API_URL?.replace('/api', ''), + websiteDomain: process.env.NEXT_PUBLIC_WEBSITE_DOMAIN || 'http://localhost:3000', apiBasePath: '/auth', websiteBasePath: '/auth' }; From c68f0febf0d66900b75769c8068d1d3bc0557171 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 00:34:52 +0530 Subject: [PATCH 05/17] hotfix(api): add env for SuperTokens dep --- cli/app/commands/install/run.py | 16 +++++++++++----- cli/pyproject.toml | 2 +- helpers/config.prod.yaml | 2 ++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index 8de3af578..0d9ac3558 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -114,7 +114,7 @@ def __init__( self.main_task = None self._validate_domains() self._validate_repo() - + # Log when using custom repository/branch and staging compose file if self._is_custom_repo_or_branch(): if self.logger: @@ -126,13 +126,13 @@ def _get_config(self, key: str): return self.repo if key == "branch_name" and self.branch is not None: return self.branch - + # Override compose_file_path to use docker-compose-staging.yml when custom repo/branch is provided if key == "compose_file_path" and self._is_custom_repo_or_branch(): # Get the base directory and replace docker-compose.yml with docker-compose-staging.yml default_compose_path = _config.get_config_value(key, self._user_config, DEFAULTS) return default_compose_path.replace("docker-compose.yml", "docker-compose-staging.yml") - + try: return _config.get_config_value(key, self._user_config, DEFAULTS) except ValueError: @@ -163,11 +163,11 @@ def _is_custom_repo_or_branch(self): """Check if custom repository or branch is provided (different from defaults)""" default_repo = _config.get_yaml_value(DEFAULT_REPO) # "https://github.com/raghavyuva/nixopus" default_branch = _config.get_yaml_value(DEFAULT_BRANCH) # "master" - + # Check if either repo or branch differs from defaults repo_differs = self.repo is not None and self.repo != default_repo branch_differs = self.branch is not None and self.branch != default_branch - + return repo_differs or branch_differs def run(self): @@ -431,6 +431,12 @@ def _update_environment_variables(self, env_values: dict) -> dict: "WEBSOCKET_URL": f"{ws_protocol}://{api_host}/ws", "API_URL": f"{protocol}://{api_host}/api", "WEBHOOK_URL": f"{protocol}://{api_host}/api/v1/webhook", + "NEXT_PUBLIC_API_URL": f"{protocol}://{api_host}/api", + "NEXT_PUBLIC_WEBSITE_DOMAIN": f"{protocol}://{view_host}", + "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", + "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", + "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", + "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}/api", } for key, value in key_map.items(): diff --git a/cli/pyproject.toml b/cli/pyproject.toml index 659c832ac..e0a762eef 100644 --- a/cli/pyproject.toml +++ b/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nixopus" -version = "0.1.5" +version = "0.1.6" description = "A CLI for Nixopus" authors = ["Nixopus "] readme = "README.md" diff --git a/helpers/config.prod.yaml b/helpers/config.prod.yaml index 84435fdf2..7e4ed6af0 100644 --- a/helpers/config.prod.yaml +++ b/helpers/config.prod.yaml @@ -37,6 +37,8 @@ services: PORT: ${VIEW_PORT:-7443} WEBSOCKET_URL: ${WEBSOCKET_URL:-} API_URL: ${API_URL:-} + NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL:-} + NEXT_PUBLIC_WEBSITE_DOMAIN: ${NEXT_PUBLIC_WEBSITE_DOMAIN:-} WEBHOOK_URL: ${WEBHOOK_URL:-} NEXT_PUBLIC_PORT: ${NEXT_PUBLIC_PORT:-7443} LOGS_PATH: ${LOGS_PATH:-./logs} From 725882665905fad3b0f26bccd7d22de93bb73f21 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 00:42:37 +0530 Subject: [PATCH 06/17] hotfix(api): add supertoken port as config --- cli/app/commands/install/run.py | 2 +- helpers/config.prod.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index 0d9ac3558..e1175f11b 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -436,7 +436,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}/api", + "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{self._get_config('super_tokens_api_port')}/api", } for key, value in key_map.items(): diff --git a/helpers/config.prod.yaml b/helpers/config.prod.yaml index 7e4ed6af0..8fe071ca9 100644 --- a/helpers/config.prod.yaml +++ b/helpers/config.prod.yaml @@ -31,6 +31,7 @@ services: SUPERTOKENS_API_DOMAIN: ${SUPERTOKENS_API_DOMAIN:-http://localhost:3567} SUPERTOKENS_WEBSITE_DOMAIN: ${SUPERTOKENS_WEBSITE_DOMAIN:-http://localhost:3000} SUPERTOKENS_CONNECTION_URI: ${SUPERTOKENS_CONNECTION_URI:-http://localhost:3567} + SUPER_TOKENS_API_PORT: ${SUPER_TOKENS_API_PORT:-3567} view: env: From 56ea24219a5025bcb46def3fa56aa746be541025 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 00:44:03 +0530 Subject: [PATCH 07/17] hotfix(api): add supertoken port as config --- cli/app/commands/install/run.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index e1175f11b..43606704c 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -424,6 +424,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: view_host = self.view_domain if secure else f"{host_ip}:{self._get_config('view_port')}" protocol = "https" if secure else "http" ws_protocol = "wss" if secure else "ws" + super_tokens_api_port = self._get_config("super_tokens_api_port") or 3567 key_map = { "ALLOWED_ORIGIN": f"{protocol}://{view_host}", "SSH_HOST": host_ip, @@ -436,7 +437,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{self._get_config('super_tokens_api_port')}/api", + "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{super_tokens_api_port}/api", } for key, value in key_map.items(): From 338d5d10009530ad4c5ab73a27ba05f40ceecc2e Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 00:49:00 +0530 Subject: [PATCH 08/17] hotfix(api): add supertoken port as config --- cli/app/commands/install/run.py | 2 +- helpers/config.prod.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index 43606704c..58e28e30e 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -424,7 +424,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: view_host = self.view_domain if secure else f"{host_ip}:{self._get_config('view_port')}" protocol = "https" if secure else "http" ws_protocol = "wss" if secure else "ws" - super_tokens_api_port = self._get_config("super_tokens_api_port") or 3567 + super_tokens_api_port = self._get_config("services.api.env.SUPERTOKENS_API_PORT") or 3567 key_map = { "ALLOWED_ORIGIN": f"{protocol}://{view_host}", "SSH_HOST": host_ip, diff --git a/helpers/config.prod.yaml b/helpers/config.prod.yaml index 8fe071ca9..ad862c7af 100644 --- a/helpers/config.prod.yaml +++ b/helpers/config.prod.yaml @@ -31,7 +31,7 @@ services: SUPERTOKENS_API_DOMAIN: ${SUPERTOKENS_API_DOMAIN:-http://localhost:3567} SUPERTOKENS_WEBSITE_DOMAIN: ${SUPERTOKENS_WEBSITE_DOMAIN:-http://localhost:3000} SUPERTOKENS_CONNECTION_URI: ${SUPERTOKENS_CONNECTION_URI:-http://localhost:3567} - SUPER_TOKENS_API_PORT: ${SUPER_TOKENS_API_PORT:-3567} + SUPERTOKENS_API_PORT: ${SUPERTOKENS_API_PORT:-3567} view: env: From 7bdb73a4b9a27410470e88c0802c16b63fccb755 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 00:51:12 +0530 Subject: [PATCH 09/17] hotfix(api): add supertoken port as config --- cli/app/commands/install/run.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index 58e28e30e..10346c60f 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -82,6 +82,7 @@ "view_port": _config.get_yaml_value(VIEW_PORT), "api_port": _config.get_yaml_value(API_PORT), "docker_port": _config.get_yaml_value(DOCKER_PORT), + "supertokens_api_port": 3567, } From d53865519c314397387b1684dac0a8c968cc3ac6 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 01:02:00 +0530 Subject: [PATCH 10/17] ci(build): linter build for view --- view/app/config/appInfo.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/app/config/appInfo.ts b/view/app/config/appInfo.ts index 1146046d7..3b06e2c26 100644 --- a/view/app/config/appInfo.ts +++ b/view/app/config/appInfo.ts @@ -1,7 +1,7 @@ export const appInfo = { // learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo appName: 'Nixopus', - apiDomain: process.env.NEXT_PUBLIC_API_URL?.replace('/api', ''), + apiDomain: process.env.NEXT_PUBLIC_API_URL?.replace('/api', '') || 'http://localhost:8080', websiteDomain: process.env.NEXT_PUBLIC_WEBSITE_DOMAIN || 'http://localhost:3000', apiBasePath: '/auth', websiteBasePath: '/auth' From 07cca714aa5013b67410c814048e17128f8b4224 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 01:24:31 +0530 Subject: [PATCH 11/17] hotfix(conf): add cli config --- cli/app/commands/install/run.py | 7 ++++--- cli/app/utils/config.py | 1 + cli/pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index 10346c60f..3aa162b2e 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -29,6 +29,7 @@ SSH_FILE_PATH, SSH_KEY_SIZE, SSH_KEY_TYPE, + SUPERTOKENS_API_PORT, VIEW_ENV_FILE, VIEW_PORT, Config, @@ -82,7 +83,7 @@ "view_port": _config.get_yaml_value(VIEW_PORT), "api_port": _config.get_yaml_value(API_PORT), "docker_port": _config.get_yaml_value(DOCKER_PORT), - "supertokens_api_port": 3567, + "supertokens_api_port": _config.get_yaml_value(SUPERTOKENS_API_PORT), } @@ -425,7 +426,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: view_host = self.view_domain if secure else f"{host_ip}:{self._get_config('view_port')}" protocol = "https" if secure else "http" ws_protocol = "wss" if secure else "ws" - super_tokens_api_port = self._get_config("services.api.env.SUPERTOKENS_API_PORT") or 3567 + # super_tokens_api_port = self._get_config("services.api.env.SUPERTOKENS_API_PORT") or 3567 key_map = { "ALLOWED_ORIGIN": f"{protocol}://{view_host}", "SSH_HOST": host_ip, @@ -438,7 +439,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{super_tokens_api_port}/api", + "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{self._get_config('supertokens_api_port')}/api", } for key, value in key_map.items(): diff --git a/cli/app/utils/config.py b/cli/app/utils/config.py index 6372ae60e..ed00c964d 100644 --- a/cli/app/utils/config.py +++ b/cli/app/utils/config.py @@ -150,3 +150,4 @@ def replacer(match): API_PORT = "services.api.env.PORT" CADDY_CONFIG_VOLUME = "services.caddy.env.CADDY_CONFIG_VOLUME" DOCKER_PORT = "services.api.env.DOCKER_PORT" +SUPERTOKENS_API_PORT = "services.api.env.SUPERTOKENS_API_PORT" \ No newline at end of file diff --git a/cli/pyproject.toml b/cli/pyproject.toml index e0a762eef..6541a5caf 100644 --- a/cli/pyproject.toml +++ b/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nixopus" -version = "0.1.6" +version = "0.1.7" description = "A CLI for Nixopus" authors = ["Nixopus "] readme = "README.md" From 1f39c6d28b6c22c3521e5bc60ddda3151def934b Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 01:28:27 +0530 Subject: [PATCH 12/17] hotfix(conf): add cli config for supertkns --- cli/app/commands/install/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index f7550330a..160e72b94 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -426,7 +426,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: view_host = self.view_domain if secure else f"{host_ip}:{self._get_config('view_port')}" protocol = "https" if secure else "http" ws_protocol = "wss" if secure else "ws" - super_tokens_api_port = self._get_config("supertokens_api_port") or 3567 + supertokens_api_port = self._get_config("supertokens_api_port") or 3567 key_map = { "ALLOWED_ORIGIN": f"{protocol}://{view_host}", "SSH_HOST": host_ip, @@ -439,7 +439,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{super_tokens_api_port}/api", + "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{supertokens_api_port}/api", } for key, value in key_map.items(): From 2667b8398e829ee082be66eed2a61ccae232db4b Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 03:04:41 +0530 Subject: [PATCH 13/17] fix: supertoken integration config for setup --- cli/app/commands/install/run.py | 24 +++++++++++++++++++++++- cli/pyproject.toml | 2 +- docker-compose.yml | 8 ++++++-- view/Dockerfile | 4 ++++ 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index 160e72b94..b47e2e523 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -293,14 +293,20 @@ def _setup_clone_and_config(self): def _create_env_files(self): api_env_file = self._get_config("api_env_file_path") view_env_file = self._get_config("view_env_file_path") + + full_source_path = self._get_config("full_source_path") + combined_env_file = os.path.join(full_source_path, ".env") FileManager.create_directory(FileManager.get_directory_path(api_env_file), logger=self.logger) FileManager.create_directory(FileManager.get_directory_path(view_env_file), logger=self.logger) + FileManager.create_directory(FileManager.get_directory_path(combined_env_file), logger=self.logger) + services = [ ("api", "services.api.env", api_env_file), ("view", "services.view.env", view_env_file), ] env_manager = BaseEnvironmentManager(self.logger) + # individual service env files for i, (service_name, service_key, env_file) in enumerate(services): env_values = _config.get_service_env_values(service_key) updated_env_values = self._update_environment_variables(env_values) @@ -312,6 +318,22 @@ def _create_env_files(self): raise Exception(f"{env_file_permissions_failed} {service_name}: {file_perm_error}") self.logger.debug(created_env_file.format(service_name=service_name, env_file=env_file)) + # combined env file with both API and view variables + api_env_values = _config.get_service_env_values("services.api.env") + view_env_values = _config.get_service_env_values("services.view.env") + + combined_env_values = {} + combined_env_values.update(self._update_environment_variables(api_env_values)) + combined_env_values.update(self._update_environment_variables(view_env_values)) + success, error = env_manager.write_env_file(combined_env_file, combined_env_values) + + if not success: + raise Exception(f"{env_file_creation_failed} combined: {error}") + file_perm_success, file_perm_error = FileManager.set_permissions(combined_env_file, 0o644) + if not file_perm_success: + raise Exception(f"{env_file_permissions_failed} combined: {file_perm_error}") + self.logger.debug(created_env_file.format(service_name="combined", env_file=combined_env_file)) + def _setup_proxy_config(self): full_source_path = self._get_config("full_source_path") caddy_json_template = os.path.join(full_source_path, "helpers", "caddy.json") @@ -439,7 +461,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{supertokens_api_port}/api", + "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{supertokens_api_port}", } for key, value in key_map.items(): diff --git a/cli/pyproject.toml b/cli/pyproject.toml index 6541a5caf..192adc963 100644 --- a/cli/pyproject.toml +++ b/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nixopus" -version = "0.1.7" +version = "0.1.8" description = "A CLI for Nixopus" authors = ["Nixopus "] readme = "README.md" diff --git a/docker-compose.yml b/docker-compose.yml index 80c7c23a8..2fd8662e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,6 +11,7 @@ services: - ${NIXOPUS_HOME:-/etc/nixopus}/source/api/.env environment: - HOST_NAME=nixopus-db + volumes: - ./logs:/app/logs - ${NIXOPUS_HOME:-/etc/nixopus}:/etc/nixopus @@ -31,6 +32,7 @@ services: - POSTGRES_PASSWORD=${PASSWORD} - POSTGRES_DB=${DB_NAME} - POSTGRES_HOST_AUTH_METHOD=trust + ports: - "${DB_PORT:-5432}:5432" volumes: @@ -49,6 +51,8 @@ services: build: args: - NEXT_PUBLIC_PORT=${NEXT_PUBLIC_PORT} + - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} + - NEXT_PUBLIC_WEBSITE_DOMAIN=${NEXT_PUBLIC_WEBSITE_DOMAIN} ports: - "${NEXT_PUBLIC_PORT:-7443}:${NEXT_PUBLIC_PORT:-7443}" restart: unless-stopped @@ -95,11 +99,11 @@ services: "--config", "/etc/caddy/Caddyfile", "--adapter", - "caddyfile" + "caddyfile", ] networks: - nixopus-network - + supertokens: image: registry.supertokens.io/supertokens/supertokens-postgresql:latest depends_on: diff --git a/view/Dockerfile b/view/Dockerfile index 318f046cf..4750562c2 100644 --- a/view/Dockerfile +++ b/view/Dockerfile @@ -11,9 +11,13 @@ COPY --from=deps /app/node_modules ./node_modules COPY . . ARG NEXT_PUBLIC_PORT=7443 +ARG NEXT_PUBLIC_API_URL=http://localhost:8443/api +ARG NEXT_PUBLIC_WEBSITE_DOMAIN=http://localhost:7443 ENV NEXT_TELEMETRY_DISABLED=1 ENV PORT=$NEXT_PUBLIC_PORT ENV NEXT_PUBLIC_PORT=$NEXT_PUBLIC_PORT +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_WEBSITE_DOMAIN=$NEXT_PUBLIC_WEBSITE_DOMAIN RUN yarn build && \ rm -rf node_modules/.cache From f4671e6f3eba681e7dc4904db2615f171e2e6b2a Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 11:35:25 +0530 Subject: [PATCH 14/17] chore: add missing envs in production stage --- view/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/view/Dockerfile b/view/Dockerfile index 4750562c2..ac5f968a3 100644 --- a/view/Dockerfile +++ b/view/Dockerfile @@ -29,6 +29,8 @@ ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 ENV PORT=$NEXT_PUBLIC_PORT ENV NEXT_PUBLIC_PORT=$NEXT_PUBLIC_PORT +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_WEBSITE_DOMAIN=$NEXT_PUBLIC_WEBSITE_DOMAIN RUN addgroup -S nixopus && adduser -S nixopus -G nixopus From 1b8a4a592036fa58a80c3e495d7e044b89b8ad59 Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 13:02:38 +0530 Subject: [PATCH 15/17] fix: supertokens enabled via HTTP --- cli/app/commands/install/run.py | 2 +- cli/pyproject.toml | 2 +- docker-compose.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index b47e2e523..c70eabeba 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -461,7 +461,7 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{supertokens_api_port}", + "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{supertokens_api_port}".replace("https", "http"), } for key, value in key_map.items(): diff --git a/cli/pyproject.toml b/cli/pyproject.toml index 192adc963..83df5556c 100644 --- a/cli/pyproject.toml +++ b/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nixopus" -version = "0.1.8" +version = "0.1.9" description = "A CLI for Nixopus" authors = ["Nixopus "] readme = "README.md" diff --git a/docker-compose.yml b/docker-compose.yml index 2fd8662e9..b380e32f9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,7 +52,7 @@ services: args: - NEXT_PUBLIC_PORT=${NEXT_PUBLIC_PORT} - NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} - - NEXT_PUBLIC_WEBSITE_DOMAIN=${NEXT_PUBLIC_WEBSITE_DOMAIN} + - NEXT_PUBLIC_WEBSITE_DOMAIN=${NEXT_PUBLIC_WEBSITE_DOMAIN} ports: - "${NEXT_PUBLIC_PORT:-7443}:${NEXT_PUBLIC_PORT:-7443}" restart: unless-stopped From 952a2b9183d14662887cf7d6fa8f6a25e0fcbcbc Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 15:45:31 +0530 Subject: [PATCH 16/17] fix: supertokens URI for ip vs domain --- cli/app/commands/install/run.py | 14 +++++++++++++- cli/pyproject.toml | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/cli/app/commands/install/run.py b/cli/app/commands/install/run.py index c70eabeba..f1e93453f 100644 --- a/cli/app/commands/install/run.py +++ b/cli/app/commands/install/run.py @@ -1,3 +1,4 @@ +import ipaddress import json import os import re @@ -439,6 +440,16 @@ def _show_success_message(self): self.logger.info("If you have any questions, please visit the community forum at https://discord.gg/skdcq39Wpv") self.logger.highlight("See you in the community!") + def _get_supertokens_connection_uri(self, protocol: str, api_host: str, supertokens_api_port: int): + protocol = protocol.replace("https", "http") + try: + ipaddress.ip_address(api_host) + # It's a valid IP — skip port + return f"{protocol}://{api_host}" + except ValueError: + # Not an IP — include port + return f"{protocol}://{api_host}:{supertokens_api_port}" + def _update_environment_variables(self, env_values: dict) -> dict: updated_env = env_values.copy() host_ip = HostInformation.get_public_ip() @@ -461,7 +472,8 @@ def _update_environment_variables(self, env_values: dict) -> dict: "SUPERTOKENS_API_KEY": "NixopusSuperTokensAPIKey", "SUPERTOKENS_API_DOMAIN": f"{protocol}://{api_host}/api", "SUPERTOKENS_WEBSITE_DOMAIN": f"{protocol}://{view_host}", - "SUPERTOKENS_CONNECTION_URI": f"{protocol}://{api_host}:{supertokens_api_port}".replace("https", "http"), + # TODO: temp fix, remove this once we have a secure connection + "SUPERTOKENS_CONNECTION_URI": self._get_supertokens_connection_uri(protocol, api_host, supertokens_api_port), } for key, value in key_map.items(): diff --git a/cli/pyproject.toml b/cli/pyproject.toml index 83df5556c..f30046450 100644 --- a/cli/pyproject.toml +++ b/cli/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nixopus" -version = "0.1.9" +version = "0.1.10" description = "A CLI for Nixopus" authors = ["Nixopus "] readme = "README.md" From 9f59b11e7350c71f38292a8caa3b7df0595b0c1d Mon Sep 17 00:00:00 2001 From: zhravan Date: Sat, 11 Oct 2025 17:33:54 +0530 Subject: [PATCH 17/17] fix: apiDomain getting replace for any sub domain /api --- view/app/config/appInfo.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/app/config/appInfo.ts b/view/app/config/appInfo.ts index 9df1b397f..afae35a05 100644 --- a/view/app/config/appInfo.ts +++ b/view/app/config/appInfo.ts @@ -2,8 +2,8 @@ import { getBaseUrl } from '@/redux/conf'; export const getAppInfo = async () => { const baseUrl = await getBaseUrl(); - const apiDomain = baseUrl.replace('/api', ''); - + const apiDomain = baseUrl.replace('://', 'TEMP').replace('/api', '').replace('TEMP', '://'); + return { // learn more about this on https://supertokens.com/docs/thirdpartyemailpassword/appinfo appName: 'Nixopus',