From 4f25c81a939565b88ed70a348113195128259740 Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Mon, 8 Jul 2024 23:19:25 +0200 Subject: [PATCH] Update reverse proxy guide --- CHANGELOG.md | 10 +++++++++- app/jobs/reverse_geocoding_job.rb | 7 +++---- docs/how_to_setup_reverse_proxy.md | 27 ++++++++++++++++++--------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a51a80b..c6d6b389 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). -## [0.8.4] — 2024-07-08 +## [0.8.6] — 2024-07-08 + +### Added + +- Guide on how to setup a reverse proxy for Dawarich in the `docs/how_to_setup_reverse_proxy.md` file. This guide explains how to set up a reverse proxy for Dawarich using Nginx and Apache2. + +--- + +## [0.8.5] — 2024-07-08 ### Fixed diff --git a/app/jobs/reverse_geocoding_job.rb b/app/jobs/reverse_geocoding_job.rb index c6939d9c..6921ffa4 100644 --- a/app/jobs/reverse_geocoding_job.rb +++ b/app/jobs/reverse_geocoding_job.rb @@ -12,9 +12,8 @@ class ReverseGeocodingJob < ApplicationJob result = Geocoder.search([point.latitude, point.longitude]) return if result.blank? - point.update!( - city: result.first.city, - country: result.first.country - ) + point.update!(city: result.first.city, country: result.first.country) + rescue ActiveRecord::RecordNotFound => e + Rails.logger.error("Point with id #{point_id} not found: #{e.message}") end end diff --git a/docs/how_to_setup_reverse_proxy.md b/docs/how_to_setup_reverse_proxy.md index e1260f59..8168f37c 100644 --- a/docs/how_to_setup_reverse_proxy.md +++ b/docs/how_to_setup_reverse_proxy.md @@ -1,27 +1,36 @@ ## Setting up reverse proxy ### Environment Variable -To make Dawarich work with a reverse proxy, you need to ensure the APPLICATION_HOST environment variable is set to the domain name that the reverse proxy will use. -For example, if your Dawarich instance is supposed to be on the domain name timeline.mydomain.com, then set the environment variable to "timeline.mydomain.com". -Make sure to exclude "http://" or "https://" from the environment variable. The webpage will not work if you do include http:// or https:// in the variable. +To make Dawarich work with a reverse proxy, you need to ensure the APPLICATION_HOSTS environment variable is set to include the domain name that the reverse proxy will use. +For example, if your Dawarich instance is supposed to be on the domain name timeline.mydomain.com, then include "timeline.mydomain.com" in this environment variable. +Make sure to exclude "http://" or "https://" from the environment variable. ⚠️ The webpage will not work if you do include http:// or https:// in the variable. ⚠️ -At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOST entries in the docker-compose.yml file and change them from "localhost" to your domain name. -For a synology install, refer to **[Synology Install Tutorial](How_to_install_Dawarich_on_Synology.md)**. In this page it is explained how to set the APPLICATION_HOST environment variable. +At the time of writing this, the way to set the environment variable is to edit the docker-compose.yml file. Find all APPLICATION_HOSTS entries in the docker-compose.yml file and make sure to include your domain name. Example: + +```yaml + dawarich_app: + image: freikin/dawarich:latest + container_name: dawarich_app + environment: + APPLICATION_HOSTS: "yourhost.com,www.yourhost.com,127.0.0.1" +``` + +For a Synology install, refer to **[Synology Install Tutorial](How_to_install_Dawarich_on_Synology.md)**. In this page, it is explained how to set the APPLICATION_HOSTS environment variable. ### Virtual Host -Now that the app works with a domain name, the server needs to be setup to use a reverse proxy. Usually this is done by setting it up in the virtual host configuration. +Now that the app works with a domain name, the server needs to be set up to use a reverse proxy. Usually, this is done by setting it up in the virtual host configuration. Below are examples of reverse proxy configurations. ### Nginx ``` server { - + listen 80; listen [::]:80; server_name example.com; - + location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; @@ -29,7 +38,7 @@ server { proxy_set_header X-Forwarded-Server $host; proxy_set_header Host $http_host; proxy_redirect off; - + proxy_pass http://127.0.0.1:3000/; }