Skip to content

Commit

Permalink
Upgrade (1.28.1 -> 1.29.0) and remove dedicated WebSocket port
Browse files Browse the repository at this point in the history
As per dani-garcia/vaultwarden#3404,
we no longer need a dedicated websocket port.
  • Loading branch information
spantaleev committed Jul 9, 2023
1 parent acbf11e commit ce94b5d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 32 deletions.
16 changes: 1 addition & 15 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ vaultwarden_enabled: true

vaultwarden_identifier: vaultwarden

vaultwarden_version: 1.28.1
vaultwarden_version: 1.29.0

# The fully-qualified name of your Vaultwarden server (e.g. `vaultwarden.example.com`)
vaultwarden_hostname: ''
Expand Down Expand Up @@ -105,14 +105,6 @@ vaultwarden_config_admin_token: ''
# which controls Vaultwarden's HTTP port in the container
vaultwarden_config_rocket_port: 8080

# vaultwarden_config_websocket_enabled controls the WEBSOCKET_ENABLED environment variable,
# which controls if Vaultwarden enables websockets
vaultwarden_config_websocket_enabled: true

# vaultwarden_config_rocket_port controls the WEBSOCKET_PORT environment variable,
# which controls Vaultwarden's Websocket port in the container
vaultwarden_config_websocket_port: 3012

# vaultwarden_config_rocket_limits controls the ROCKET_LIMITS environment variable,
# which controls the maximum size of uploaded files.
# See: vaultwarden_max_json_mb
Expand Down Expand Up @@ -237,7 +229,6 @@ vaultwarden_container_labels_traefik_hostname: "{{ vaultwarden_hostname }}"
# The path prefix must either be `/` or not end with a slash (e.g. `/vaultwarden`).
vaultwarden_container_labels_traefik_path_prefix: "{{ vaultwarden_path_prefix }}"
vaultwarden_container_labels_traefik_rule_ui: "Host(`{{ vaultwarden_container_labels_traefik_hostname }}`){% if vaultwarden_container_labels_traefik_path_prefix != '/' %} && PathPrefix(`{{ vaultwarden_container_labels_traefik_path_prefix | quote }}`){% endif %}"
vaultwarden_container_labels_traefik_rule_websocket: 'Host(`{{ vaultwarden_container_labels_traefik_hostname }}`) && Path(`{{ vaultwarden_container_labels_traefik_path_prefix | quote }}{{ "" if vaultwarden_container_labels_traefik_path_prefix == "/" else "/" }}notifications/hub`)'
vaultwarden_container_labels_traefik_priority: 0
vaultwarden_container_labels_traefik_entrypoints: web-secure
vaultwarden_container_labels_traefik_tls_certResolver: default # noqa var-naming
Expand All @@ -262,11 +253,6 @@ vaultwarden_container_labels_traefik_additional_response_headers_custom: {}
# Example values: `127.0.0.1:8080`, `0.0.0.0:8080`, `8080`.
vaultwarden_container_http_bind_port: ''

# vaultwarden_container_websocket_bind_port controls whether (and how) the container exposes its websocket port (`vaultwarden_config_websocket_port`).
# Leave empty to not expose it.
# Example values: `127.0.0.1:3012`, `0.0.0.0:3012`, `3012`.
vaultwarden_container_websocket_bind_port: ''

# vaultwarden_container_labels_additional_labels contains a multiline string with additional labels to add to the container label file.
# See `../templates/labels.j2` for details.
#
Expand Down
12 changes: 12 additions & 0 deletions tasks/validate_config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
---

- name: (Deprecation) Catch and report renamed settings
ansible.builtin.fail:
msg: >-
Your configuration contains a variable, which now has a different name.
Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`).
when: "item.old in vars"
with_items:
- {'old': 'vaultwarden_container_labels_traefik_rule_websocket', 'new': '<Removed. See https://github.com/dani-garcia/vaultwarden/pull/3404>'}
- {'old': 'vaultwarden_config_websocket_enabled', 'new': '<Removed. See https://github.com/dani-garcia/vaultwarden/pull/3404>'}
- {'old': 'vaultwarden_config_websocket_port', 'new': '<Removed. See https://github.com/dani-garcia/vaultwarden/pull/3404>'}
- {'old': 'vaultwarden_container_websocket_bind_port', 'new': '<Removed. See https://github.com/dani-garcia/vaultwarden/pull/3404>'}

- name: Fail if required Vaultwarden settings not defined
ansible.builtin.fail:
msg: >-
Expand Down
3 changes: 0 additions & 3 deletions templates/env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ ADMIN_TOKEN={{ vaultwarden_config_admin_token }}
ROCKET_PORT={{ vaultwarden_config_rocket_port }}
ROCKET_LIMITS={{ vaultwarden_config_rocket_limits }}

WEBSOCKET_ENABLED={{ vaultwarden_config_websocket_enabled | to_json }}
WEBSOCKET_PORT={{ vaultwarden_config_websocket_port }}

SMTP_FROM={{ vaultwarden_config_smtp_from }}
SMTP_HOST={{ vaultwarden_config_smtp_host }}
SMTP_PORT={{ vaultwarden_config_smtp_port }}
Expand Down
11 changes: 0 additions & 11 deletions templates/labels.j2
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ traefik.http.routers.{{ vaultwarden_identifier }}-ui.service={{ vaultwarden_iden
traefik.http.routers.{{ vaultwarden_identifier }}-ui.tls.certResolver={{ vaultwarden_container_labels_traefik_tls_certResolver }}
traefik.http.routers.{{ vaultwarden_identifier }}-ui.entrypoints={{ vaultwarden_container_labels_traefik_entrypoints }}
traefik.http.services.{{ vaultwarden_identifier }}-ui.loadbalancer.server.port={{ vaultwarden_config_rocket_port }}


{# Vaultwarden Websocket API #}
traefik.http.routers.{{ vaultwarden_identifier }}-websocket.rule={{ vaultwarden_container_labels_traefik_rule_websocket }}
{% if vaultwarden_container_labels_traefik_priority | int > 0 %}
traefik.http.routers.{{ vaultwarden_identifier }}-websocket.priority={{ vaultwarden_container_labels_traefik_priority }}
{% endif %}
traefik.http.routers.{{ vaultwarden_identifier }}-websocket.service={{ vaultwarden_identifier }}-websocket
traefik.http.routers.{{ vaultwarden_identifier }}-websocket.tls.certResolver={{ vaultwarden_container_labels_traefik_tls_certResolver }}
traefik.http.routers.{{ vaultwarden_identifier }}-websocket.entrypoints={{ vaultwarden_container_labels_traefik_entrypoints }}
traefik.http.services.{{ vaultwarden_identifier }}-websocket.loadbalancer.server.port={{ vaultwarden_config_websocket_port }}
{% endif %}

{{ vaultwarden_container_labels_additional_labels }}
3 changes: 0 additions & 3 deletions templates/vaultwarden.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
{% if vaultwarden_container_http_bind_port %}
-p {{ vaultwarden_container_http_bind_port }}:{{ vaultwarden_config_rocket_port }} \
{% endif %}
{% if vaultwarden_container_websocket_bind_port %}
-p {{ vaultwarden_container_websocket_bind_port }}:{{ vaultwarden_config_websocket_port }} \
{% endif %}
--health-interval=10s \
--env-file={{ vaultwarden_base_path }}/env \
--label-file={{ vaultwarden_base_path }}/labels \
Expand Down

0 comments on commit ce94b5d

Please sign in to comment.