Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port: Add config & docs for all possible port changes #83

Merged
merged 2 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
92 changes: 82 additions & 10 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,75 @@ in {
};

httpPort = lib.mkOption {
type = lib.types.str;
type = lib.types.int;
description = ''Sets the HTTP port'';
default = "80";
default = 80;
};

httpsPort = lib.mkOption {
type = lib.types.str;
type = lib.types.int;
description = ''Sets the HTTPS port'';
default = "443";
default = 443;
};

mysqlPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the MySQL port'';
default = 3306;
};

adminerPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the Adminer port'';
default = 8010;
};

mailhogApiPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the Mailhog API port'';
default = 8025;
};

mailhogSmtpPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the Mailhog SMTP port'';
default = 1025;
};

mailhogUiPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the Mailhog Web UI port'';
default = 8025;
};

redisPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the Redis port'';
default = 6379;
};

elasticsearchPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the Elasticsearch/OpenSearch port'';
default = 9200;
};

elasticsearchTcpPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the Elasticsearch/OpenSearch TCP port'';
default = 9300;
};

rabbitMqPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the RabbitMQ port'';
default = 5672;
};

rabbitMqManagementPluginPort = lib.mkOption {
type = lib.types.int;
description = ''Sets the RabbitMQ management plugin port'';
default = 15672;
};
};

Expand All @@ -166,17 +226,28 @@ in {
};

services.redis.enable = lib.mkDefault true;
services.redis.port = cfg.redisPort;

services.adminer.enable = lib.mkDefault true;
services.adminer.listen = lib.mkDefault "127.0.0.1:8010";
services.adminer.listen = lib.mkDefault "127.0.0.1:${toString cfg.adminerPort}";

services.mailhog.enable = true;
services.mailhog.apiListenAddress = lib.mkDefault "127.0.0.1:${toString cfg.mailhogApiPort}";
services.mailhog.smtpListenAddress = lib.mkDefault "127.0.0.1:${toString cfg.mailhogSmtpPort}";
services.mailhog.uiListenAddress = lib.mkDefault "127.0.0.1:${toString cfg.mailhogUiPort}";

services.elasticsearch.enable = cfg.enableElasticsearch;
services.elasticsearch.port = cfg.elasticsearchPort;
services.elasticsearch.tcp_port = cfg.elasticsearchTcpPort;

services.opensearch.enable = cfg.enableOpenSearch;
services.opensearch.settings."http.port" = cfg.elasticsearchPort;
services.opensearch.settings."transport.port" = cfg.elasticsearchTcpPort;

services.rabbitmq.enable = cfg.enableRabbitMq;
services.rabbitmq.managementPlugin.enable = cfg.enableRabbitMq;
services.rabbitmq.port = cfg.rabbitMqPort;
services.rabbitmq.managementPlugin.port= cfg.rabbitMqManagementPluginPort;

dotenv.disableHint = true;

Expand All @@ -202,9 +273,9 @@ in {
# Environment variables
env = lib.mkMerge [
(lib.mkIf cfg.enable {
DATABASE_URL = lib.mkDefault "mysql://shopware:[email protected]:3306/shopware";
MAILER_URL = lib.mkDefault "smtp://127.0.0.1:1025?encryption=&auth_mode=";
MAILER_DSN = lib.mkDefault "smtp://127.0.0.1:1025?encryption=&auth_mode=";
DATABASE_URL = lib.mkDefault "mysql://shopware:[email protected]:${toString cfg.mysqlPort}/shopware";
MAILER_URL = lib.mkDefault "smtp://127.0.0.1:${toString cfg.mailhogSmtpPort}?encryption=&auth_mode=";
MAILER_DSN = lib.mkDefault "smtp://127.0.0.1:${toString cfg.mailhogSmtpPort}?encryption=&auth_mode=";

APP_URL = lib.mkDefault "http://127.0.0.1:${toString cfg.httpPort}";
CYPRESS_baseUrl = lib.mkDefault "http://127.0.0.1:${toString cfg.httpPort}";
Expand All @@ -222,14 +293,15 @@ in {
(lib.mkIf (config.services.elasticsearch.enable || config.services.opensearch.enable) {
SHOPWARE_ES_ENABLED = "1";
SHOPWARE_ES_INDEXING_ENABLED = "1";
SHOPWARE_ES_HOSTS = "127.0.0.1";
SHOPWARE_ES_HOSTS = "127.0.0.1:${toString cfg.elasticsearchPort}";
SHOPWARE_ES_THROW_EXCEPTION = "1";
})
(lib.mkIf config.services.rabbitmq.enable {
RABBITMQ_NODENAME = "rabbit@localhost"; # 127.0.0.1 can't be used as rabbitmq can't set short node name
RABBITMQ_NODE_PORT = "${toString cfg.rabbitMqPort}";
})
(lib.mkIf config.services.redis.enable {
REDIS_DSN = "redis://127.0.0.1:6379";
REDIS_DSN = "redis://127.0.0.1:${toString cfg.redisPort}";
})
];
};
Expand Down
108 changes: 104 additions & 4 deletions docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,119 @@ kellerkinder.enableMysqlBinLog = false;
# kellerkinder.httpPort
Sets the http port for caddy.

_This has to be a string_
_This has to be an int_

*_Example_*
```
kellerkinder.httpPort = "8080";
kellerkinder.httpPort = 8080;
```

# kellerkinder.httpsPort
Sets the https port for caddy.

_This has to be a string_
_This has to be an int_

*_Example_*
```
kellerkinder.httpsPort = "8443";
kellerkinder.httpsPort = 8443;
```

# kellerkinder.mysqlPort
Sets the MySQL port.

_This has to be an int_

*_Example_*
```
kellerkinder.mysqlPort = 3307;
```

# kellerkinder.adminerPort
Sets the Adminer port.

_This has to be an int_

*_Example_*
```
kellerkinder.adminerPort = 8010;
```

# kellerkinder.mailhogApiPort
ets the Mailhog API port.

_This has to be an int_

*_Example_*
```
kellerkinder.mailhogApiPort = 8025;
```

# kellerkinder.mailhogSmtpPort
Sets the Mailhog SMTP port.

_This has to be an int_

*_Example_*
```
kellerkinder.mailhogSmtpPort = 1025;
```

# kellerkinder.mailhogUiPort
Sets the Mailhog Web UI port.

_This has to be an int_

*_Example_*
```
kellerkinder.mailhogUiPort = 8025;
```

# kellerkinder.redisPort
Sets the Redis port.

_This has to be an int_

*_Example_*
```
kellerkinder.redisPort = 6379;
```

# kellerkinder.elasticsearchPort
Sets the Elasticsearch/OpenSearch port.

_This has to be an int_

*_Example_*
```
kellerkinder.elasticsearchPort = 9200;
```

# kellerkinder.elasticsearchTcpPort
Sets the Elasticsearch/OpenSearch TCP port.

_This has to be an int_

*_Example_*
```
kellerkinder.elasticsearchTcpPort = 9300;
```

# kellerkinder.rabbitMqPort
Sets the RabbitMQ port.

_This has to be an int_

*_Example_*
```
kellerkinder.rabbitMqPort = 5672;
```

# kellerkinder.rabbitMqManagementPluginPort
Sets the RabbitMQ management plugin port.

_This has to be an int_

*_Example_*
```
kellerkinder.rabbitMqManagementPluginPort = 15672;
```
1 change: 1 addition & 0 deletions modules/mysql.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ in {
key_buffer_size = 16777216;
max_allowed_packet = 134217728;
table_open_cache = 1024;
port = cfg.mysqlPort;
})
(lib.mkIf (cfg.enableMysqlBinLog) {
sync_binlog = 0;
Expand Down
Loading