Containerize application
This commit is contained in:
parent
a12ff2fa95
commit
19b69dc548
4 changed files with 85 additions and 15 deletions
|
|
@ -1,10 +1,8 @@
|
|||
import discord
|
||||
import os
|
||||
import requests
|
||||
from dotenv import load_dotenv
|
||||
from enum import Enum
|
||||
|
||||
load_dotenv()
|
||||
|
||||
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
||||
PB_TOKEN = os.getenv("PB_TOKEN")
|
||||
|
|
@ -108,7 +106,7 @@ async def on_voice_state_update(
|
|||
if channel and event:
|
||||
data = Data(member, channel, event)
|
||||
r = requests.post(
|
||||
"https://api.m3.fyi/api/collections/vc_stats/records",
|
||||
f"https://{PB_URL}/api/collections/{PB_COLLECTION}/records",
|
||||
json=data.__dict__,
|
||||
headers={"Authorization": PB_TOKEN, "content-type": "application/json"},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,23 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
|
@ -51,6 +68,40 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mk-shell-bin": {
|
||||
"locked": {
|
||||
"lastModified": 1677004959,
|
||||
"owner": "rrbutani",
|
||||
"repo": "nix-mk-shell-bin",
|
||||
"rev": "ff5d8bd4d68a347be5042e2f16caee391cd75887",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rrbutani",
|
||||
"repo": "nix-mk-shell-bin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix2container": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1730479402,
|
||||
"owner": "nlewo",
|
||||
"repo": "nix2container",
|
||||
"rev": "5fb215a1564baa74ce04ad7f903d94ad6617e17a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nlewo",
|
||||
"repo": "nix2container",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1733477122,
|
||||
|
|
@ -90,9 +141,25 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"mk-shell-bin": "mk-shell-bin",
|
||||
"nix2container": "nix2container",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
|
|
@ -1,8 +1,18 @@
|
|||
{ pkgs, lib, config, inputs, ... }:
|
||||
|
||||
{
|
||||
packages = [pkgs.openssl pkgs.cacert];
|
||||
dotenv.enable = true;
|
||||
# https://devenv.sh/languages/
|
||||
languages.python.enable = true;
|
||||
languages.python.venv.enable = true;
|
||||
languages.python.uv.enable = true;
|
||||
languages.python.uv.sync.enable = true;
|
||||
|
||||
processes.bot.exec = "uv run bot.py";
|
||||
containers."bot".name = "vc-stats-bot";
|
||||
containers."bot".startupCommand = config.processes.bot.exec;
|
||||
containers."bot".registry = "docker://git.m3.fyi/metrik/";
|
||||
containers."bot".enableLayerDeduplication = true;
|
||||
#containers."processes".copyToRoot = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,10 @@
|
|||
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
|
||||
inputs:
|
||||
nix2container:
|
||||
url: github:nlewo/nix2container
|
||||
inputs:
|
||||
nixpkgs:
|
||||
follows: nixpkgs
|
||||
nixpkgs:
|
||||
url: github:cachix/devenv-nixpkgs/rolling
|
||||
|
||||
# If you're using non-OSS software, you can set allowUnfree to true.
|
||||
# allowUnfree: true
|
||||
|
||||
# If you're willing to use a package that's vulnerable
|
||||
# permittedInsecurePackages:
|
||||
# - "openssl-1.1.1w"
|
||||
|
||||
# If you have more than one devenv you can merge them
|
||||
#imports:
|
||||
# - ./backend
|
||||
mk-shell-bin:
|
||||
url: github:rrbutani/nix-mk-shell-bin
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue