diff --git a/Makefile b/Makefile index eb9f72c1..6dd861af 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ # ansible -PLAYBOOK_CMD:=ANSIBLE_PIPELINING=true ansible-playbook --vault-password-file vault-password +PLAYBOOK_CMD:=ANSIBLE_PIPELINING=true ansible-playbook --vault-password-file vault-password galaxy-install: ansible-galaxy collection install -r requirements.yml @@ -91,3 +91,7 @@ photon-local: photon-remote: . venv/bin/activate ansible-playbook -i inventory-remote.yml photon-playbook.yml + +digitransit-local: + ${PLAYBOOK_CMD} -i ride2go-inventory.yml digitransit.yml + diff --git a/Modifications.md b/Modifications.md new file mode 100644 index 00000000..7d4fcc6d --- /dev/null +++ b/Modifications.md @@ -0,0 +1,27 @@ +## vault secret: +- you need to have vault-secret file in the digitransit-ansible directory +## ride2go-inventory: +- you should change the ip address according to the address of the machine you want to install it on. +## MakeFile: +- new command for running digitransit.yml with custom inventory +## digitransit.yml + - commented out every role except `base` and `digitransit` +## variables +- created `vars/main.yml` for both `base` and `digitransit` role and assigned variables needed (with dummy content until changed) +## dependencies +- commented out geerlingguy.certbot dependencies and requirements +## docker-compose +- removed unneccessary parts related to the ui +## digitransit/main.yml +- commented out parts relating to the ui +## docker-compose.yml +- deleted encryption key and the UI part (everything between "services:" and "network:") +## all.yml +- commented out vaulted variables (they are unused variables, and causes encryption error) +- disabled unused services (prediction, gtfs, etc..) +## roles/base/main.yml +- removed send to matrix script +## docker-compose.yml +- changed image to `mfdz/opentripplanner:latest` (from d38...) +- changed otp_docker_tag to latest aswell. + diff --git a/Photon&OTP_usage.md b/Photon&OTP_usage.md new file mode 100644 index 00000000..a45b08fb --- /dev/null +++ b/Photon&OTP_usage.md @@ -0,0 +1,54 @@ +# **Photon** + +# Path +If you're accessing photon from within the VM or machine its running on, then your path for the requests will be: +- `curl "http://localhost:2322/api"` + +Accessing Photon and making requests from outside the environment, you will need to adjust the path accordingly, and make the path accessable from outside the VM. +# Requests +You can make requests with the `?q` keyword for query. A basic search looks like this: +- curl "http://localhost:2322/api?q=berlin" + +For the Searches to work as intented with autocempletition, using the correct language, we need several parameters in the request to show results accordingly. + +The following keywords will have to be filled out based on the website front end information: + - `&lang` for Language + - `&lon` for longitude + - `&lat` for latitude + +Language: + +We have to get the selected language from the front end, to pass to the back-end request as an argument. + +For example if we have German language selected, the request should be: +- curl "http://localhost:2322/api?q=berlin&lang=de" + +Location based searching, relevant results from the same area: + +- If we need exact location based searching, and we access the users location, we can pass the the coordinates from the users login into the request. +- If we only want to give relevant searches based on the selected language, we should use the general coordinates according to each country. +Info:https://git.gerhardt.io/gi/devops/issues/42#issuecomment-597 + +Example for searches based on language: +``` +switch language +case "de": + longitude=10 + latitude=51 +case "hu": + longitude=19 + latitude=47 + ... +request = 'curl "http://localhost:2322/api?q=$searchQuery&lon=$l&lat=55.5123" ' + ... + (make the request, collect results) +``` +# OpenTripPlanner +For OTP, requests require coordinates (from, to) to find a trip between the locations. + +An example request for OTP from within the environment looks like the following: +- `curl "http://localhost:8080/otp/routers/default/plan?fromPlace=48.776277,9.182863&toPlace=46.2564158,20.1508822&mode=WALK,TRANSIT&maxWalkDistance=2000&arriveBy=false&wheelchair=false&locale=en" ` + +If we have the previously selected search results, we can store the values of the selected destination, and pass the coordinates as variables to the OTP request. + +Additional parameters for the search like `mode of transport`, or `arriveBy` can be filled out with variables that contain the settings passed from the front-end. \ No newline at end of file diff --git a/PhotonDetailed.md b/PhotonDetailed.md new file mode 100644 index 00000000..54ff6be8 --- /dev/null +++ b/PhotonDetailed.md @@ -0,0 +1,115 @@ +# **Photon standalone** + +## **In the Local Machine:** +- **Create VM by following the InstallVMGuide.md file (in the gi/devops from Codeberg):** + - https://codeberg.org/gi/devops/src/branch/main/gitea/Documentations/InstallVMGuide.md + - 64GB ram + - 8 cores + - 150G storage + +- **Ask VM's IP address after Installation of the VM:** + - Log in in the terminal: + - `` and `password` + - `ip address` + - Save the IP address + +- **Open the terminal and use the ssh-copy-id command for not typing the password after ssh:** + - `ssh-copy-id -i ~/.ssh/id_rsa.pub @IP` + - Type username's password + +## **In the VM:** +- **Add sudo permission to user of vm:** + - Give the sudo permission to the user in the terminal as root: + - https://phpraxis.wordpress.com/2016/09/27/enable-sudo-without-password-in-ubuntudebian/ + - `su -l` + - `adduser sudo` + - `apt-get install sudo` + - `sudo visudo /etc/sudoers` + - ` ALL=(ALL) NOPASSWD:ALL` to **the end of file** + - `%sudo ALL=(ALL) NOPASSWD:ALL` + - `logout` or `exit` + - `sudo apt-get install curl` + +## **In the Local Machine:** +- **Open the new terminal:** + - `cd ~/Desktop` + - `mkdir git` + - `cd git` + - `git clone https://github.com/fahrgemeinschaft/digitransit-ansible.git` + - `ċd digitransit-ansible` + +- **Create virtual environment and install certain packages:** + - `python3 -m virtualenv venv` + - `. venv/bin/activate` + - `pip3 install -r requirements.txt` + - `ansible --help` + +- **Add user to sudo group:** + - `su` # enter root password here + - `/sbin/usermod -aG sudo ` + +- **Normal user should be able to run sudo commands without PW prompt** + - `su` # enter root password here + - `sudo visudo` /etc/sudoers + - `username ALL=(ALL) NOPASSWD:ALL` to **the end of file** + - `logout` or `exit` + +- **Install geerlingguy.docker:** + - `ansible-galaxy install geerlingguy.docker` + +- **Add user to docker group:** + - `sudo groupadd docker` + - `su` # enter root password here + - `/sbin/usermod -aG docker ` + +## If you want to use it on a local vm or direct IP connection: +- **Change ip address and hostname on the certain files:** + - `nano inventory-local.yml` + - `nano ansible-playbook.yml` OR `nano photon-playbook.yml` + +- **Run the playbook:** + - `make photon-local` +## If you want to use it on a remote machine or with hostname: + - Add ssh configuration on your local machine, if it requires multiple ssh, use proxyjump too: + - `nano .ssh/config` on your local computer + ```bash + Host services1 + HostName 162.55.99.187 + User ride2go + Port 38765 + IdentityFile ~/.ssh/gi-student + + Host photon-services1 + ProxyJump services1 + HostName 192.168.122.91 + User ride2go + Port 22 + IdentityFile ~/.ssh/gi-student + ``` + +- **Change hostname on the certain files:** + - `nano inventory-remote.yml` + - `nano photon-playbook.yml` + +- **Run the playbook:** + - `make photon-remote` + +- **Add VM user to docker group after playbook successfully ran for the first time:** + - `su` # enter root password here + - `/sbin/usermod -aG docker ` + +- **Open the new terminal again:** + - `ssh @IP` + - `docker ps` + - **Take the first 3 character of the nominatim** + - `docker logs $3_character -f` + - **Wait until the LOG shows the line:** (It may takes 40 minutes) + - **database system is ready to accept connections** + - `sudo service photon start` + - `docker ps` + - **Take the first 3 character of the photon** + - `docker logs $3_character -f` + - **Wait until the LOG shows the line:** (It may takes 5 minutes) + - **de.komoot.photon.App - ES cluster is now ready.** + - After them you can call the API with: + - `curl "http://localhost:2322/api/?q=stuttgart&lang=de"` \ No newline at end of file diff --git a/digitransit.yml b/digitransit.yml index f0808865..2454c945 100644 --- a/digitransit.yml +++ b/digitransit.yml @@ -5,8 +5,8 @@ become: yes roles: - base - - delay-prediction-service + #- delay-prediction-service - digitransit - - thingsboard-enhancer - - thingsboard-to-mqtt - - matomo + #- thingsboard-enhancer + #- thingsboard-to-mqtt + #- matomo diff --git a/group_vars/all.yml b/group_vars/all.yml index 81367ff2..2a34741e 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -32,13 +32,13 @@ ssh_allow_tcp_forwarding: 'yes' sftp_enabled: true sftp_chroot: true -certbot_certs: - - domains: - - "{{ hostname }}" - - domains: - - "{{ api_hostname }}" - - domains: - - "{{ matomo_hostname }}" +#certbot_certs: +# - domains: +# - "{{ hostname }}" +# - domains: +# - "{{ api_hostname }}" +# - domains: +# - "{{ matomo_hostname }}" certbot_auto_renew: true certbot_auto_renew_options: --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" @@ -86,218 +86,227 @@ thingsboard_to_mqtt_version: abfbca97df0bcaa1c14a89cbe9dbdebcde7b3816 delay_prediction_service_version: 517c0f8f57224b08317c3904b4370a3d577be87f -delay_postgres_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 63376632663933393033626565303131643664613466373132363633663332633263353364366264 - 3338653066326631643332323065343462383737626361360a663031326532343931646235616135 - 31656530623030313965396431343539363233626662343663396535393331303030653066633563 - 3566663832343935370a626361623634373464636662633033313464616634353062623831646666 - 66323462323330363937353233613064316264656666336562653735303136323362 - - -thingsboard_api_url: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 63323865393163643262666531663932666131383632343932613539636362616632393038333033 - 3137353636313462363762633238346366623539633833300a656330313864356630303736333734 - 63633237313764376130343434626130346533633631613531396565346631623430343232396564 - 6433393934633031340a636538363233616338353062663138393034643563646231343636333762 - 38386536346265383935396261396637323239346566623163373134356537343130643963396535 - 3333316530356564653532653031623037333236343331646337 - -thingsboard_username: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 30313632323462623132613034386165343436333564623938663863613338346235396265663465 - 3064663261643864323632383462643939653766616139640a326130353661386138303562373531 - 66643238373665303766343264353931646561646563393537623661346633323362396331643865 - 6536323930343231370a376265373830336135666134646263373530613533366430313030663938 - 38336530316263333566626364616166323231623939653131393364633130323865 - -thingsboard_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 61333632353830326437306662383832383633363365303535363034326238666533643631643564 - 3038633862636632313536343862333164373863623935350a663634343631613634313266316338 - 65353231306163363130643930633865356161343832383235316539653032316532303662326230 - 3135643035336435610a326634653963393338336330393339316234623863326535643264393863 - 6463 - -thingsboard_weather_username: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 34303739653133353134393263393433623162646261313837383565353766663637343135663863 - 3438646637666438386431363862396234653564373538370a326232363937386666303263363233 - 37393765333539616564666434386262616331373865636131353366363536366633643632633734 - 3234626462333635640a646266356262363262363461313265643265653764646538663432386563 - 36623462663130373232666131323664656332366234343234393164663935646363646131383732 - 6566363830636134633234663131306531373433343763613034 - -thingsboard_weather_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 32383334343862643136353839373565613265623034363833616262356262393231336463313038 - 6238393461666639393937323730343765616531646262630a656565376266613935643734626263 - 62643430326132623966306337363238353530613630666537616161653035633333613161323435 - 3432623232393061650a613034323761613437623837316437643733663932653333633933633432 - 34633466666663373362343562613231386133643332633961353233333065393465 - -fahrgemeinschaft_api_key: !vault | - $ANSIBLE_VAULT;1.2;AES256 - 36333663323931653866633036316433383732333166646232353639343266376663623961636434 - 3963393064633233393033343463373834653931656630330a353764656439623261653736336265 - 36373238623265353338646564346535616361306230393166363836656535653865323166343863 - 3962636134306434380a663434323665396464653764343537363464396438656234353530393132 - 33646236393833323066373565313733623761666234666639366566316236626531326663383637 - 6561323162636666393733333965666665333234343239396236 - -# credentials for the WMTS server available at https://owsproxy.lgl-bw.de/owsproxy/ows/WMTS_LGL-BW_ATKIS_DOP_20_C -wmts_username: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 38663262386239613539643336633963333435313161346363363266623731323362303430336631 - 3663323465636639653761393736666165623665646337330a336434643135373938353036303932 - 34623133323633326265333837626331613031643066613039333432623836633539326531643762 - 3630333330303239610a316334646238663431383565356431333939666131383563643137343066 - 38653534366336316265313062363336366533623731376537353639623561663734 - -wmts_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 64656366363035353766336562343130393233653365643631393865653133666564353862626231 - 3337636161316330346263636562616232353632303364320a383939343631643330396466363237 - 30366636656265343965343931626137383063653835396666343031393636646633663232333531 - 3837646265326661630a356664316131373835373237333062366166313963613938323764336162 - 3237 +# delay_postgres_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 63376632663933393033626565303131643664613466373132363633663332633263353364366264 +# 3338653066326631643332323065343462383737626361360a663031326532343931646235616135 +# 31656530623030313965396431343539363233626662343663396535393331303030653066633563 +# 3566663832343935370a626361623634373464636662633033313464616634353062623831646666 +# 66323462323330363937353233613064316264656666336562653735303136323362 + + +# thingsboard_api_url: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 63323865393163643262666531663932666131383632343932613539636362616632393038333033 +# 3137353636313462363762633238346366623539633833300a656330313864356630303736333734 +# 63633237313764376130343434626130346533633631613531396565346631623430343232396564 +# 6433393934633031340a636538363233616338353062663138393034643563646231343636333762 +# 38386536346265383935396261396637323239346566623163373134356537343130643963396535 +# 3333316530356564653532653031623037333236343331646337 + +# thingsboard_username: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 30313632323462623132613034386165343436333564623938663863613338346235396265663465 +# 3064663261643864323632383462643939653766616139640a326130353661386138303562373531 +# 66643238373665303766343264353931646561646563393537623661346633323362396331643865 +# 6536323930343231370a376265373830336135666134646263373530613533366430313030663938 +# 38336530316263333566626364616166323231623939653131393364633130323865 + +# thingsboard_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 61333632353830326437306662383832383633363365303535363034326238666533643631643564 +# 3038633862636632313536343862333164373863623935350a663634343631613634313266316338 +# 65353231306163363130643930633865356161343832383235316539653032316532303662326230 +# 3135643035336435610a326634653963393338336330393339316234623863326535643264393863 +# 6463 + +# thingsboard_weather_username: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 34303739653133353134393263393433623162646261313837383565353766663637343135663863 +# 3438646637666438386431363862396234653564373538370a326232363937386666303263363233 +# 37393765333539616564666434386262616331373865636131353366363536366633643632633734 +# 3234626462333635640a646266356262363262363461313265643265653764646538663432386563 +# 36623462663130373232666131323664656332366234343234393164663935646363646131383732 +# 6566363830636134633234663131306531373433343763613034 + +# thingsboard_weather_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 32383334343862643136353839373565613265623034363833616262356262393231336463313038 +# 6238393461666639393937323730343765616531646262630a656565376266613935643734626263 +# 62643430326132623966306337363238353530613630666537616161653035633333613161323435 +# 3432623232393061650a613034323761613437623837316437643733663932653333633933633432 +# 34633466666663373362343562613231386133643332633961353233333065393465 + +# fahrgemeinschaft_api_key: !vault | +# $ANSIBLE_VAULT;1.2;AES256 +# 36333663323931653866633036316433383732333166646232353639343266376663623961636434 +# 3963393064633233393033343463373834653931656630330a353764656439623261653736336265 +# 36373238623265353338646564346535616361306230393166363836656535653865323166343863 +# 3962636134306434380a663434323665396464653764343537363464396438656234353530393132 +# 33646236393833323066373565313733623761666234666639366566316236626531326663383637 +# 6561323162636666393733333965666665333234343239396236 + +# # credentials for the WMTS server available at https://owsproxy.lgl-bw.de/owsproxy/ows/WMTS_LGL-BW_ATKIS_DOP_20_C +# wmts_username: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 38663262386239613539643336633963333435313161346363363266623731323362303430336631 +# 3663323465636639653761393736666165623665646337330a336434643135373938353036303932 +# 34623133323633326265333837626331613031643066613039333432623836633539326531643762 +# 3630333330303239610a316334646238663431383565356431333939666131383563643137343066 +# 38653534366336316265313062363336366533623731376537353639623561663734 + +# wmts_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 64656366363035353766336562343130393233653365643631393865653133666564353862626231 +# 3337636161316330346263636562616232353632303364320a383939343631643330396466363237 +# 30366636656265343965343931626137383063653835396666343031393636646633663232333531 +# 3837646265326661630a356664316131373835373237333062366166313963613938323764336162 +# 3237 # photon/nominatim osm_pbf_url: http://download.geofabrik.de/europe/dach-latest.osm.pbf osm_updates_url: http://download.geofabrik.de/europe/dach-updates/ nominatim_import_wikipedia: "true" -matrix_bot_token: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 35353764626465333062623964663963646634326631346430333861333033323035366230396230 - 6164373265363465386633663134376632323134636537620a303763346166613436373436396135 - 38323563333336643662383266353232343933353234316433383830656132343562353766346133 - 6639316137346139300a643439393761383565386137363137373836303261643134323933353734 - 36663533643837653766363165343638366236656531373936366564656364356138336230393666 - 36633732663233613330363235623964303831323831636461663364396564616239353233613738 - 30356130633534376662306234376261323432653132636461343561623361633064656564626366 - 62353961663863343536303665313935633865653663303366633962663165306231373135303662 - 37663139376664333661346135306666383534306136363435613230646366343330636466376232 - 61396637383334653030336364366462613335656462623834353931313666636434343061656330 - 39653961616334353663613662376332646635616139626636386335316432303939363836663764 - 34626562396236333539346331323838626237363061303037343738313862326232386133643330 - 65323538643166373565663462376434393465653730383536656634366639346235396638623135 - 31316562383263626236626364613732373330323536356439633438366639386366313130323266 - 32363165343663663236636131303633336232656262306332353662623761656536653532326638 - 32326565633830373134616562323834663863396530646232356438623638323833333338306632 - 66626564333430663433373436623935363631313364383463313065383731396536363863323864 - 3334623061363831383633396437653131626233323764613733 - -mqtt_publisher_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 32633035613863366163393036636239346533623935633633326262666163323066643232623865 - 6633363830663934323466356666363264653936636262610a363833323566396531343232366234 - 35633731303566373566326261356539303362366166383334333737653863363030356139333234 - 6638303534383666330a313536326539343538316636373661623239376439646637643433393864 - 38343439396564663765316638383538313230633734373235653237656333613663 - -mfdz_gtfs_url: !vault | - $ANSIBLE_VAULT;1.2;AES256;dev - 35396335383261346431333061363235396261323139393030663134376361343330663032386564 - 6432613863623765343533313732383163356631313631330a376263653230616434376262333136 - 35306365353562646437393863653831663832393230346332383732326338653032363837326563 - 6563393164306136630a666361373931373161333866396364333761303935656263366235316533 - 33333835616533633062326536666131623438323461393562626631363463323638643962303633 - 64616663323662353932653166393339356337656433333337353135353931333833363336336636 - 343236353361356530623266303636356338 - -mfdz_gtfsrt_url: !vault | - $ANSIBLE_VAULT;1.2;AES256;dev - 38663565313131353263353730636632386137383666623039373063336162356532643430333061 - 3262363861646338386530613539663864646465326333360a383035613564376236626137633933 - 63653263343030636635656531613162626538626138393531653437636263373335313464353238 - 3466383137636632660a313431386466623535363761383765346538663835636230613131316261 - 38623030316366316139653361366232313964643662363339366433316430656364623236663661 - 33666538323433386164376263383764323666656437646538373861636564646366646438313036 - 663361626262373930333164646431313865 - -trias_api_key: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 63373235333937343737373331646466303232386165663463353863613532373038393033646638 - 3735303661386230343764663539313063353039373964350a623530343766666663313339353036 - 38363736393062353365323932613066346430373263366262303538656335353963323839323239 - 6331666361343566650a323663643864393931396337393933656138633637313439336136663064 - 62363037386134666235613333653366623238316466313832643161386434323337 - -matomo_db_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 37303063633034313834623462316132643639656165356534373266626434313730633234383939 - 3633633563386266346531366233306333393763303035360a303164353665383631633639666237 - 31353665613634373563666662386561626339616331326363333366373834366339386466613630 - 3666303466363038310a363331333338656666346633363364363239656535613164613135386665 - 62323266366466346338346465613634646631663036663763313464333961636162363633656430 - 6261613436663939366639663261626530383065363935386163 - -matomo_db_root_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 35373739333836633966326430636164663164353966656561346264656538303135653361393163 - 3933653463656235306664333533356665306566353531370a303237326537386264303135373965 - 32613161396664663238326361636533323538313033343934613265376166396533633566333136 - 6133643664626531340a303530343062613335613662313833653131343130383635383033396463 - 64386237323337623061336466343066393232633638646538336162373631323839383635303562 - 6138626538356638663630303966353739316135656162613465 - -stadtnavi_backup_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 64316261323166643964366137333065356638313764363737646363373265383639333936353963 - 3333353138663536343536313138306338386365373838310a636435633761383039333665636564 - 34643862656635356631373739326664646261333139353238663131313965343062363264643030 - 3335663538306364390a383138663165376665333739666262303736373762653230343838373166 - 64313731643562663866393034623864393636656534343534633466333635383437 - -tier_reutlingen_api_key: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 37623661333333653565353637613635663961623738626366343932353663643236613035383732 - 3265666663323564323035333536636162663635623735360a313364363161666436653432303330 - 37666134326133633865316236303834656263613431326361626137616138383635626464666631 - 3334653838393337330a616264323861313362663935633034313864376564613861396337663465 - 34393539383663346531623264656263313438373561663066663734333631336334623165636433 - 6333393663663964343733303130633538353766323434306361 - -tier_ludwigsburg_api_key: !vault | - $ANSIBLE_VAULT;1.2;AES256;dev - 33633665316434373038663162613932376465626165343439396330646365393365386137363538 - 3865623739303762383331663737616537663437363236380a646439623134636139363263613963 - 31616331343465623831323734353865383637623138613561383530323431643031633636303964 - 3936643232616635350a313561346435643033336533626439366565303735303338613937343462 - 39363430323766633464373666326235343231633835616232643538353235323666613633383666 - 3463306139643433356133616635303534383163393930396139 - -tier_munsingen_api_key: !vault | - $ANSIBLE_VAULT;1.2;AES256;dev - 38623962373863386661306132646231336164646366356363356166653166326134316532383166 - 6666643763653730333766643464343437623634316432660a316134646639366637363365396265 - 38663630396130346236393231663563326139343732663931363036306662343366383866356362 - 3338613566363433300a623934383631393238633133323633326562653263663865383166363961 - 38363463316638306239656436616432383762626639613333316166336163666632386262666339 - 3734333834346665623733313239376237366364623037363039 +# matrix_bot_token: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 35353764626465333062623964663963646634326631346430333861333033323035366230396230 +# 6164373265363465386633663134376632323134636537620a303763346166613436373436396135 +# 38323563333336643662383266353232343933353234316433383830656132343562353766346133 +# 6639316137346139300a643439393761383565386137363137373836303261643134323933353734 +# 36663533643837653766363165343638366236656531373936366564656364356138336230393666 +# 36633732663233613330363235623964303831323831636461663364396564616239353233613738 +# 30356130633534376662306234376261323432653132636461343561623361633064656564626366 +# 62353961663863343536303665313935633865653663303366633962663165306231373135303662 +# 37663139376664333661346135306666383534306136363435613230646366343330636466376232 +# 61396637383334653030336364366462613335656462623834353931313666636434343061656330 +# 39653961616334353663613662376332646635616139626636386335316432303939363836663764 +# 34626562396236333539346331323838626237363061303037343738313862326232386133643330 +# 65323538643166373565663462376434393465653730383536656634366639346235396638623135 +# 31316562383263626236626364613732373330323536356439633438366639386366313130323266 +# 32363165343663663236636131303633336232656262306332353662623761656536653532326638 +# 32326565633830373134616562323834663863396530646232356438623638323833333338306632 +# 66626564333430663433373436623935363631313364383463313065383731396536363863323864 +# 3334623061363831383633396437653131626233323764613733 + +# mqtt_publisher_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 32633035613863366163393036636239346533623935633633326262666163323066643232623865 +# 6633363830663934323466356666363264653936636262610a363833323566396531343232366234 +# 35633731303566373566326261356539303362366166383334333737653863363030356139333234 +# 6638303534383666330a313536326539343538316636373661623239376439646637643433393864 +# 38343439396564663765316638383538313230633734373235653237656333613663 + +#mfdz_gtfs_url: "gtfs.ride2go.com" +# #mfdz_gtfs_url: !vault | +# # $ANSIBLE_VAULT;1.2;AES256;dev +# # 35396335383261346431333061363235396261323139393030663134376361343330663032386564 +# # 6432613863623765343533313732383163356631313631330a376263653230616434376262333136 +# # 35306365353562646437393863653831663832393230346332383732326338653032363837326563 +# # 6563393164306136630a666361373931373161333866396364333761303935656263366235316533 +# # 33333835616533633062326536666131623438323461393562626631363463323638643962303633 +# # 64616663323662353932653166393339356337656433333337353135353931333833363336336636 +# # 343236353361356530623266303636356338 + + + +# mfdz_gtfsrt_url: !vault | +# $ANSIBLE_VAULT;1.2;AES256;dev +# 38663565313131353263353730636632386137383666623039373063336162356532643430333061 +# 3262363861646338386530613539663864646465326333360a383035613564376236626137633933 +# 63653263343030636635656531613162626538626138393531653437636263373335313464353238 +# 3466383137636632660a313431386466623535363761383765346538663835636230613131316261 +# 38623030316366316139653361366232313964643662363339366433316430656364623236663661 +# 33666538323433386164376263383764323666656437646538373861636564646366646438313036 +# 663361626262373930333164646431313865 + +# trias_api_key: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 63373235333937343737373331646466303232386165663463353863613532373038393033646638 +# 3735303661386230343764663539313063353039373964350a623530343766666663313339353036 +# 38363736393062353365323932613066346430373263366262303538656335353963323839323239 +# 6331666361343566650a323663643864393931396337393933656138633637313439336136663064 +# 62363037386134666235613333653366623238316466313832643161386434323337 + +# matomo_db_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 37303063633034313834623462316132643639656165356534373266626434313730633234383939 +# 3633633563386266346531366233306333393763303035360a303164353665383631633639666237 +# 31353665613634373563666662386561626339616331326363333366373834366339386466613630 +# 3666303466363038310a363331333338656666346633363364363239656535613164613135386665 +# 62323266366466346338346465613634646631663036663763313464333961636162363633656430 +# 6261613436663939366639663261626530383065363935386163 + +# matomo_db_root_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 35373739333836633966326430636164663164353966656561346264656538303135653361393163 +# 3933653463656235306664333533356665306566353531370a303237326537386264303135373965 +# 32613161396664663238326361636533323538313033343934613265376166396533633566333136 +# 6133643664626531340a303530343062613335613662313833653131343130383635383033396463 +# 64386237323337623061336466343066393232633638646538336162373631323839383635303562 +# 6138626538356638663630303966353739316135656162613465 + +# stadtnavi_backup_password: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 64316261323166643964366137333065356638313764363737646363373265383639333936353963 +# 3333353138663536343536313138306338386365373838310a636435633761383039333665636564 +# 34643862656635356631373739326664646261333139353238663131313965343062363264643030 +# 3335663538306364390a383138663165376665333739666262303736373762653230343838373166 +# 64313731643562663866393034623864393636656534343534633466333635383437 + +# tier_reutlingen_api_key: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 37623661333333653565353637613635663961623738626366343932353663643236613035383732 +# 3265666663323564323035333536636162663635623735360a313364363161666436653432303330 +# 37666134326133633865316236303834656263613431326361626137616138383635626464666631 +# 3334653838393337330a616264323861313362663935633034313864376564613861396337663465 +# 34393539383663346531623264656263313438373561663066663734333631336334623165636433 +# 6333393663663964343733303130633538353766323434306361 + +# tier_ludwigsburg_api_key: !vault | +# $ANSIBLE_VAULT;1.2;AES256;dev +# 33633665316434373038663162613932376465626165343439396330646365393365386137363538 +# 3865623739303762383331663737616537663437363236380a646439623134636139363263613963 +# 31616331343465623831323734353865383637623138613561383530323431643031633636303964 +# 3936643232616635350a313561346435643033336533626439366565303735303338613937343462 +# 39363430323766633464373666326235343231633835616232643538353235323666613633383666 +# 3463306139643433356133616635303534383163393930396139 + +# tier_munsingen_api_key: !vault | +# $ANSIBLE_VAULT;1.2;AES256;dev +# 38623962373863386661306132646231336164646366356363356166653166326134316532383166 +# 6666643763653730333766643464343437623634316432660a316134646639366637363365396265 +# 38663630396130346236393231663563326139343732663931363036306662343366383866356362 +# 3338613566363433300a623934383631393238633133323633326562653263663865383166363961 +# 38363463316638306239656436616432383762626639613333316166336163666632386262666339 +# 3734333834346665623733313239376237366364623037363039 enable_maintenance_page: false -enable_prediction_service: true -enable_mosquitto: true -enable_fares: true -enable_gtfs_rt: true +#enable_prediction_service: true +#enable_mosquitto: true +#enable_fares: true +#enable_gtfs_rt: true +enable_prediction_service: false +enable_mosquitto: false +enable_fares: false +enable_gtfs_rt: false enable_fake_bike_box: false -kvv_gtfs_rt_url: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 62656339633037626565396537336537666663663133396430386536396262663066353465346131 - 6365363466376432633561666561326232633161623362300a303739643732336337363533396330 - 62613938303663356235626464656234653363396162396661623465653162656235303263653766 - 3161636362396534650a666565646364323037333730613530373861613863373365646261653833 - 61303638613437636466653038343766343834353766326162323538643764346164613833666637 - 6665303730326137623134316530623131656330613862326665 - -osm_url: https://gtfs.mfdz.de/bw-buffered.osm.pbf +# kvv_gtfs_rt_url: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 62656339633037626565396537336537666663663133396430386536396262663066353465346131 +# 6365363466376432633561666561326232633161623362300a303739643732336337363533396330 +# 62613938303663356235626464656234653363396162396661623465653162656235303263653766 +# 3161636362396534650a666565646364323037333730613530373861613863373365646261653833 +# 61303638613437636466653038343766343834353766326162323538643764346164613833666637 +# 6665303730326137623134316530623131656330613862326665 + +#osm_url: https://gtfs.mfdz.de/bw-buffered.osm.pbf +#osm_url: http://download.geofabrik.de/europe/germany/baden-wuerttemberg/stuttgart-regbez-latest.osm.pbf +osm_url: http://download.geofabrik.de/europe/germany/hamburg-latest.osm.pbf gtfs_urls: - https://gtfs.mfdz.de/hbg6.merged.with_flex.gtfs.zip - https://gtfs.mfdz.de/KVV.with_shapes.gtfs.zip - - "{{ mfdz_gtfs_url }}" + #- "{{ mfdz_gtfs_url }}" diff --git a/requirements.yml b/requirements.yml index 3cb818d1..4f805a17 100644 --- a/requirements.yml +++ b/requirements.yml @@ -7,8 +7,8 @@ collections: roles: - src: geerlingguy.docker version: 4.1.0 -- src: geerlingguy.certbot - version: 4.2.0 +#- src: geerlingguy.certbot +# version: 4.2.0 - src: geerlingguy.swap version: 1.0.1 - src: geerlingguy.firewall diff --git a/ride2go-inventory.yml b/ride2go-inventory.yml new file mode 100644 index 00000000..b1b88075 --- /dev/null +++ b/ride2go-inventory.yml @@ -0,0 +1,6 @@ +all: + hosts: + debian: + ansible_host: 192.168.122.138 + ansible_user: user + ansible_ssh_private_key_file: ~/.ssh/id_rsa diff --git a/roles/base/tasks/main.yml b/roles/base/tasks/main.yml index 290ba872..595d4b14 100644 --- a/roles/base/tasks/main.yml +++ b/roles/base/tasks/main.yml @@ -53,14 +53,14 @@ enabled: yes daemon_reload: yes -- name: Copy send-to-matrix script - template: - src: "{{ item }}" - dest: /usr/local/bin - mode: 711 - with_items: - - send-to-matrix - - systemd-failure-notification +#- name: Copy send-to-matrix script +# template: +# src: "{{ item }}" +# dest: /usr/local/bin +# mode: 711 +# with_items: +# - send-to-matrix +# - systemd-failure-notification - name: Install journald.conf template: src={{ item }} dest=/etc/systemd/ diff --git a/roles/base/vars/main.yml b/roles/base/vars/main.yml new file mode 100644 index 00000000..1f197748 --- /dev/null +++ b/roles/base/vars/main.yml @@ -0,0 +1,8 @@ +#server_name: !vault | +# $ANSIBLE_VAULT;1.1;AES256 +# 63363339623865316235626536616639313663633031366261663830373863663933626166313230 +# 6163646235306463613233663230343961386337313261380a306534616163663935333238623337 +# 36366666396238373962333237376534313564383863343364643761326133663761323433633763 +# 6439316433333766310a313234373436363266326535646231303962623762336138636662376630 +# 6231 +server_name: localhost \ No newline at end of file diff --git a/roles/digitransit/tasks/main.yml b/roles/digitransit/tasks/main.yml index d6e1745e..b8c16a74 100644 --- a/roles/digitransit/tasks/main.yml +++ b/roles/digitransit/tasks/main.yml @@ -57,22 +57,22 @@ ansible.builtin.template: src: docker-compose.yml dest: /etc/digitransit/docker-compose.yml - notify: Restart digitransit-ui + # notify: Restart digitransit-ui -- name: Copy main host nginx site conf - ansible.builtin.template: - src: nginx/nginx-site.conf - dest: /etc/nginx/sites-enabled/{{ item.domain }}.conf - with_items: "{{ digitransit_ui }}" - notify: Restart nginx +#- name: Copy main host nginx site conf +# ansible.builtin.template: +# src: nginx/nginx-site.conf +# dest: /etc/nginx/sites-enabled/{{ item.domain }}.conf +# with_items: "{{ digitransit_ui }}" +# notify: Restart nginx -- name: Copy api host nginx site conf - ansible.builtin.template: - src: nginx/nginx-site-api.conf - dest: /etc/nginx/sites-enabled/{{ item }}.conf - with_items: - - "{{ api_hostname }}" - notify: Restart nginx +#- name: Copy api host nginx site conf +# ansible.builtin.template: +# src: nginx/nginx-site-api.conf +# dest: /etc/nginx/sites-enabled/{{ item }}.conf +# with_items: +# - "{{ api_hostname }}" +# notify: Restart nginx - name: Remove the old nginx configs file: diff --git a/roles/digitransit/templates/build-graph b/roles/digitransit/templates/build-graph index 147da809..22465211 100644 --- a/roles/digitransit/templates/build-graph +++ b/roles/digitransit/templates/build-graph @@ -18,7 +18,7 @@ docker stop $CONTAINER_NAME || true mkdir -p build cd build - +echo "TESTING NOW" # extract elevation zip files for i in "${ELEVATION_FILES[@]}" do @@ -29,38 +29,39 @@ do echo "$zipfile exists." else echo "$tiffile does not exist. Downloading ..." - curl --fail --location -s "${ELEVATION_BASE_URL}{$zipfile}" -o ${zipfile} + #echo "curl --fail --location -s ${ELEVATION_BASE_URL}${zipfile} -o ${zipfile}" + df -h + # -k for allowing http connection, removed -s and fixed variable typos + # remove --fail to see errors on exit + curl -k --location "${ELEVATION_BASE_URL}${zipfile}" -o ${zipfile} + echo "Zip curl executed " unzip ${zipfile} ${tiffile} + echo "Zip unzipped " rm ${zipfile} + echo "zip removed " fi done - -curl --location --fail -s "${PBF_DOWNLOAD_URL}" -o ${PBF_FILE} - +echo "debug PHASE 2 " +curl -k --location "${PBF_DOWNLOAD_URL}" -o ${PBF_FILE} +echo "debug PHASE 3 " rm -rf gtfs.zip rm -rf *.gtfs.zip - +echo "debug PHASE 4 " for i in "${GTFS_DOWNLOAD_URLS[@]}" do : hash=`cksum <<< "${i}"s | cut -f 1 -d ' '` filename=`basename ${i}` output="${filename}.${hash}.gtfs.zip" - curl -L --fail ${i} -o ${output} + curl -L ${i} -o ${output} done - +echo "debug PHASE 5 " docker pull ${IMAGE_NAME} -docker run \ - -v /var/graph-build/${BUILD_DIR}:/opt/opentripplanner/graph \ - --name ${CONTAINER_NAME} \ - --rm \ - --cpu-shares 512 \ - -e JAVA_OPTS="-Xmx24G" \ - ${IMAGE_NAME} --build --save graph \ +docker run -v /var/graph-build/${BUILD_DIR}:/opt/opentripplanner/graph --name ${CONTAINER_NAME} --rm --cpu-shares 512 -e JAVA_OPTS="-Xmx24G" ${IMAGE_NAME} --build --save graph echo "${IMAGE_NAME}" > otp-image-version - +echo "debug PHASE 6 " cd .. mkdir -p ${OUTPUT_DIR} cp ${BUILD_DIR}/graph.obj ${OUTPUT_DIR}/ @@ -69,6 +70,6 @@ cp ${BUILD_DIR}/*.json ${OUTPUT_DIR} if [ -d "${BUILD_DIR}/report" ]; then cp -r "${BUILD_DIR}/report/" "${OUTPUT_DIR}" fi +echo "debug PHASE 7 " - -send-to-matrix "📦️ OTP graph build complete on {{ inventory_hostname }}" +#send-to-matrix "📦️ OTP graph build complete on {{ inventory_hostname }}" diff --git a/roles/digitransit/templates/docker-compose.yml b/roles/digitransit/templates/docker-compose.yml index 703f69a7..9db5b481 100644 --- a/roles/digitransit/templates/docker-compose.yml +++ b/roles/digitransit/templates/docker-compose.yml @@ -2,91 +2,22 @@ version: '3' services: opentripplanner: - image: {{ digitransit["images"]["otp"] }} + #image: mfdz/opentripplanner:d38ffb9c2d7c52ff1f89423b077714e4a2c8d5de + image: mfdz/opentripplanner:latest restart: on-failure:5 container_name: opentripplanner logging: driver: journald ports: - - {{otp_port}}:8080 + - 8080:8080 command: --load --serve graph environment: - ROUTER_NAME=hb - - API_URL=https://{{ api_hostname }}/otp/ - - ENCRYPTION_SECRET_KEY={{ encryption_secret_key }} - - JAVA_OPTS=-Xmx{{ otp_max_mem }} -XX:+FlightRecorder + - API_URL=https://api.stadtnavi.de/otp/ + - JAVA_OPTS=-Xmx20G -XX:+FlightRecorder volumes: - /var/graph-build/latest/:/opt/opentripplanner/graph/ - digitransit-ui: - image: {{ digitransit["images"]["ui"] }} - restart: on-failure - container_name: digitransit-ui - ports: - - {{ digitransit_ui_port }}:8080 - networks: - - digitransit - logging: - driver: journald - environment: - - GEOCODING_BASE_URL={{ photon_url }}/pelias/v1 - - API_URL=https://{{ api_hostname }} - - MAP_URL={{ map_url }} - - SEMI_TRANSPARENT_MAP_URL={{ semi_transparent_map_url }} - - BIKE_MAP_URL={{ bike_map_url }} - - NODE_ENV=production - - FAHRGEMEINSCHAFT_API_KEY={{ fahrgemeinschaft_api_key }} - - SHOW_TICKETS={{ enable_fares | to_json }} - - MATOMO_URL={{ matomo_url }} - -{% if digitransit["images"]["map_server"] is defined %} - hsl-map-server: - image: {{ digitransit["images"]["map_server"] }} - container_name: hsl-map-server - restart: on-failure:5 - networks: - - digitransit - ports: - - {{ map_server_port }}:8080 - environment: - - PARK_API_URL=https://{{ api_hostname }}/herrenberg/parking/parkapi.json - - GRAPHQL_URL=https://{{ api_hostname }}/routing/v1/router/index/graphql - - OTP_URL=https://{{ api_hostname }}/routing/v1/router/index/graphql - - CIFS_URL=https://data.mfdz.de/hbg/roadworks/cifs.json - - WEATHER_STATIONS_URL=https://{{ api_hostname }}/herrenberg/weather/weather.geojson - - CHARGING_STATIONS_URL=https://{{ api_hostname }}/herrenberg/charging-stations/charging-stations.geojson - logging: - driver: journald -{% endif %} - - graphiql: - image: corykitchens/graphiql:latest - container_name: graphiql - restart: on-failure:5 - networks: - - digitransit - ports: - - {{ graphiql_port }}:4000 - environment: - - API_URL=https://api.dev.stadtnavi.eu/routing/v1/router/index/graphql - logging: - driver: journald - -{% if digitransit["images"]["fares_service"] is defined %} - fares-service: - image: {{ digitransit["images"]["fares_service"] }} - container_name: fares-service - restart: on-failure:5 - networks: - - digitransit - ports: - - {{ fares_service_port }}:3000 - environment: - - TRIAS_REQUESTOR_REF={{ trias_api_key }} - logging: - driver: journald -{% endif %} - networks: digitransit: # all default diff --git a/roles/digitransit/templates/systemd/graph-build.service b/roles/digitransit/templates/systemd/graph-build.service index 84faf402..4b6dc384 100644 --- a/roles/digitransit/templates/systemd/graph-build.service +++ b/roles/digitransit/templates/systemd/graph-build.service @@ -14,7 +14,7 @@ ExecStart=/var/graph-build/build-graph # force stop after 6 hours RuntimeMaxSec=21600 -ExecStopPost=systemd-failure-notification "Graph build" +# ExecStopPost=systemd-failure-notification "Graph build" Restart=on-failure diff --git a/roles/digitransit/vars/main.yml b/roles/digitransit/vars/main.yml new file mode 100644 index 00000000..f6a77427 --- /dev/null +++ b/roles/digitransit/vars/main.yml @@ -0,0 +1,17 @@ +hostname: "localhost" +api_hostname: "localhost" +#api_hostname: "api.stadtnavi.de" +matomo_hostname: "localhost" +encryption_secret_key: "123456" +otp_max_mem: "20G" +#otp_docker_tag: d38ffb9c2d7c52ff1f89423b077714e4a2c8d5de +otp_docker_tag: latest +otp_router_config: hamburg/router-config.json + +digitransit: + images: + proxy: stadtnavi/digitransit-proxy:latest + otp: mfdz/opentripplanner:{{ otp_docker_tag }} + data_container: mfdz/opentripplanner-data-container-hb:local + #ui: stadtnavi/digitransit-ui:latest + map_server: stadtnavi/hsl-map-server:latest \ No newline at end of file diff --git a/roles/mqtt/meta/main.yml b/roles/mqtt/meta/main.yml index 2f3d253c..c0edba07 100644 --- a/roles/mqtt/meta/main.yml +++ b/roles/mqtt/meta/main.yml @@ -1,3 +1,3 @@ --- dependencies: - - role: geerlingguy.certbot + #- role: geerlingguy.certbot diff --git a/roles/nginx/meta/main.yml b/roles/nginx/meta/main.yml index 2f3d253c..c0edba07 100644 --- a/roles/nginx/meta/main.yml +++ b/roles/nginx/meta/main.yml @@ -1,3 +1,3 @@ --- dependencies: - - role: geerlingguy.certbot + #- role: geerlingguy.certbot diff --git a/roles/tileserver/meta/main.yml b/roles/tileserver/meta/main.yml index 96c83fd6..84695e94 100644 --- a/roles/tileserver/meta/main.yml +++ b/roles/tileserver/meta/main.yml @@ -3,4 +3,4 @@ dependencies: - role: base - role: nginx - role: geerlingguy.docker - - role: geerlingguy.certbot + #- role: geerlingguy.certbot diff --git a/secrets.yml b/secrets.yml new file mode 100644 index 00000000..e69de29b