Backend installation
baguilar edited this page 5 years ago

Botpro's backend docker-compose installation

This installation process is meant to be run for a production environment as default. Development environment should be setup differently.

Pre-requirements

  • A server running a recent linux distribution. You can get one at digitalocean (https://digitalocean.com)
  • docker installed and configured.
  • docker-compose installed and configured.
  • Access to the private registry located at hub.botprotec.com. That can be only requested by an agreement and licensing of use.
  • SMPT server information for notifications. The server needs to have TLS.
  • A valid email account for default email user
  • The version_tag you want to use. The version_tag coincides on the latest commit in Backend and Frontend repository. For example a4f0c2912849e2bd089201b53b7f631969133fd9 for backend and bac4d0b4479e3d9f917cf385fa43f17b2ffc0f9a for frontend.

Installation process

  1. Clone this repository.

    git clone https://gogs.innovare.es/BotPro/docker-install.git
    
  2. Login into private registry hub.botprotec.com

    sudo docker login hub.botprotec.com
    
  3. Start the backend services. The variables used are just meant as example. You need to provide your own. The default values for botpro production environment are located in the following document: https://gogs.innovare.es/BotPro/Backend/wiki/Production+deployment

    cd docker-install/backend
    sudo messenger_default_api="https://graph.facebook.com/v2.6" \
    smtp_server="your.smtp.with.tls.com" \
    smtp_sender="notifications@server.com" \
    smtp_login="notifications@server.com:password" \
    setup_admin_password="wh4t3v3rp4ssw0rdf0r4dm1n" \
    setup_admin_email="defaultuser@server.com" \
    POSTGRES_PASSWORD=0hmyp4ssw0rd1sv3ryl0ng \
    FRONTEND_URL="example.botprotec.com" \
    VERSION_TAG=a4f0c2912849e2bd089201b53b7f631969133fd9 \
    WEB_PORT=8080 /usr/local/bin/docker-compose up -d
    

Variables

  • messenger_default_api: Changes the endpoint where facebook messenger replies are sent to.
  • smtp_server: Sets the smtp server for sending notifications (password recovery).
  • smtp_sender: Email/user used to send notifications via e-mail (password recovery).
  • smtp_login: user and password used to login into the smtp server for sending e-mail notifications (password recovery).
  • setup_admin_password: default admin user password.
  • setup_admin_email: default admin user e-mail.
  • POSTGRES_PASSWORD: the postgress password used to connect to the postgres database for the backend.
  • FRONTEND_URL: sets the URL where the backend will allow connections from (due to CORS policies this has to be set).
  • VERSION_TAG: This is the image version to use. It corresponds to the commit value in the backend repository (https://gogs.innovare.es/BotPro/Backend).
  • WEB_PORT: This is the port to use for exposing the backend HTTP service.

Service description

Description of services running with Backend docker-compose.yml

  1. backend: You need the backend running with https, which is needed for Facebook chatbots. The backend latest Botpro image is: "hub.botprotec.com/botpro/botpro-backend:${VERSION_TAG}" with VERSION_TAG being the latest commit push to the repository.
  2. postgresql: The postgresql service.
  3. web2py-rq-worker: This image is needed for running some tasks in background, using web2pys Scheduler.
  4. docker-dev-publish-w2p-worker: This image is needed for running some tasks in the background, using python-rq.
  5. redis: This image is the backend used for python-rq task exeuction.