Configuring Faspex to Use a Remote Database (Faspex + MySQL)

Configuring Faspex to use a remote database can make the application more reponsive by putting the database and background processes on a separate server from the one that hosts the Faspex web application. The following instructions describe how to set up and configure two Faspex servers; ensure that you are performing the configuration steps on the correct server. The server that runs the database is referred to as the "database server" and the server that runs the web application is referred to as the "application server".

If you want to set up a remote database that only runs MySQL, see Configuring Faspex to Use a Remote Database (MySQL Only)

Aspera recommends that you use the database on the server that runs background processes. The server hosting the application can be remote.

  1. Set up two identical Faspex instances on separate servers.
    Each Faspex installation creates its own database, but the servers are configured to only use one.
  2. On the application server, point Faspex to the database on the database server.
    Open /opt/aspera/faspex/config/database.yml in a text editor. Locate the line for host in the production section and change the value to the hostname of the database server. Save your changes.
  3. On the database server, grant the application server access to the database.
    Run the following commands to run the MySQL command line:
    # /opt/aspera/common/mysql/bin/mysql -umysql_username -pmysql_password
    From the MySQL command line, allow remote connection to the Faspex database from only the remote node, and exit the MySQL command line:
    mysql# grant all privileges on faspex.* to root@'ui_server_hostname' identified by 'mysql_password';
    mysql# end

    These commands allow connections from the application server to access the specified database.

  4. On the application server, update the secret.yml file. with the secret.yml file from the database server.
    On the application server, backup the /opt/aspera/faspex/config/secret.yml file by adding the .bak extension to it. Copy the secret.yml file from the database server to the application server in the same location as the backup.
  5. On both servers, set matching encryption keys.
    On both the database server and application server, run the following command to set the encryption key to the same value:
    # asconfigurator -x ""set_node_data;token_encryption_key,token_key"

    The token_key must be identical on the servers.

  6. On both servers, restart asperacentral and asperanoded.
    Run the following command in a Terminal window to restart asperacentral:
    # /etc/init.d/asperacentral restart
    Run the following commands to restart asperanoded:
    # /etc/init.d/asperanoded restart
  7. On both servers, create the same node username and password.
    This must be done after configuring database.yml and secret.yml. Run the following command:
    # /opt/aspera/bin/asnodeadmin -a -u node_username -p node_password -x transfer_username

    For example:

    # /opt/aspera/bin/asnodeadmin -a -u nodeadmin -p XF324cd28 -x faspex
  8. In the web application, configure the localhost file server to use the new node user.
    In the Faspex application, go to Server > File Storage. Click the arrow for localhost and click Edit. Enter the node_username from the previous step in the Username field and the node_password in the Password field.

    Click Update Node to activate your changes.

  9. On both servers, restart Faspex services.
    # asctl faspex:restart
  10. On both servers, configure background processes.
    On the database node: Disable the application by running the following command:
    # asctl faspex:mongrel:stop

    On the application node: Disable all process but the application by running the following commands:

    # asctl all:stop
    # asctl faspex:mongrel:start
    # asctl apache:start
After following these instructions, you have one node running database and background services, and another node running only the application.