TODO: Add project description here
- Prerequisites
docker
- we use this to run a local instance of MongoDB- Verify that you have docker installed by running
docker -v
. You should see the version of docker that you have installed on your machine. - Else, download docker here.
- Verify that you have docker installed by running
npm
- node package manager- Verify you have npm installed by running
npm -v
- npm comes together with node. If you don't have either one, you need to install node from here
- Verify you have npm installed by running
pipenv
- python virtual environment manager + package manager, for the python telegram bot- Verify you have pipenv installed by running
pipenv --version
- Make sure you have python installed on your machine first. If not, download Python3 here
- Then, run
pip install pipenv
- Verify you have pipenv installed by running
- First, run
npm run setup:all
This will start up the local MongoDB container, and install the dependencies for the telegram bot and express API server.
- Then, start your local express API server
npm run dev:api
- In a separate terminal, start you local telegram bot server
npm run dev:bot
.env.bak
in /laundrobot-telegram-main
stores the token for our test telegram bot. The token is shared across all developers, please do replace it with your own token if needed. You can get one from @botfather on telegram
If the above doesn't work, or you prefer to set up everything manually, you can follow the steps below.
- Spin up a local MongoDB container
npm run dock:mongo:up
- Next, setup your local API server. The following commands will be run in the
/laundrobotAPI-main
directory
cd laundrobotAPI-main
- Create the .env file
cp .env.bak .env
- Install project dependencies
npm install
- Start the API server (with hot-reload)
npm run dev
If you want to start the local server without hot-reloading, use npm run serve
.
- Now, let's set up the telegram bot. The subsequent commands will be run in the
/laundrobot-telegram-main
directory.
cd laundrobot-telegram-main
- Create the .env file
cp .env.bak .env
- Install project dependencies
pipenv install
- Enter into the virtual environment
pipenv shell
- Start the telegram bot server
python bot.py
First, make sure you have a .env
file in the root directory.
cp .env.bak .env
The .env
file should contain the following variables:
TELEGRAM_BOT_TOKEN
- the token for your telegram botENVIRONMENT
- eitherdev
orprod
Build and run the containers for MongoDB, API server, and telegram bot using docker compose
npm run dock:up
To stop the containers, run
npm run dock:down