Skip to content

Commit

Permalink
added docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
uaudith committed Oct 1, 2020
1 parent 87418e9 commit f40b8c7
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 13 deletions.
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,7 @@ async def test_filter(message: Message):
* **Docker Method** 🐳

1. Install Docker ( [Guide](https://docs.docker.com/engine/install/ubuntu/) )
2. Clone the repo
`git clone https://github.com/UsergeTeam/Userge.git`
3. `cd Userge`
4. Create the docker image
`docker build -t userge .`
5. `cd ..`
6. `wget https://raw.githubusercontent.com/UsergeTeam/Userge/alpha/config.env.sample -O config.env`
7. Edit the file with your text editor
`vi config.env`
8. Finally run the container
`docker run -dv "$(pwd)/config.env:/app/config.env" userge`

- [**See Detailed Guide**](resources/radmeDocker.md)
* **Other Method** 🔧

```bash
Expand Down
1 change: 1 addition & 0 deletions config.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ API_HASH=""


# Mongodb url from https://cloud.mongodb.com/
# comment below line if you are going to use docker !
DATABASE_URL=""


Expand Down
24 changes: 24 additions & 0 deletions resources/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: "3.7"

services:
userge:
build:
context: https://github.com/UsergeTeam/Userge.git#alpha
depends_on:
- mongo
restart: on-failure
environment:
DATABASE_URL: mongodb://root:example@mongo
env_file:
- config.env

mongo:
image: mongo
volumes:
- mongo_userge:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example

volumes:
mongo_userge:
40 changes: 40 additions & 0 deletions resources/radmeDocker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Docker Guide For Userge 🐳 #

## Install docker ##
- Follow the official docker [installation guide](https://docs.docker.com/engine/install/ubuntu/)

## Install Docker-compose ##
- Easiest way to install docker-compose is <br>
```sudo pip install docker-compose```
- Also you can check other official methods of installing docker-compose [here](https://docs.docker.com/compose/install/)

## Run Userge ##
- We dont need to clone the repo (yeah Docker-compose does that for us)
- Setup configs
- Download the sample config file <br>
- ```mkdir userge && cd userge```
- ```wget https://raw.githubusercontent.com/UsergeTeam/Userge/alpha/config.env.sample -O config.env```
- ```vim config.env```
- Download the yml file for docker-compose
- ```wget https://raw.githubusercontent.com/UsergeTeam/Userge/alpha/resources/docker-compose.yml```
- Finally start the bot <br>
```docker-compose up -d```
- The bot should be running now <br>
Check logs with ```docker-compose logs -f```

## How to stop the bot ##
- Stop Command
```docker-compose stop```
- This will just stop the containers. Built images won't be removed. So next time you can start with ``docker-compose start`` command <br>
And it won't take time for building from scratch<br>

- Down command
```docker-compose down```
- You will stop and delete the built images also. So next time you have to do ``docker-compose up -d`` to start the bot<br>

### Q&A ###
- How to see logs <br>
`docker-compose logs -f`
- How to update <br>
`docker-compose up -d` <br>
Changes will be fetched from git repo. You can change repo url from _docker-compose.yml_ file

0 comments on commit f40b8c7

Please sign in to comment.