diff --git a/.gitignore b/.gitignore index fba0141..ac68c97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .idea/* .env -.env.example env Lib Include diff --git a/.env.example b/api/.env.example similarity index 68% rename from .env.example rename to api/.env.example index 921ca00..af67b58 100644 --- a/.env.example +++ b/api/.env.example @@ -5,9 +5,5 @@ MYSQL_DATABASE= MYSQL_USER= MYSQL_PASSWORD= -# Telegram bot api key -BOT_API_KEY="" -NEWS_API_KEY="" - # Flask secret key SECRET_KEY= diff --git a/api/README.md b/api/README.md new file mode 100644 index 0000000..e771473 --- /dev/null +++ b/api/README.md @@ -0,0 +1,41 @@ +# API + +Aktienbot API + +## Development +1. Create virtual environment `python -m venv venv env/Scripts/activate` +2. Install requirements `pip install -r api/requirements.txt` +3. Set environment variables (see list below) + 1. Use `.env`-file in `api` directory like `.env.example` + 2. Or set variables using `export` or `set` commands. (Windows `set`, Linux `export`) +4. Run api `python api/app.py` + +## Environment variables +``` + # Flask secret key + SECRET_KEY= + + # MYSQL Connection + MYSQL_USER= + MYSQL_PASSWORD= + MYSQL_HOST= + MYSQL_PORT= + MYSQL_DATABASE= +``` + +## Docker +``` +docker run -d \ + --name aktienbot_api \ + --hostname aktienbot_api \ + --publish 80:80 \ + --env "SECRET_KEY=" \ + --env "MYSQL_USER=" \ + --env "MYSQL_PASSWORD=" \ + --env "MYSQL_HOST=" \ + --env "MYSQL_PORT=" \ + --env "MYSQL_DATABASE=" \ + --restart unless-stopped \ + registry.flokaiser.com/aktienbot/api:latest +``` +or load environment variables from file by using `--env-file ` \ No newline at end of file diff --git a/telegram_bot/.env.example b/telegram_bot/.env.example new file mode 100644 index 0000000..bcd6a02 --- /dev/null +++ b/telegram_bot/.env.example @@ -0,0 +1,8 @@ +# Telegram bot api key +BOT_API_KEY= + +# News api key +NEWS_API_KEY= + +# Flask secret key +SECRET_KEY= diff --git a/telegram_bot/README.md b/telegram_bot/README.md index abda9e2..05ac44d 100644 --- a/telegram_bot/README.md +++ b/telegram_bot/README.md @@ -1,6 +1,33 @@ -## Local setup for telegram bot -0. optional: build virtual env by ``python -m venv venv`` - ``env/Scripts/activate`` -2. create .env and set API keys etc. (use .env.example as a layout) -3. install required libs via ``pip install -r ./telegram_bot/requirements.txt`` -4. run bot.py via ``python ./telegram_bot/bot.py`` +# Telegram bot + +Aktienbot telegram bot + +## Development +1. Create virtual environment `python -m venv venv env/Scripts/activate` +2. Install requirements `pip install -r telegram_bot/requirements.txt` +3. Set environment variables (see list below) + 1. Use `.env`-file in `api` directory like `.env.example` + 2. Or set variables using `export` or `set` commands. (Windows `set`, Linux `export`) +4. Run api `python telegram_bot/bot.py` + +## Environment variables +``` + # Telegram bot api key + BOT_API_KEY= + + # News api key + NEWS_API_KEY= +``` + +## Docker +``` +docker run -d \ + --name aktienbot_bot \ + --hostname aktienbot_bot \ + --publish 80:80 \ + --env "BOT_API_KEY=" \ + --env "NEWS_API_KEY=" \ + --restart unless-stopped \ + registry.flokaiser.com/aktienbot/bot:latest +``` +or load environment variables from file by using `--env-file ` \ No newline at end of file