Extremely Serious

Category: Diskstation

Using Google SMTP with Archiva in Synology

Pre-requisite

Procedure

  1. Open the archiva.xml file found in the following location:
    /volume1/@appstore/Tomcat7/src/conf/Catalina/localhost
  2. Update the Resource entry with the name mail/Session to become the following:
    <Resource name="mail/Session" auth="Container"
          type="javax.mail.Session"
          mail.smtp.host="smtp.gmail.com"
              mail.smtp.port="587"
              mail.smtp.auth="true"
              mail.smtp.user="<USERNAME>"
              password="<PASSWORD>"
              mail.smtp.starttls.enable="true"
              mail.transport.protocol="smtp"/>
    Token Description
    USERNAME Google Account
    PASSWORD Google App Password
  3. Save the updated file and wait for Archiva to restart.

    If you've updated the archiva.xml file and save it, Tomcat will detect it and it will restart the Archiva application.

Configuring Archiva with MariaDB in Synology Diskstation

  1. Install Tomcat 7 package in Diskstation
  2. Download archiva war file from the following address:
    https://archiva.apache.org/index.cgi
  3. Place the downloaded war fileĀ (e.g. apache-archiva-2.2.3.war) into the following directory:
    /volume1/@appstore/Tomcat7/src/webapps/
  4. In MariaDB, add the following user with appropriate password.
    archivauser

    and the following database

    archiva
  5. Download the following jar files:
    mail-1.4.jar 
    mariadb-java-client-1.5.x.jar
  6. Place the download jar files in the following directory:
    /volume1/@appstore/Tomcat7/src/lib
  7. Create archiva.xml file in the following location:
    /volume1/@appstore/Tomcat7/src/conf/Catalina/localhost

    Add the following entries:

    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/archiva" docBase="/volume1/@appstore/Tomcat7/src/webapps/<ARCHIVA_WAR_FILENAME>">
    <Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"
    	username="archivauser"
    	password="<PASSWORD_HERE>"
    	driverClassName="org.mariadb.jdbc.Driver"
    	url="jdbc:mariadb://<MARIADB_HOST_IP>:<MARIADB_HOST_PORT
    	/archiva?autoReconnect=true" />
    <Resource name="mail/Session" auth="Container" 	type="javax.mail.Session" mail.smtp.host="localhost"/>
    </Context>

    Note: The <ARCHIVA_WAR_FILENAME>, <PASSWORD_HERE> <MARIADB_HOST_IP> and <MARIADB_HOST_PORT tokens must be replaced by the downloaded war file from step 2, password used from step 4, IP address of MariaDB and port used by MariaDB repectively.

  8. Access archiva using the following address:
    http://<DISKSTATION_HOST_IP>:7070/archiva

    Note: Update the token <DISKSTATION_HOST_IP> with the IP of your Synology Diskstation.

Configuring Tomcat 7 Package in Synology Diskstation

  1. Install Tomcat 7 package.
  2. Edit the following file:
    /volume1/@appstore/Tomcat7/src/conf/tomcat-users.xml
  3. Add the following entries:
    <role rolename="manager-gui"/>
    <user username="admin" password="<PASSWORD_HERE>" roles="manager-gui"/>

    Note: Update the token <PASSWORD_HERE> appropriately.

  4. Access the manager-gui using the following address format:
    http://<DISKSTATION_HOST_IP>:7070/manager/html

    Note: Update the token <DISKSTATION_HOST_IP> with the IP of your Synology Diskstation.