diff --git a/.dockerignore b/.dockerignore index 57e1bc7..2a6c8e4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -9,6 +9,7 @@ build-script.sh Dockerfile docker-compose.yml +render.yml node_modules dist diff --git a/README.md b/README.md index 2f5d70c..a84dc77 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ pnpm - default "334観測中" ### POST_DISABLED -- 何か値を設定するとMisskeyにノートが投稿されなくなります +- 値を`TRUE`に設定するとMisskeyにノートが投稿されなくなります - 手元で集計のみ行いたい場合等にお使いください ## etc.. @@ -98,6 +98,7 @@ pnpm ## Docker-Composeを用いた構築 この方法ではデータベースも同時に用意可能です ### 公式イメージを用いる場合 +※こちらも参考にしてください( https://github.com/taichanNE30/yamag-docker-compose-example ) 1. 適当なディレクトリを作成します 1. リポジトリ内のenv_templatesを参考に`.env.app`, `.env.db`を作成します 1. 以下のdocker-compose.ymlを作成します diff --git a/render.yaml b/render.yaml new file mode 100644 index 0000000..f4f554c --- /dev/null +++ b/render.yaml @@ -0,0 +1,71 @@ +services: + - type: cron + name: yamag-blueprint-note + runtime: node + schedule: "35 18 * * *" + region: singapore + repo: https://github.com/taichanne30/yamag.git + buildCommand: "bash build-script.sh" + startCommand: "pnpm start" + envVars: + - key: DATABASE_URL + fromDatabase: + name: yamag-blueprint-db + property: connectionString + - fromGroup: yamag-blueprint-settings + - type: cron + name: yamag-blueprint-remind + runtime: node + schedule: "32 18 * * *" + region: singapore + repo: https://github.com/taichanne30/yamag.git + buildCommand: "bash build-script.sh" + startCommand: "pnpm run remind" + envVars: + - fromGroup: yamag-blueprint-settings + - type: worker + name: yamag-blueprint-mention + runtime: node + region: singapore + repo: https://github.com/taichanne30/yamag.git + buildCommand: "bash build-script.sh" + startCommand: "pnpm run mentions" + envVars: + - key: DATABASE_URL + fromDatabase: + name: yamag-blueprint-db + property: connectionString + - fromGroup: yamag-blueprint-settings + +databases: + - name: yamag-blueprint-db + databaseName: yamag + region: singapore + plan: starter + ipAllowList: + - source: 0.0.0.0/0 + description: everywhere + +envVarGroups: + - name: yamag-blueprint-settings + envVars: + - key: TZ + sync: false + - key: RECORD_HOUR + sync: false + - key: RECORD_MINUTE + sync: false + - key: MATCHER + sync: false + - key: USER_NAME + sync: false + - key: POST_TITLE + sync: false + - key: REMIND_POST_TEXT + sync: false + - key: SERVER_ORIGIN + sync: false + - key: SERVER_TOKEN + sync: false + - key: POST_DISABLED + sync: false \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index faff2e8..d01e3a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -147,10 +147,14 @@ const getNotes = async ():Promise> => { ['public', 'home'].includes(note.visibility) && note.user.host === null }) + console.log(`対象のノート: ${filteredNotes.length}件`) let ranking = createRanks(filteredNotes) let text = showRanking(ranking) - let post = await retry(async() => { - YAMAG.Misskey.postNote(text) + console.log("ランキング集計完了\n") + console.log(text) + + await retry(async() => { + return await YAMAG.Misskey.postNote(text) }, { retries: 15, minTimeout: 5000, @@ -158,8 +162,14 @@ const getNotes = async ():Promise> => { console.log(`Retrying: note posting...${num}`) console.debug(err) } + }).then(async n => { + console.log('投稿完了') + }).catch(err => { + console.log("ノート投稿の失敗が既定の回数を超えました") + console.log(err) }) if (Config.isDbEnabled()) { storeRanks(ranking) + console.log('DBに結果を保存しました') } })()