Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: move back to fly.io #231

Merged
merged 1 commit into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,18 @@ jobs:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}

deploy:
name: Deploy app
needs:
- ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: superfly/flyctl-actions/setup-flyctl@master

- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
18 changes: 9 additions & 9 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# fly.toml file generated for teknologi-umum-bot on 2021-08-08T13:56:06+07:00
# fly.toml app configuration file generated for teknologi-umum-bot on 2024-06-23T10:04:06+07:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "teknologi-umum-bot-v2"
primary_region = "cdg"
kill_signal = "SIGINT"
kill_timeout = 5
app = 'teknologi-umum-bot'
primary_region = 'ams'

[env]
[build]

[experimental]
allowed_public_ports = []
auto_rollback = true
[[vm]]
size = 'shared-cpu-1x'
148 changes: 0 additions & 148 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@logtail/node": "^0.4.21",
"@sentry/node": "^7.112.2",
"@teknologi-umum/nedb-promises": "^5.0.3",
"@teknologi-umum/pesto": "^1.0.0",
"carret": "^1.0.4",
"cheerio": "^1.0.0-rc.12",
"dotenv": "^16.3.1",
Expand Down
10 changes: 2 additions & 8 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import * as meme from "#services/meme/index.js";
import * as help from "#services/help/index.js";
import * as quote from "#services/quote/index.js";
import * as covid from "#services/covid/index.js";
import * as snap from "#services/snap/index.js";
import * as blidingej from "#services/bliding-ej/index.js";
import * as evalBot from "#services/eval/index.js";
import * as blog from "#services/devread/index.js";
Expand All @@ -25,7 +24,6 @@ import * as laodeai from "#services/laodeai/index.js";
import * as analytics from "#services/analytics/index.js";
import * as news from "#services/news/index.js";
import * as qr from "#services/qr/index.js";
import * as pesto from "#services/pesto/index.js";
import { getCommandName } from "#utils/command.js";

dotenv.config({ path: pathTo(import.meta.url, "../.env") });
Expand All @@ -52,13 +50,11 @@ const mongo = mongoose.createConnection(String(process.env.MONGO_URL), {

// Fork processes
const hackernewsFork = fork(pathTo(import.meta.url, "./hackernews.js"), { detached: true });
const uptimeFork = fork(pathTo(import.meta.url, "./uptime.js", { detached: true }));

async function terminate(caller) {
const t = Date.now();
bot.stop(caller);
hackernewsFork.kill();
uptimeFork.kill();
await mongo.close();
await Sentry.flush();
terminal.info(`${caller}: ${Date.now() - t}ms`);
Expand All @@ -77,7 +73,7 @@ async function main() {
}

// TODO: Move this somewhere else
const validCommands = ["blidingej", "covid", "devread", "dukun", "eval", "laodeai", "news", "hilih", "joke", "kktbsys", "yntks", "homework", "illuminati", "c", "cpp", "clisp", "dotnet", "go", "java", "js", "julia", "lua", "php", "python", "ruby", "sqlite3", "tengo", "ts", "v", "brainfuck", "qr", "quote", "search", "snap"];
const validCommands = ["blidingej", "covid", "devread", "dukun", "eval", "laodeai", "news", "hilih", "joke", "kktbsys", "yntks", "homework", "illuminati", "qr", "quote", "search"];
if (ctx.updateType === "message") {
const command = getCommandName(ctx);
if (command === "" || !validCommands.includes(command)) {
Expand Down Expand Up @@ -108,7 +104,6 @@ async function main() {
quote.register(bot),
covid.register(bot, cache),
poll.register(bot, mongo, cache),
snap.register(bot),
blidingej.register(bot),
evalBot.register(bot),
blog.register(bot, cache),
Expand All @@ -118,8 +113,7 @@ async function main() {
laodeai.register(bot),
analytics.register(bot, mongo),
news.register(bot),
qr.register(bot),
pesto.register(bot)
qr.register(bot)
]
.filter((v) => Array.isArray(v))
.flat();
Expand Down
Loading
Loading