# Configure SenSeeAct

# Apache

If you followed the guide to install the server, you can enable SenSeeAct in Apache with the following steps.

  • Open a terminal to your server (Windows, Mac).
  • Create file 101-www-senseeact.conf in nano:
    $ cd /etc/apache2/sites-available/www-available
    $ sudo nano 101-www-senseeact.conf
    
  • If you want to install the web application at https://www.example.com/, then add the following content:
    ProxyPass "/servlets/senseeact" "ajp://localhost:10003/servlets/senseeact"
    
    <Location "/">
        ProxyPass "http://localhost:10000/"
        ProxyPassReverse "http://localhost:10000/"
    </Location>
    
  • If you want to install the web application at https://www.example.com/senseeact/, then add the following content:
    ProxyPass "/servlets/senseeact" "ajp://localhost:10003/servlets/senseeact"
    
    <Location "/senseeact/">
        ProxyPass "http://localhost:10000/senseeact/"
        ProxyPassReverse "http://localhost:10000/senseeact/"
    </Location>
    
  • Save the file with Ctrl+S and close the editor with Ctrl+X.
  • Then enable it with these commands:
    $ cd /etc/apache2/sites-enabled/www-enabled
    $ sudo ln -s /etc/apache2/sites-available/www-available/101-www-senseeact.conf
    
  • Restart Apache:
    $ sudo service apache2 restart
    

With this configuration the SenSeeAct web application will be available at:
https://www.example.com/ or https://www.example.com/senseeact/
And the API will be available at:
https://www.example.com/servlets/senseeact/

# Docker context

To deploy the Docker containers to the server, you need to create a Docker context on your computer.

  • Make sure that you have set up a server connection with a private key (Windows, Mac).
  • Make sure that your user at the server is in the docker group (see Install server).
  • Open Terminal on your computer.
  • Enter the following command. Use your domain name instead of example_com and fill in your <USERNAME> and <HOSTNAME>.
    > docker context create example_com ‐‐docker "host=ssh://<USERNAME>@<HOSTNAME>"
    
  • Make sure that the same host name is accepted by the command-line ssh:
    > ssh <USERNAME>@<HOSTNAME>
    
  • If you are asked whether you trust the host, enter “yes”.

# gradle.properties

Like you did for the installation at your Windows or Mac workstation, you need to create the configuration file gradle.properties, but with different values. We also recommend to use different secrets and passwords, which again you can generate with the key generator.

IMPORTANT: Keep a copy of the gradle.properties that you create here in a safe place, so you can recover it when needed. You need it every time you redeploy SenSeeAct to the server. If you lose it, it will be impossible to verify any existing user passwords in the SenSeeAct database, so no user can log in with their current password anymore.

  • Open this folder on your computer:
    <GITDIR>/senseeact/ExampleSenSeeActService

  • We assume that you still have google-application-credentials.json from your previous installation.

  • Create a new copy of gradle.properties from gradle.sample.properties.

  • Check the following runtime properties:

    • ssaconfigBaseUrl:
      Set to https://www.example.com/servlets/senseeact. Use your domain instead of www.example.com.

    • ssaconfigMysqlRootPassword:
      Choose a password for the MySQL root user.

    • ssaconfigJwtSecretKey,
      ssaconfigSecretSalt:
      Enter a 256 bit Base64 key. You can generate it with the key generator in Windows:

      > .\keygenerator -t base64
      

      or Mac:

      % ./keygenerator.sh -t base64
      
    • ssaconfigAdminEmail,
      ssaconfigAdminPassword:
      Enter an email address and password for the admin user to log in to SenSeeAct.

    • ssaconfigMail*:
      Fill in at least ssaconfigMailHost and ssaconfigMailFrom. Depending on the mail server requirements you can change the other properties too.

    • ssaconfigWebUrl:
      Set to https://www.example.com or https://www.example.com/senseeact. Use your domain instead of www.example.com. Do not add a trailing slash.

  • Check the following deployment properties:

    • dockerTomcatUser,
      dockerTomcatPassword:
      Enter a username and password to log in to the Tomcat manager.

    • dockerContext:
      Set to your Docker remote context name like example_com.

  • Property dockerLogDir is set to /var/log/senseeact. The log files will be written there. You need to create this directory first. In the terminal on your server, enter these commands:

    $ sudo mkdir -p /var/log/senseeact
    $ sudo chown root:adm /var/log/senseeact
    $ sudo chmod 750 /var/log/senseeact
    
  • Property dockerProject is the name of the Docker Compose project. This will be the start of the Docker container names. This can be used if you want to run multiple instances of SenSeeAct on the same machine, so they get different container names. For example, if you want to deploy a separate development version and production version, you could set the project to senseeactdev for one and senseeact for the other.

    Property dockerTag is used for the Docker images that are built for SenSeeAct. If you want to deploy a separate development version and production version, you could set the tag to dev for one and latest for the other.

    So dockerProject works on the container names and dockerTag on the image tags. You use dockerProject to run multiple instances (with the same or different versions of SenSeeAct) and you use dockerTag to build and run multiple versions.

    Note that you should also change the ports in compose.yaml if you want to run multiple instances on the same machine.

The files google-application-credentials.json and gradle.properties are in the .gitignore list. They should never be committed to Git as they contain secrets. As mentioned above, keep a copy of your gradle.properties in a safe place.