Openrouteservice сервер без Docker
Задача: розгорнути Openrouteservice сервер без Docker.

Чому без Docker? Ну, наприклад, на віртуальному сервері, що використовує контейнерну віртуалізацію, або просто не робити додатковий рівень віртуалізації.

Беремо репозиторій openrouteservice https://github.com/GIScience/openrouteservice                   

І вивчаємо інструкцію по розгортанню без докеру https://giscience.github.io/openrouteservice/installation/Building-from-Source.html


If you need to install without Docker, on an Ubuntu 20.04 system (also generally works with newer Ubuntu versions) you can use the following steps

Тут все ясно: потрібен сервер з Ubuntu 20.04


Заходимо на новий сервер 

sudo apt update

sudo apt upgrade


1. Clone the openrouteservice repository to your machine.

sudo apt install git

sudo git clone https://github.com/GIScience/openrouteservice.git /opt/openrouteservice

Виконуємо ці дві команди і отримуємо копію репозиторія. З цим пробем не виникає

2. Make sure that you have java 1.11 set as the default Java environment..


sudo apt install openjdk-11-jdk

java -version

Тут також проблем не має бути, але якщо якимось чином версія не та, то конфігуруємо

sudo update-alternatives --config java


3. Make sure that you have Maven installed.


sudo apt install maven

mvn -version

Про версію нічого не кажуть, перевіряємо лише на відсутність помилок


4. Download/create an OpenStreetMap pbf file on the machine.


Виникає питання: де взяти файл? Ну раз я вже загуглив, то ось сайт https://download.geofabrik.de/ там є всі країни і Україна також. І оновлення файлу там теж публікують.


cd /opt/openrouteservice/openrouteservice/src/main/files

sudo wget https://download.geofabrik.de/europe-latest.osm.pbf


5. Copy the openrouteservice/src/main/resources/app.config.sample file to the same location but renaming it to app.config.


cd /opt/openrouteservice/openrouteservice/src/main/resources/

sudo cp app.config.sample app.config


Налаштовуємо конфіг копіюванням прикладу. Ну ок.

6. Update the app.config file to reflect the various settings, profiles you want to have running, and the locations of various files, in particular the source location of the OSM file that will be used and additional files required for extended storages. You should make sure that these folders/files are accessible by the service, for example by using the sudo chmod -R 777 [path to folder] command.


Пропонують розібратись з налаштуваннями конфігу. Ну залишаємо то на потім (або як в моєму випадку на ніколи).


7. From within the openrouteservice folder (containing the pom file and the src folder, amongst others) run the command mvn package. This will build the openrouteservice ready for tomcat deployment


cd /opt/openrouteservice/openrouteservice

sudo mvn package


Виконуємо магічну команду, яка має зібрати пакет для Tomcat. Якщо все вище пройшло без проблем, то і тут їх не буде.

Переходимо до встановлення та налаштування Tomcat

1. Install Tomcat 8 using 


sudo apt-get install tomcat8


Note that it might not be available in the lastest repositories of your distribution anymore. In that case, add the following line(s) to your /etc/apt/sources.list:

deb http://de.archive.ubuntu.com/ubuntu bionic main universe
deb http://de.archive.ubuntu.com/ubuntu bionic-security main universe


Якщо ви взяли не Ubuntu 20.0, а новішу, то Tomcat могли випілити, тому додаємо його.

2. If you want to use system settings (i.e. Java heap size) other than the default, then you need to add these to the /usr/share/tomcat8/bin/setenv.sh file. If the file is not present, then you can create it. The settings generally used on our servers are similar to


Залишаємо без змін.


3. If you add these new settings to the setenv.sh file, then you need to restart Tomcat for these to take effect using 


sudo systemctl restart tomcat8.service


Перезапустили Tomcat

4. To get openrouteservice up and running, copy the openrouteservice-xxx.war file found in the openrouteservice/target folder to the Tomcat webapps folder.


sudo cp /opt/openrouteservice/openrouteservice/target/ors.war /var/lib/tomcat8/webapps/ors.war


Копиюємо пакет в директорію Tomcat

5. Tomcat should now automatically detect the new WAR file and deploy the service. Depending on profiles and size of the OSM data, this can take some time until openrouteservice has built graphs and is ready for generating routes. You can check if it is ready by accessing http://localhost:8080/ors/health (the port and URL may be different if you have installed Tomcat differently than above). If you get a status: ready message, you are good to go in creating routes.


curl http://localhost:8080/ors/health

Tomcat має підхопити автоматично скопіїований пакет и віддавати його. Цією командою ми лише перевіряємо, що все ок. Ну впринципі Openrouteservice налаштований, можна звертатись до нього через порт 8080 або налаштувати nginx proxy.


Openrouteservice сервер без Docker
Володимир Карабанов 10 серпня, 2022
Поділитися цією публікацією
Теги
Архів
Підключення Hetzner StorageBox до непривілейованого LXC контенеру Proxmox через Samba (smb, cifs)