├── .gitignore ├── README.md ├── Dockerfile ├── fly.toml ├── LICENSE ├── config.yaml └── .github └── workflows └── deploy.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Aquarium 2 | Bot cluster built on BLÅHAJ and fly.io. 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:latest 2 | 3 | WORKDIR /app 4 | 5 | COPY blahaj config.yaml ./ 6 | 7 | COPY nmsl-telegram-bot bible.json ./ 8 | 9 | COPY hithit_bot chi-tg-inline-rs tg-agda-detector ./ 10 | 11 | RUN chmod +x blahaj nmsl-telegram-bot hithit_bot chi-tg-inline-rs tg-agda-detector 12 | 13 | EXPOSE 8080 14 | 15 | CMD ["./blahaj", "config.yaml"] -------------------------------------------------------------------------------- /fly.toml: -------------------------------------------------------------------------------- 1 | # fly.toml file generated for aquarium on 2021-12-17T01:41:58+08:00 2 | 3 | app = "aquarium" 4 | 5 | kill_signal = "SIGINT" 6 | kill_timeout = 5 7 | 8 | [env] 9 | 10 | [experimental] 11 | allowed_public_ports = [] 12 | auto_rollback = true 13 | 14 | [[services]] 15 | internal_port = 8080 16 | protocol = "tcp" 17 | 18 | [services.concurrency] 19 | hard_limit = 25 20 | soft_limit = 20 21 | type = "connections" 22 | 23 | [[services.ports]] 24 | handlers = ["http"] 25 | port = 80 26 | 27 | [[services.ports]] 28 | handlers = ["tls", "http"] 29 | port = 443 30 | 31 | [[services.http_checks]] 32 | grace_period = "5s" 33 | interval = "15s" 34 | timeout = "2s" 35 | method = "get" 36 | path = "/blahaj/health" 37 | protocol = "http" 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 LightQuantum 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | bind: "0.0.0.0:8080" 2 | programs: 3 | nmsl: 4 | command: ./nmsl-telegram-bot 5 | env: 6 | TELOXIDE_TOKEN: $NMSL_TOKEN 7 | APP_BIND_ADDR: 127.0.0.1:8081 8 | APP_WEBHOOK_URL: https://aquarium.fly.dev/nmsl/ 9 | APP_WEBHOOK_PATH: $NMSL_PATH 10 | APP_BIBLE: bible.json 11 | RUST_LOG: info 12 | http: 13 | port: 8081 14 | path: nmsl 15 | strip-path: true 16 | health-check: 17 | path: /health-check 18 | interval: 5s 19 | grace: 15s 20 | hithit: 21 | command: ./hithit_bot 22 | env: 23 | TELOXIDE_TOKEN: $HITHIT_TOKEN 24 | APP_BIND_ADDR: 127.0.0.1:8082 25 | APP_WEBHOOK_URL: https://aquarium.fly.dev/hithit/$HITHIT_PATH 26 | APP_WEBHOOK_PATH: /$HITHIT_PATH 27 | DATABASE_URL: $HITHIT_DATABASE_URL 28 | DATABASE_PASSWORD: $HITHIT_DATABASE_PASSWORD 29 | RUST_LOG: info 30 | SENTRY_DSN: $HITHIT_SENTRY_DSN 31 | http: 32 | port: 8082 33 | path: hithit 34 | strip-path: true 35 | health-check: 36 | path: /health-check 37 | interval: 5s 38 | grace: 15s 39 | chi: 40 | command: ./chi-tg-inline-rs 41 | env: 42 | TELOXIDE_TOKEN: $CHI_TOKEN 43 | APP_BIND_ADDR: 127.0.0.1:8083 44 | APP_CORPUS_URL: https://raw.githubusercontent.com/Chi-Task-Force/Chi-Corpus/master/ 45 | APP_MONGODB_URI: $CHI_MONGODB_URI 46 | APP_MONGODB_DBNAME: chi 47 | APP_WEBHOOK_URL: https://aquarium.fly.dev/chi/ 48 | APP_WEBHOOK_PATH: $CHI_PATH 49 | RUST_LOG: info 50 | http: 51 | port: 8083 52 | path: chi 53 | strip-path: true 54 | health-check: 55 | path: /health-check 56 | interval: 5s 57 | grace: 15s 58 | agda: 59 | command: ./tg-agda-detector 60 | env: 61 | TELOXIDE_TOKEN: $AGDA_TOKEN 62 | APP_BIND_ADDR: 127.0.0.1:8084 63 | APP_WEBHOOK_URL: https://aquarium.fly.dev/agda/$AGDA_PATH 64 | APP_WEBHOOK_PATH: /$AGDA_PATH 65 | DATABASE_URL: $AGDA_DATABASE_URL 66 | DATABASE_PASSWORD: $AGDA_DATABASE_PASSWORD 67 | RUST_LOG: info 68 | http: 69 | port: 8084 70 | path: agda 71 | strip-path: true 72 | health-check: 73 | path: /health-check 74 | interval: 5s 75 | grace: 15s 76 | -------------------------------------------------------------------------------- /.github/workflows/deploy.yml: -------------------------------------------------------------------------------- 1 | on: 2 | repository_dispatch: 3 | types: [ deploy ] 4 | push: 5 | branches: 6 | - master 7 | 8 | name: Deploy 9 | 10 | env: 11 | FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} 12 | 13 | jobs: 14 | deploy: 15 | name: Deploy to fly.io 16 | if: ${{ github.ref == 'refs/heads/master' }} 17 | runs-on: ubuntu-latest 18 | steps: 19 | - uses: actions/checkout@v4 20 | - uses: superfly/flyctl-actions/setup-flyctl@master 21 | - name: Fetch BLÅHAJ 22 | uses: dawidd6/action-download-artifact@v3 23 | with: 24 | github_token: ${{secrets.GH_TOKEN}} 25 | workflow: deploy.yml 26 | workflow_conclusion: success 27 | branch: master 28 | name: release-musl 29 | path: . 30 | repo: PhotonQuantum/blahaj 31 | - name: Fetch nmsl 32 | uses: dawidd6/action-download-artifact@v3 33 | with: 34 | github_token: ${{secrets.GH_TOKEN}} 35 | workflow: deploy.yml 36 | workflow_conclusion: success 37 | branch: master 38 | name: release-musl 39 | path: . 40 | repo: PhotonQuantum/nmsl-telegram-bot-rs 41 | - name: Fetch hithit 42 | uses: dawidd6/action-download-artifact@v3 43 | with: 44 | github_token: ${{secrets.GH_TOKEN}} 45 | workflow: deploy.yml 46 | workflow_conclusion: success 47 | branch: master 48 | name: release-musl 49 | path: . 50 | repo: PhotonQuantum/hithit_bot 51 | - name: Fetch chi 52 | uses: dawidd6/action-download-artifact@v3 53 | with: 54 | github_token: ${{secrets.GH_TOKEN}} 55 | workflow: deploy.yml 56 | workflow_conclusion: success 57 | branch: main 58 | name: release-musl 59 | path: . 60 | repo: Chi-Task-Force/Chi-Telegram-Inline-Bot-Neo 61 | - name: Fetch agda 62 | uses: dawidd6/action-download-artifact@v3 63 | with: 64 | github_token: ${{secrets.GH_TOKEN}} 65 | workflow: deploy.yml 66 | workflow_conclusion: success 67 | branch: master 68 | name: release-musl 69 | path: . 70 | repo: PhotonQuantum/tg_agda_detector 71 | - name: Launch 72 | run: flyctl deploy --remote-only 73 | env: 74 | FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} 75 | --------------------------------------------------------------------------------