Skip to content

Commit

Permalink
fix: an issue with the generic environment
Browse files Browse the repository at this point in the history
feat: add support for custom http/s port for traefik
  • Loading branch information
janosmiko committed Dec 20, 2022
1 parent 30f6b52 commit c2bf434
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.3.23-beta
v0.3.24-beta
10 changes: 7 additions & 3 deletions docs/settings/reward-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ It's possible to change service container images using the following vars.
- `reward_elastichq_image: "elastichq/elasticsearch-hq"`
- `reward_adminer_image: "dehy/adminer"`

You can configure Traefik to bind additional http ports on top of the default port (80).
You can change the default Traefik http and https ports using the following vars.

- `reward_traefik_bind_additional_http_ports: []` - valid option example: `[8080, 8081]`
- `reward_traefik_http_port: "80"`
- `reward_traefik_https_port: "443"`

You can configure Traefik to bind additional https ports on top of the default port (443).
You can also add additional http and https ports on top of the defaults (80, 443). This is useful when you want to
expose a service on a different port than the default ones. See more info in
the [Open Ports](../configuration/open-additional-port.html) section.

- `reward_traefik_bind_additional_http_ports: []` - valid option example: `[8080, 8081]`
- `reward_traefik_bind_additional_https_ports: []` - valid option example: `[8443, 9443]`

By default, Reward makes it possible to resolve the environment's domain to the nginx container's IP address inside the
Expand Down
4 changes: 4 additions & 0 deletions internal/commands/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ debug: false
# Reward >= v0.2.34 uses the internally built "docker.io/rewardenv/sshd"
#reward_tunnel_image: "docker.io/rewardenv/sshd"
# Override default traefik ports
#reward_traefik_http_port: 80
#reward_traefik_https_port: 443
# You can configure Traefik to bind additional http ports on top of the default port (80).
# reward_traefik_bind_additional_http_ports: [8080]
reward_traefik_bind_additional_http_ports: []
Expand Down
12 changes: 6 additions & 6 deletions templates/_services/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{{- /* @formatter:off */ -}}

{{- $traefik_listen := .traefik_listen -}}
{{- $reward_traefik_listen := .reward_traefik_listen -}}

version: "3.5"
services:
traefik:
container_name: traefik
image: {{ default "traefik" .reward_traefik_image }}:{{ default "2.2" .traefik_version }}
image: {{ default "traefik" .reward_traefik_image }}:{{ default "2.2" .reward_traefik_version }}
ports:
- "{{ default "127.0.0.1" .traefik_listen }}:80:80" # The HTTP port
- "{{ default "127.0.0.1" .traefik_listen }}:443:443" # The HTTPS port
- "{{ default "127.0.0.1" $reward_traefik_listen }}:{{ default "80" .reward_traefik_http_port }}:{{ default "80" .reward_traefik_http_port }}" # The HTTP port
- "{{ default "127.0.0.1" $reward_traefik_listen }}:{{ default "443" .reward_traefik_https_port }}:{{ default "443" .reward_traefik_https_port }}" # The HTTPS port
{{- if .reward_traefik_bind_additional_http_ports -}}
{{- range $i, $v := .reward_traefik_bind_additional_http_ports }}
{{- printf `- "%s:%d:%d"` (default "127.0.0.1" $traefik_listen) $v $v | nindent 6 -}}
{{- printf `- "%s:%d:%d"` (default "127.0.0.1" $reward_traefik_listen) $v $v | nindent 6 -}}
{{- end -}}
{{- end -}}
{{- if .reward_traefik_bind_additional_https_ports -}}
{{- range $i, $v := .reward_traefik_bind_additional_https_ports }}
{{- printf `- "%s:%d:%d"` (default "127.0.0.1" $traefik_listen) $v $v | nindent 6 -}}
{{- printf `- "%s:%d:%d"` (default "127.0.0.1" $reward_traefik_listen) $v $v | nindent 6 -}}
{{- end -}}
{{- end }}
volumes:
Expand Down
4 changes: 2 additions & 2 deletions templates/_traefik/traefik.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ providers:
exposedByDefault: false
entryPoints:
http:
address: ":80"
address: ":{{ default "80" .reward_traefik_http_port }}"
http:
redirections:
entryPoint:
to: https
scheme: https
https:
address: ":443"
address: ":{{ default "443" .reward_traefik_https_port }}"
{{- if .reward_traefik_bind_additional_http_ports -}}
{{- range $i, $v := .reward_traefik_bind_additional_http_ports }}
{{- printf "http-additional-%d:" $v | nindent 2 -}}
Expand Down
6 changes: 3 additions & 3 deletions templates/environments/generic-php/generic-php.base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

version: "3.5"
services:
nginx:
nginx: {}

php-fpm:
php-fpm: {}

php-debug:
php-debug: {}

0 comments on commit c2bf434

Please sign in to comment.