Skip to content

Deployment procedure

Raxel55 edited this page Mar 18, 2020 · 30 revisions

Attention!

Don't run docker-compose by yourself, docker will set wrong rights on ~/.volumes/mongo/data/db folder, which is used by mongodb. Docker-compose elf file will be downloaded to pwd and used in script.

Requirements

Your system should have these programs on Linux:

  • git
  • docker

You can install it by yourself using apt-get:

sudo apt-get update

sudo apt-get install -y git docker.io

Or you can use a script below for it. The script will install all requirements and run the project.

Run

To deploy on your ubuntu machine you need:

  1. Download or copy deploy.sh script from root folder in repository on your machine (currently this file is only on develop branch)

Download by curl:

curl -O https://raw.githubusercontent.com/CsteerDevops1/wiki-framework/develop/deploy.sh
  1. Ensure that .env files are created or environment variables set in proper containers:
  • project_name/telegramBots/userBot/.env - used to set telegram proxy and bot token
  • project_name/telegramBots/initBot/.env - used to set bot token

You can remove bots from docker-compose, if you don't need them. Or create empty files in order to configure them later.

  1. Ensure that you have permissions to run docker (try docker ps and check if there are no permissions denied errors). If docker is not installed you will have to run the script twice (it's gonna fail first time). logout and login in your account to get docker permissions and run the script again.
  2. Run deploy.sh project_folder to create or update running version of this project. Project folder will be created if it doesn't exist. Script uses develop branch for now.

Use these command to run the script:

chmod a+x deploy.sh

./deploy.sh project_dir
  1. It may asks for sudo access to install necessary requirements (git/docker)

This will launch 6 containers:

  • flask_api hosts flask server on 5000 port for api to database
  • user_bot cs_wiki_search_bot polling, bot that allows you to search information in database by "name" field
  • init_bot cs_wiki_media_bot polling, bot that allows you to edit data, stored in database
  • translator this container translates names and descriptions for each not-translated document in database
  • web_ui hosts nginx on 8080, giving away web ui pages
  • mongodb_container mongo database, files in ~/.volumes/mongo/data/db

Known problems:

  • if script installs docker, it will fail running docker-compose - you need to ensure that your groups are updated and you are in docker group
Clone this wiki locally