============================
Configuring a remote MongoDB
============================


To configure your remote database to work with AEN server:

#. Stop the server, gateway and compute nodes:

   .. code-block:: bash

      sudo service wakari-server stop
      sudo service wakari-gateway stop
      sudo service wakari-compute stop

#. Open the ``/opt/wakari/wakari-server/etc/wakari/config.json``
   file and create the MONGO_URL key. For the value parameter, add the
   database information.

   The final file should read:

   .. code-block:: bash

      {
        "MONGO_URL": "mongodb://MONGO-USER:MONGO-PASSWORD@MONGO-URL:MONGO-PORT",
        "WAKARI_SERVER": "http://YOUR-IP",
        "USE_SES": false,
        "CDN": "http://YOUR-IP/static/",
        "ANON_USER": "anonymous"
      }

   For more information about configuration keys, see
   :doc:`use-config-files`.

#. Migrate the data from the former database into the new one.
   For more information, see the `MongoDB documentation website
   <https://docs.mongodb.com/manual/tutorial/backup-and-restore-tools/>`_.

#. After migration, restart the nodes:

   .. code-block:: bash

      sudo service wakari-server start
      sudo service wakari-gateway start
      sudo service wakari-compute start
