Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Latest commit

 

History

History
95 lines (74 loc) · 2.25 KB

deployment.md

File metadata and controls

95 lines (74 loc) · 2.25 KB

Deployment

Generate .env file (ngrok)

echo ngrokAuthToken="your-auth-token" > .env 

Configure values (nginx)

The privkey (as key.pem) and fullchain (as cert.pem) certificates must be in the Nginx/certs folder when starting the project. Quick installation of certificates (if you use a сertbot).

cp /etc/letsencrypt/live/your_host_address.com/fullchain.pem KAIFreeAudiencesBotProject/Nginx/certs/cert.pem
cp /etc/letsencrypt/live/your_host_address.com/privkey.pem KAIFreeAudiencesBotProject/Nginx/certs/key.pem

Be sure you set the port and address in docker-compose.yaml

environment:
   - NGINX_HOST=your_host_address.com   #set your host address 
   - NGINX_PORT=443                     #set your port (80, 88, 443, 8443)

Change appsettings.json file

  • Generate json file from example

cp KAIFreeAudiencesBot/KAIFreeAudiencesBot/appsettings.example KAIFreeAudiencesBot/KAIFreeAudiencesBot/appsettings.json
nano KAIFreeAudiencesBot/KAIFreeAudiencesBot/appsettings.json
  • Change values in json file

You need to replace the values in BotConfiguration: HostAddress and BotApiKey.
Leave value in HostAddress blank for auto detection when using ngrok.

{
  "ConnectionStrings": {
    "ScheduleConnectionSqlite": "Data Source=//db//schedule.db"
  },
  "BotConfiguration": {
    "HostAddress": "https://host.address",
    "BotApiKey": "bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  }
}

Building

docker compose build 

Start

docker compose up -d

It is supported to launch a telegram bot using both ngrok (for debugging) and using nginx to fulfill the telegram requirements for traffic encryption.

  • Start containers in debug mode (ngrok)

    docker compose --profile debug up -d
  • Start containers in production mode (nginx)

    docker compose --profile prod up -d

Stop

docker compose down

Run parser for update schedule

See more instructions here.

docker compose run parser bash