Add Docker deployment instructions
This commit is contained in:
parent
c54efcf071
commit
6ca6b798d2
5 changed files with 32 additions and 2 deletions
|
@ -1,2 +1,9 @@
|
||||||
# karl-marx
|
# karl-marx
|
||||||
|
|
||||||
|
## Deploying
|
||||||
|
|
||||||
|
* Create a fat jar with `sbt assembly` and call it `Bot.jar`
|
||||||
|
* On the server, create a directory for your bot. Copy `docker-compose.yml` into it, create `data/bot/`, and copy `Bot.jar` into `data/bot/`
|
||||||
|
* Run `docker-compose up -d`
|
||||||
|
|
||||||
|
You can view logs with `docker-compose logs`, take down the server with `docker-compose down`, and restart it with `docker-compose restart`.
|
|
@ -4,3 +4,5 @@ version := "0.1"
|
||||||
|
|
||||||
scalaVersion := "2.12.8"
|
scalaVersion := "2.12.8"
|
||||||
libraryDependencies += "com.bot4s" %% "telegram-core" % "4.2.0-RC1"
|
libraryDependencies += "com.bot4s" %% "telegram-core" % "4.2.0-RC1"
|
||||||
|
|
||||||
|
mainClass := Some("Runner")
|
||||||
|
|
19
docker-compose.yml
Normal file
19
docker-compose.yml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
version: "2"
|
||||||
|
services:
|
||||||
|
bot:
|
||||||
|
restart: always
|
||||||
|
image: openjdk:8-jre-stretch
|
||||||
|
volumes:
|
||||||
|
- ./data/bot:/bot
|
||||||
|
working_dir: /bot
|
||||||
|
entrypoint: java -jar Bot.jar
|
||||||
|
environment:
|
||||||
|
- BOT_TOKEN=soandso
|
||||||
|
depends_on:
|
||||||
|
- redis
|
||||||
|
redis:
|
||||||
|
restart: always
|
||||||
|
image: redis
|
||||||
|
entrypoint: redis-server --appendonly yes
|
||||||
|
volumes:
|
||||||
|
- ./data/redis:/data
|
1
project/assembly.sbt
Normal file
1
project/assembly.sbt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.9")
|
|
@ -7,10 +7,11 @@ object Runner {
|
||||||
def main(args: Array[String]): Unit = {
|
def main(args: Array[String]): Unit = {
|
||||||
val bot = new Bot("657892534:AAEeSKtA9rbo9WCYDenFXygwtNg-YV_EDs4")
|
val bot = new Bot("657892534:AAEeSKtA9rbo9WCYDenFXygwtNg-YV_EDs4")
|
||||||
val eol = bot.run()
|
val eol = bot.run()
|
||||||
|
/*
|
||||||
println("Press [ENTER] to shutdown the bot, it may take a few seconds...")
|
println("Press [ENTER] to shutdown the bot, it may take a few seconds...")
|
||||||
scala.io.StdIn.readLine()
|
scala.io.StdIn.readLine()
|
||||||
bot.shutdown() // initiate shutdown
|
|
||||||
// Wait for the bot end-of-life
|
// Wait for the bot end-of-life
|
||||||
|
*/
|
||||||
Await.result(eol, Duration.Inf)
|
Await.result(eol, Duration.Inf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue