From 5488a7bd268551f7b7d977657522614c0d8398f4 Mon Sep 17 00:00:00 2001 From: syui Date: Thu, 22 Feb 2024 20:03:29 +0900 Subject: [PATCH] add file --- .gitignore | 4 ++++ Dockerfile | 15 ++++++++++++ config.yaml | 30 +++++++++++++++++++++++ docker-compose.yaml | 58 +++++++++++++++++++++++++++++++++++++++++++++ fly.toml | 33 ++++++++++++++++++++++++++ 5 files changed, 140 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 config.yaml create mode 100644 docker-compose.yaml create mode 100644 fly.toml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3a0473b --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.pg_data +mitra +mitra-web +dist diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..dba41d7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM syui/aios + +RUN git clone https://codeberg.org/silverpill/mitra /app/tmp + +WORKDIR /app/tmp +RUN cargo build --release --features production +RUN mv target/release/mitra /app/ +RUN mv target/release/mitractl /app/ + +WORKDIR /app +RUN rm -rf /app/tmp +ADD ./config.yaml /app/ +ADD ./dist /app/dist + +ENTRYPOINT ["/app/mitra"] diff --git a/config.yaml b/config.yaml new file mode 100644 index 0000000..9017448 --- /dev/null +++ b/config.yaml @@ -0,0 +1,30 @@ +# Mitra configuration file + +database_url: postgres://mitra:mitra@database/mitra +storage_dir: /app/data +web_client_dir: /app/dist + +http_host: '0.0.0.0' +http_port: 8383 + +instance_uri: https://mitra.syu.is +instance_title: mitra.syu.is +instance_short_description: mitra.syu.is +# Long description can contain markdown syntax +instance_description: | + # My instance + Welcome! +# Make list of instance admins public +instance_staff_public: true +instance_timeline_public: true + +registration: + type: invite + default_role: user + +retention: + extraneous_posts: 50 + empty_profiles: 150 + +federation: + enabled: true diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..21a820c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,58 @@ +version: "3" + +services: + mitra: + ports: + - 8383:8383 + build: + context: . + environment: + CONFIG_PATH: /app/config.yaml + volumes: + - ./data:/app/data + depends_on: + database: + condition: service_healthy + + database: + #ports: + #- 55432:5432 + image: postgres:13-bullseye + restart: always + environment: + POSTGRES_PASSWORD: mitra + POSTGRES_USER: mitra + POSTGRES_DB: mitra + volumes: + - ./postgres_database:/var/lib/postgresql/data + healthcheck: + test: ["CMD-SHELL", "pg_isready"] + interval: 10s + timeout: 5s + retries: 5 + + # https://github.com/farcaster-project/containers + monerod: + profiles: + - monero + image: ghcr.io/farcaster-project/containers/monerod:0.18.2.2 + environment: + NETWORK: regtest + OFFLINE: --offline + DIFFICULTY: 1 + ports: + - "58081:18081" + monero-wallet-rpc: + profiles: + - monero + image: ghcr.io/farcaster-project/containers/monero-wallet-rpc:0.18.2.2 + environment: + MONERO_DAEMON_ADDRESS: monerod:18081 + WALLET_RPC_PORT: 18083 + depends_on: + - "monerod" + ports: + - "58083:18083" + volumes: + - ./monero_wallets:/wallets + diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..fee39e0 --- /dev/null +++ b/fly.toml @@ -0,0 +1,33 @@ +app = "xxx" +kill_signal = "SIGINT" +kill_timeout = 10 + +[env] +PORT = "8380" + +[experimental] +cmd = "./mitra" + +[[services]] + internal_port = 8380 + protocol = "tcp" + + [[services.ports]] + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + +# [[services.ports]] +# handlers = ["tls", "http"] +# port = 5001 +# +# [[services.ports]] +# handlers = ["tls", "http"] +# port = 8001 + +[mounts] +source="mitra_data" +destination="/app/files"