Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
715aaf1
Attempt 1
LunaUrsa Mar 4, 2024
d6624d5
Attempt 2
LunaUrsa Mar 4, 2024
8a15580
Attempt 3
LunaUrsa Mar 4, 2024
9a71717
Again
LunaUrsa Mar 4, 2024
22e805a
One mooooore time
LunaUrsa Mar 4, 2024
55d10cd
again
LunaUrsa Mar 4, 2024
7ef188a
yeeeehawwwww
LunaUrsa Mar 4, 2024
275a0f3
Promote that shit
LunaUrsa Mar 4, 2024
e123499
asdf
LunaUrsa Mar 4, 2024
12d9232
bash is weird
LunaUrsa Mar 4, 2024
a7bf42e
wtf
LunaUrsa Mar 4, 2024
351582a
hnnnng
LunaUrsa Mar 4, 2024
927984d
dik
LunaUrsa Mar 4, 2024
5323b43
Maybe?
LunaUrsa Mar 4, 2024
0e7240f
One day
LunaUrsa Mar 4, 2024
4154f51
sigh
LunaUrsa Mar 4, 2024
df472d7
stg
LunaUrsa Mar 4, 2024
c2a91e6
daft punk
LunaUrsa Mar 4, 2024
66e8292
=D
LunaUrsa Mar 4, 2024
65b3cbc
This might be it
LunaUrsa Mar 4, 2024
6726b87
Nice
LunaUrsa Mar 4, 2024
5e416e4
Once again, with feeling
LunaUrsa Mar 4, 2024
a2bc11a
Try again
LunaUrsa Mar 4, 2024
f10513e
Oncea again
LunaUrsa Mar 4, 2024
46c022f
Mkay
LunaUrsa Mar 4, 2024
8c5e7a6
asdfasdf
LunaUrsa Mar 4, 2024
56dd71a
hardcode that shit
LunaUrsa Mar 4, 2024
9ce8bde
one more time
LunaUrsa Mar 4, 2024
3f7625f
idk
LunaUrsa Mar 4, 2024
8ad4626
might be on to something
LunaUrsa Mar 4, 2024
32a3d19
All together now
LunaUrsa Mar 4, 2024
bafd515
Getting there
LunaUrsa Mar 4, 2024
357371a
huehuehue
LunaUrsa Mar 4, 2024
6923fbd
One more
LunaUrsa Mar 4, 2024
6b767b8
one more
LunaUrsa Mar 4, 2024
2d90d0f
one more
LunaUrsa Mar 4, 2024
0679872
Good morning
LunaUrsa Mar 5, 2024
8882c03
....!
LunaUrsa Mar 5, 2024
a0e311e
Oh boy
LunaUrsa Mar 5, 2024
a1f9987
Once more
LunaUrsa Mar 5, 2024
6d4ac29
Merge branch 'main' into drone-testing
LunaUrsa Jun 27, 2025
6a4f055
Merge branch 'main' into drone-testing
LunaUrsa Nov 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
177 changes: 163 additions & 14 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,165 @@ type: docker
name: Deploy TripBot

steps:
- name: Rebuild TripBot
- name: deploy to staging
image: docker
commands:
- echo "Deploying to Staging"
- apk update
- apk upgrade
- apk add --no-cache git
- docker compose -f docker-compose.host.yml --project-name tripbot up tripbot_deploy -d --force-recreate --build
environment:
NODE_ENV:
from_secret: NODE_ENV
DOCKER_HOST:
from_secret: DOCKER_HOST
DOCKER_BUILDKIT:
from_secret: DOCKER_BUILDKIT
DISCORD_CLIENT_ID:
from_secret: DISCORD_CLIENT_ID_DEPLOY
DISCORD_CLIENT_TOKEN:
from_secret: DISCORD_CLIENT_TOKEN_DEPLOY
DISCORD_GUILD_ID:
from_secret: DISCORD_GUILD_ID
DISCORD_OWNER_ID:
from_secret: DISCORD_OWNER_ID
DRONE_TOKEN:
from_secret: DRONE_TOKEN
DISCORD_CLIENT_SECRET:
from_secret: DISCORD_CLIENT_SECRET
DISCORD_CLIENT_REDIRECT_URI:
from_secret: DISCORD_CLIENT_REDIRECT_URI
GITHUB_TOKEN:
from_secret: GITHUB_TOKEN
GLITCHTIP_DSN:
from_secret: GLITCHTIP_DSN
RAPID_TOKEN:
from_secret: RAPID_TOKEN
ROLLBAR_TOKEN:
from_secret: ROLLBAR_TOKEN
IMGUR_ID:
from_secret: IMGUR_ID
IMGUR_SECRET:
from_secret: IMGUR_SECRET
YOUTUBE_TOKEN:
from_secret: YOUTUBE_TOKEN
MATRIX_BOT_PASSWORD:
from_secret: MATRIX_BOT_PASSWORD
MOODLE_TOKEN:
from_secret: MOODLE_TOKEN
PRISMA_DB_URL:
from_secret: PRISMA_DB_URL_DEPLOY
GEMINI_KEY:
from_secret: GEMINI_KEY
REVOLT_BOT_TOKEN:
from_secret: REVOLT_BOT_TOKEN
WOLFRAM_TOKEN:
from_secret: WOLFRAM_TOKEN
IMDB_TOKEN:
from_secret: IMDB_TOKEN
SENTRY_TOKEN:
from_secret: SENTRY_TOKEN

- name: health check
image: appropriate/curl
commands:
- echo "Running Health Checks"
- |
attempt=0
max_attempts=5
delay_between_attempts=10 # seconds
url=https://tripbot-deploy.$DNS_DOMAIN/api
while [ $attempt -lt $max_attempts ]; do
attempt=$((attempt + 1))
echo "Attempt $attempt of $max_attempts to reach $url..."
curl -k -f $url && break || echo "Failed to reach $url, retrying in $delay_between_attempts seconds..."
if [ $attempt -eq $max_attempts ]; then
echo "Failed to reach $url after $max_attempts attempts."
exit 1
fi
sleep $delay_between_attempts
done
environment:
DNS_DOMAIN:
from_secret: DNS_DOMAIN
when:
status: [ success ]

- name: discord notification
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: WEBHOOK_ID
webhook_token:
from_secret: WEBHOOK_TOKEN
avatar_url: https://i.imgur.com/tnw3I34.png
username: 'Drone CI'
message: |
{{#success build.status}}
Build {{build.number}} succeeded.
{{else}}
Build {{build.number}} failed.
{{/success}}
Build time: {{build.started}}
Commit message: {{commit.message}}
Commit author: {{commit.author}}
Commit branch: {{commit.branch}}
{{#success build.status}}
View logs: <{{build.link}}>
{{else}}
View failed job: <{{build.link}}>
{{/success}}
when:
status:
- failure

- name: trigger promotion
image: curlimages/curl
commands:
# - echo "Authorization $DRONE_TOKEN" # WORKS
# - echo "http://drone.$DNS_DOMAIN/api/repos/TripSit/TripBot/builds/${DRONE_BUILD_NUMBER}/promote" # WORKS
- >
curl -v -i POST -H "Authorization: Bearer $DRONE_TOKEN" -d '{"target": "production"}' "https://drone.$DNS_DOMAIN/api/repos/TripSit/TripBot/builds/${DRONE_BUILD_NUMBER}/promote?target=production"
environment:
DRONE_TOKEN:
from_secret: DRONE_TOKEN
DNS_DOMAIN:
from_secret: DNS_DOMAIN
when:
status: [ success ]

- name: cleanup
image: docker
commands:
- docker-compose -f docker-compose.host.yml --project-name tripbot down
environment:
DOCKER_HOST:
from_secret: DOCKER_HOST

trigger:
branch:
- main
- drone-testing
event:
- custom
- push

---
kind: pipeline
type: docker
name: production

steps:
- name: promote to production
image: docker
commands:
- echo "Promoting to Production"
- apk update
- apk upgrade
- apk add --no-cache git
- cat docker-compose.host.yml
- docker compose -f docker-compose.host.yml --project-name tripbot up tripbot -d --force-recreate --build
# - tail -f /dev/null
environment:
NODE_ENV:
from_secret: NODE_ENV
Expand Down Expand Up @@ -51,6 +201,8 @@ steps:
from_secret: MATRIX_BOT_PASSWORD
MOODLE_TOKEN:
from_secret: MOODLE_TOKEN
PRISMA_DB_URL:
from_secret: PRISMA_DB_URL
GEMINI_KEY:
from_secret: GEMINI_KEY
REVOLT_BOT_TOKEN:
Expand Down Expand Up @@ -87,9 +239,9 @@ steps:
username: 'Drone CI'
message: |
{{#success build.status}}
Build {{build.number}} succeeded.
Deployment {{build.number}} succeeded.
{{else}}
Build {{build.number}} failed.
Deployment {{build.number}} failed.
{{/success}}
Build time: {{build.started}}
Commit message: {{commit.message}}
Expand All @@ -100,17 +252,14 @@ steps:
{{else}}
View failed job: <{{build.link}}>
{{/success}}
when:
status:
- success
- failure

trigger:
branch:
- main
- Docker-update
trigger:
- main
- drone-testing
event:
# - cron
- custom
- push
# - pull_request
# - tag
# - promote
# - rollback
- promote
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"scripts": {
"## TRIPBOT ##": "",
"tripbot:start": "docker compose --project-name tripbot up -d --force-recreate --build tripbot ",
"tripbot:start": "docker compose --project-name tripbot up -d --force-recreate --build tripbot",
"tripbot:logs": "docker container logs tripbot -f -n 100",
"tripbot:test": "docker exec -it tripbot npx jest --silent -c ./src/jest/jest.config.ts ",
"tripbot:test1": "npx jest -c ./src/jest/jest.config.ts",
Expand Down
Loading