- Create telegram bots:
- for production
- for testing (optional)
- Save token for bots.
- Create telegrams channels:
- for production
- for testing (optional)
- Add bots to the channels.and make them as
Administrators
. - Save channel id.
- open created channel at https://web.telegram.org/
- you see the url like this https://web.telegram.org/a/#-123456789
- replace
-
to-100
and you get-100123456789
- Save channel ids.
- Create calendars and service accounts:
- for production
- for testing (optional)
- Save calendar id and service account credentials.
- Create cloud with name
telegram-tarmolov-work
. - Create service account with name
telegram-tarmolov-work
with two roles:serverless.functions.invoker
lockbox.payloadViewer
- Create serverless functions:
production
prestable
testing
(optional)development
(optional)
- Create secrets in Lockbox:
production
testing
(optional)
- Install Yandex Cloud CLI
- Obtain oauth token and save it.
- Copy organization ID and save it.
- Set up local fields in queue.
Name | Name in English | Type | Key |
---|---|---|---|
ID события в календаре | Event ID in calendar | String | calendarEventId |
Время публикации | Publish time | DateTime | publishDateTime |
Запланированное время публикации | Scheduled time for publication | DateTime | scheduledDateTime |
Запланированное время публикации | Scheduled time for publication | DateTime | scheduledDateTime |
Продакшен | Production | Link | production |
Тестинг | Testing | Link | testing |
- Set up workflow.
- Set up triggers to connect the serverless function and Yandex Tracker..
- Set up auto actions to publish delayed posts.
TELEGRAM_BOT_TOKEN="<saved telegram bot token>"
TELEGRAM_TESTING_CHANNEL_ID="<saved telegram channel id (optional)>"
TRACKER_OAUTH_TOKEN="<saved yandex tracker oauth token>"
TRACKER_ORG_ID="<yandex tracker organization id>"
TELEGRAM_PRODUCTION_CHANNEL_ID="<saved telegram channel id>"
ACCESS_SECRET_KEY="<random generated string>"
GOOGLE_API_KEY_FILE="<google service account credentials encrypted in base64>"
TRACKER_QUEUE="<yandex tracker queue>"
TRACKER_QUEUE_LOCAL_FIELD_HASH="<hash used for prefixes for yandex tracker local fields>"
CALENDAR_ID="<google calendar id>"
TRACKER_COMPONENTS_APPROVERS="<components approvers encrypted in base64 (optional)>"
- Install dependencies:
$ nvm use
$ make deps
$ make env
$ make validate
$ make test
$ ./src/tests/manual/tracker.sh
$ ./src/tests/manual/telegram.sh
- Build and deploy a new version.
$ make deploy-testing
-
Clear "testing" field in https://tracker.yandex.ru/BLOGTEST-6
-
Invoke function
$ ./src/tools/make-request.sh
$ ./src/tools/make-request.sh '{"key": "BLOGTEST-4"}'
$ make deploy-production