Updated readme

This commit is contained in:
Eugene Zadyra
2018-12-05 23:12:16 +01:00
parent ff7a098f7a
commit 597474824d
2 changed files with 49 additions and 29 deletions

View File

@@ -13,22 +13,57 @@ It is available here [@luxmedbot](https://telegram.me/luxmedbot)
#### To setup your own telegram bot
1. create telegram bot using [@BotFather](https://telegram.me/botfather)
2. install jdk8
3. add to .bash_profile
2. install **docker** and **docker-compose**
3. clone repository and build project:
```bash
$ ./gradlew prepare
```
export TELEGRAM_TOKEN="SOME TOKEN"
export SECURITY_SECRET="SOME SECRET FOR ENCODING USER PASSWORDS"
4. create a docker volume and name it **lbs**:
```bash
$ docker volume create lbs
```
5. find physical location of the volume:
```bash
docker volume inspect lbs
```
this will produce the following output:
```json
[
{
"CreatedAt": "2018-12-05T14:32:35Z",
"Driver": "local",
"Labels": {
"com.docker.compose.project": "docker",
"com.docker.compose.version": "1.23.1",
"com.docker.compose.volume": "lbs"
},
"Mountpoint": "/var/lib/docker/volumes/lbs/_data",
"Name": "lbs",
"Options": null,
"Scope": "local"
}
]
```
6. using value from **Mountpoint** create **config** folder:
```bash
mkdir /var/lib/docker/volumes/lbs/_data/config
```
7. create env file in that folder
```bash
touch /var/lib/docker/volumes/lbs/_data/config/env
```
8. edit file and add **TELEGRAM_TOKEN** and **SECURITY_SECRET**
```bash
nano /var/lib/docker/volumes/lbs/_data/config/env
```
```bash
SECURITY_SECRET=randomly generated string
TELEGRAM_TOKEN=12345678:telegram token
```
4. go to the **docker** folder inside the project and run command
```bash
$ docker-compose up
```
4.
- install **docker**
- run using `./docker.sh run`
**or**
- install postgres and create db **lbs** with login **lbs** and password **lsb123**
- run using `./gradlew bootRun`
5. send `/start` command to your bot

View File

@@ -1,15 +0,0 @@
#!/bin/bash
[ -z "$TELEGRAM_TOKEN" ] && echo "Need to set TELEGRAM_TOKEN env variable" && exit 1;
[ -z "$SECURITY_SECRET" ] && echo "Need to set SECURITY_SECRET env variable" && exit 1;
case "$1" in
run)
./gradlew makeDockerFile
docker-compose -f server/build/docker/docker-compose.yml up --build
;;
*)
echo "Run as $0 (run)"
exit 1
;;
esac