/Ansible-Onedataportal-UPT

Ansible playbooks for deploying One Data Portal

Primary LanguageJinjaMIT LicenseMIT

Ansible-Onedataportal-UPT

Ansible playbooks for automatic deployment of the One Data Portal (Portal Satu Data) comprising of CKAN version 2.8.3 and Oskari version 1.55.2. This also includes integration with the Urban Planning Tools (UPT) for Oskari, UrbanPerformance and SuitAbility/UrbanHotspots.

Requirements

Target server

  • A fresh installed Ubuntu Server 18.04 (minimum 8 GB RAM and 20 GB of free space) with a user that is part of the sudo group (IMPORTANT: using the root user is not recommended since by default the server provisioning playbook 0_provision_server.yml will disable root user login for better security). Below is an example of a user called username that is created and added to the sudo group.
    adduser username
    usermod -aG sudo username
    
  • The server is fully updated and configured with a static IP address (below is an example setting the server IP address to 192.168.1.200 on the enp0s3 network interface, check the available interface name with ifconfig)
    sudo apt update && sudo apt upgrade
    sudo nano /etc/netplan/50-cloud-init.yaml
    
    network:
       ethernets:
           enp0s3:
               dhcp4: no
               addresses: [192.168.1.200/24]
               gateway4: 192.168.1.1
               nameservers:
                   addresses: [8.8.8.8,8.8.4.4]
       version: 2
    
    sudo netplan apply
    sudo reboot
    
  • Ansible installed on the target server
    sudo apt update
    sudo apt install -y software-properties-common
    sudo apt-add-repository --yes --update ppa:ansible/ansible
    sudo apt install -y ansible
    ansible --version
      ansible 2.9.6
        config file = /etc/ansible/ansible.cfg
        configured module search path = [u'/home/user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
        ansible python module location = /usr/lib/python2.7/dist-packages/ansible
        executable location = /usr/bin/ansible
        python version = 2.7.17 (default, Nov  7 2019, 10:07:09) [GCC 7.4.0]
    

WIP Instructions

  • Install Python 3.7 >=.
  • Run the following command to avoid conflicts using apt:
    sudo ln -s apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so
    

How to run

SSH to the target server and perform the following steps:

  • Clone this repo (install git package if necessary)

    # clone the ansible playbook repo to /opt
    cd /opt
    # become root user
    sudo su
    git clone https://github.com/UPTechMX/Ansible-Onedataportal-UPT.git
    cd Ansible-Onedataportal-UPT
    
  • Configure the mandatory playbook variables

    • nano vars_provision_server.yml
      server_timezone: set this to the server's timezone (default is Asia/Makassar)
      
    • nano vars_postgresql.yml
      (Optional, recommended) postgres_user_password: change the password for the default postgres role
      
    • nano vars_ckan.yml
      ckan_site_url: set this to the IP address or domain name of the server where CKAN will be accessed (default is http://192.168.1.200)
      (Optional, recommended) ckan_admin.username: set the username for the CKAN admin user (default is admin)
      (Optional, recommended) ckan_admin.password: set the default password for the CKAN admin user
      (Optional) ckan_max_resource_size: change the default resource file size upload limit (default is 100 MB)
      (Optional) ckan_max_image_size: change the default image file size upload limit (default is 10 MB)
      (Optional) ckan_locale_default: change the default locale for CKAN
      
    • nano vars_oskari.yml
      oskari_domain: set this to the IP address or domain name of the server where Oskari will be accessed (default is http://192.168.1.200:8080)
      
    • nano vars_upt.yml
      up_backend_host: set this to the IP address or domain name of the server from which the UrbanPerformance module will be accessed
      up_backend_port: set this to port of the server from which the UrbanPerformance module will be accessed (default is 91)
      distance_backend_host: set this to the IP address or domain name of the server from which the distance evaluation module will be accessed
      distance_backend_port: set this to the port of the server from which the distance evaluation module will be accessed (default is 90)
      
  • Run the playbooks

    • Recommended method: run the install all playbook to install everything in order
      • This will run the playbooks above in correct order from 0 to 6
        cd /opt/Ansible-Onedataportal-UPT
        # become root user
        sudo su
        ansible-playbook -K -i inventory install_all.yml
          BECOME password: enter the user's sudo password
        
    • Or one by one
      • Must be run in the order of the filename
        cd /opt/Ansible-Onedataportal-UPT
        # become root user
        sudo su
        ansible-playbook -K -i inventory 0_provision_server.yml
          BECOME password: enter the user's sudo password
        ansible-playbook -K -i inventory 1_install_postgresql.yml
        ansible-playbook -K -i inventory 2_install_solr.yml
        ansible-playbook -K -i inventory 3_install_ckan.yml
        ansible-playbook -K -i inventory 4_install_ckan_extras.yml
        ansible-playbook -K -i inventory 5_install_oskari.yml
        
    • NOTE: to speed up installation copy solr-6.5.1.tgz, jetty-9.4.12-oskari.zip, geoserver-2.13.2-war.zip, and oskari-map.war to /tmp to skip the long tasks for downloading and building
    • Optional: install the development tools for customizing/building Oskari components
      • Refer to https://oskari.org/documentation/backend/setup-development
      • PostgreSQL and PostGIS must be installed first if they haven't been installed above
        cd /opt/Ansible-Onedataportal-UPT
        # become root user
        sudo su
        ansible-playbook -K -i inventory 1_install_postgresql.yml
          BECOME password: enter the user's sudo password
        ansible-playbook -K -i inventory 6_install_oskari_development.yml
        
  • Some manual configuration might be needed to achieve the following (this is optional):

    • Configure firewall to further secure the server
    • Reverse proxy a (sub)domain with SSL certificate
    • Change the default passwords for CKAN/Oskari/GeoServer
    • Modify advanced CKAN and Oskari settings
      • Default CKAN configuration file path is /etc/ckan/ckan/production.ini
      • Default Oskari configuration file path is /opt/oskari/oskari-server/resources/oskari-ext.properties
    • Using and updating a non-english localization
    • Building Oskari frontend and server components
    • Check this repo's wiki for more details
  • Reboot the server

    sudo reboot
    
  • Install the oskari application and server extension for a municipality

    cd /opt/Ansible-Onedataportal-UPT
    # become root user
    sudo su
    # For Balikpapan
    ansible-playbook -K -i inventory install_oskari_balikpapan.yml
    # or for Denpasar
    ansible-playbook -K -i inventory install_oskari_denpasar.yml
    
  • Install the UPT GUI and server extension according to the municipality

    # For Balikpapan
    sudo ansible-playbook -K -i inventory install_upt_oskari_satu_integration_bpn.yml
    # or for Denpasar
    sudo ansible-playbook -K -i inventory install_upt_oskari_satu_integration_dps.yml
    
  • Access the One Data Portal at the server's IP address or domain name on a web browser:

  • Read the wiki for reverse proxy configurations (for use with domains) and VERY IMPORTANT instructions for CKAN in order to use UrbanHotspots/UrbanPerformance

  • Done!

Additional links

  • Ansible playbook for the installation of the UrbanPerformance and distance evaluation modules for the UPT (IMPORTANT for vars_upt.yml)
  • UPT Oskari server extension which is installed through the ansible playbooks in this repo
  • UPT GUI which is installed through the ansible playbooks in this repo