Skip to content

Commit

Permalink
Provide env vars when deploying using sls
Browse files Browse the repository at this point in the history
  • Loading branch information
hammady committed May 18, 2024
1 parent 72289c4 commit 0a05283
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/serverless-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ jobs:
--region ${{ vars.AWS_REGION }} \
--stage ${{ vars.SLSSTAGE }} \
--verbose
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ vars.TELEGRAM_CHAT_ID }}
MESSAGES_SIGNATURE: ${{ vars.MESSAGES_SIGNATURE }}
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,21 @@ each message.
To generate a token for the bot and identify the channel id, check the
official docs for [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API).

### Deploy using AWS Lambda
## Deploy using AWS Lambda

A Github Action is provided to deploy the app to AWS Lambda.
It is triggered on push to the `master` branch.
To deploy manually do the following:

- Install node 19
- Install Serverless framework: `npm install -g serverless`
- Install dependencies: `npm install`
- Configure AWS credentials: `aws configure`
- Deploy the app:

```bash
TELEGRAM_BOT_TOKEN=<bot_token> \
TELEGRAM_CHAT_ID=<chat_id> \
MESSAGES_SIGNATURE=<signature> \
sls deploy --aws-profile <profile_name> --stage prod
```
1 change: 0 additions & 1 deletion serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ functions:
# Install nodejs 19 then run: npm install
plugins:
- serverless-python-requirements
- serverless-dotenv-plugin

0 comments on commit 0a05283

Please sign in to comment.