mirror of
https://github.com/modrinth/code.git
synced 2026-07-31 21:26:40 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27fbb18985 | ||
|
|
28a938dcc5 | ||
|
|
f93527078b | ||
|
|
e9d55ed4bf | ||
|
|
00a67c5b23 | ||
|
|
f15139cfe1 | ||
|
|
40371a7eff |
@@ -0,0 +1,57 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: labrinth
|
||||
labels:
|
||||
app.kubernetes.io/component: main
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: labrinth
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: labrinth
|
||||
spec:
|
||||
containers:
|
||||
- name: labrinth
|
||||
image: labrinth
|
||||
imagePullPolicy: IfNotPresent
|
||||
args:
|
||||
["/labrinth/labrinth", "--no-background-tasks", "--no-migrations"]
|
||||
env:
|
||||
- name: GOTENBERG_TIMEOUT
|
||||
value: "30000"
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
name: http
|
||||
resources: # Base resources for an API service, should be adjusted at the overlay level
|
||||
requests:
|
||||
cpu: "2"
|
||||
memory: 24Gi
|
||||
limits:
|
||||
cpu: "16"
|
||||
memory: 32Gi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
periodSeconds: 10
|
||||
failureThreshold: 5
|
||||
initialDelaySeconds: 20
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
periodSeconds: 5
|
||||
initialDelaySeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
startupProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
periodSeconds: 3
|
||||
initialDelaySeconds: 1
|
||||
failureThreshold: 15
|
||||
@@ -0,0 +1,5 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
@@ -0,0 +1,10 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: labrinth
|
||||
spec:
|
||||
selector:
|
||||
app: labrinth
|
||||
ports:
|
||||
- port: 80
|
||||
targetPort: 8000
|
||||
@@ -0,0 +1,2 @@
|
||||
image-config/kustomization.yaml
|
||||
config.env
|
||||
@@ -0,0 +1,159 @@
|
||||
DEBUG=true
|
||||
RUST_LOG=debug,actix_web_prom=error,sqlx::query=warn
|
||||
SENTRY_DSN=none
|
||||
|
||||
SITE_URL=http://localhost:3000
|
||||
# This CDN URL matches the local storage backend set below, which uses MOCK_FILE_PATH
|
||||
CDN_URL=file:///tmp/modrinth
|
||||
LABRINTH_ADMIN_KEY=feedbeef
|
||||
LABRINTH_EXTERNAL_NOTIFICATION_KEY=beeffeed
|
||||
RATE_LIMIT_IGNORE_KEY=feedbeef
|
||||
|
||||
DATABASE_URL=postgresql://labrinth:labrinth@localhost/labrinth
|
||||
DATABASE_MIN_CONNECTIONS=0
|
||||
DATABASE_MAX_CONNECTIONS=16
|
||||
|
||||
#MEILISEARCH_READ_ADDR=http://labrinth-meilisearch0:7700
|
||||
MEILISEARCH_ADDR=http://localhost:7700
|
||||
#MEILISEARCH_WRITE_ADDRS=http://localhost:7700,http://localhost:7701
|
||||
MEILISEARCH_KEY=modrinth
|
||||
|
||||
REDIS_URL=redis://localhost
|
||||
REDIS_MAX_CONNECTIONS=10000
|
||||
|
||||
# Must bind to broadcast, not localhost, because some
|
||||
# Docker services (Gotenberg) must be able to reach the backend
|
||||
# from a different network interface
|
||||
BIND_ADDR=0.0.0.0:8000
|
||||
SELF_ADDR=http://127.0.0.1:8000
|
||||
|
||||
MODERATION_SLACK_WEBHOOK=
|
||||
PUBLIC_DISCORD_WEBHOOK=
|
||||
CLOUDFLARE_INTEGRATION=false
|
||||
|
||||
PAYOUT_ALERT_SLACK_WEBHOOK=none
|
||||
TREMENDOUS_BALANCE_ALERT_THRESHOLD=0
|
||||
PAYPAL_BALANCE_ALERT_THRESHOLD=0
|
||||
BREX_BALANCE_ALERT_THRESHOLD=0
|
||||
|
||||
STORAGE_BACKEND=local
|
||||
MOCK_FILE_PATH=/tmp/modrinth
|
||||
|
||||
S3_PUBLIC_BUCKET_NAME=none
|
||||
S3_PUBLIC_USES_PATH_STYLE_BUCKET=false
|
||||
S3_PUBLIC_REGION=none
|
||||
S3_PUBLIC_URL=none
|
||||
S3_PUBLIC_ACCESS_TOKEN=none
|
||||
S3_PUBLIC_SECRET=none
|
||||
|
||||
S3_PRIVATE_BUCKET_NAME=none
|
||||
S3_PRIVATE_USES_PATH_STYLE_BUCKET=false
|
||||
S3_PRIVATE_REGION=none
|
||||
S3_PRIVATE_URL=none
|
||||
S3_PRIVATE_ACCESS_TOKEN=none
|
||||
S3_PRIVATE_SECRET=none
|
||||
|
||||
# 1 hour
|
||||
LOCAL_INDEX_INTERVAL=3600
|
||||
# 30 minutes
|
||||
VERSION_INDEX_INTERVAL=1800
|
||||
|
||||
RATE_LIMIT_IGNORE_IPS=["127.0.0.1"]
|
||||
|
||||
WHITELISTED_MODPACK_DOMAINS=["cdn.modrinth.com", "github.com", "raw.githubusercontent.com"]
|
||||
|
||||
ALLOWED_CALLBACK_URLS=["localhost", ".modrinth.com", "127.0.0.1", "[::1]"]
|
||||
|
||||
GITHUB_CLIENT_ID=none
|
||||
GITHUB_CLIENT_SECRET=none
|
||||
|
||||
GITLAB_CLIENT_ID=none
|
||||
GITLAB_CLIENT_SECRET=none
|
||||
|
||||
DISCORD_CLIENT_ID=none
|
||||
DISCORD_CLIENT_SECRET=none
|
||||
|
||||
MICROSOFT_CLIENT_ID=none
|
||||
MICROSOFT_CLIENT_SECRET=none
|
||||
|
||||
GOOGLE_CLIENT_ID=none
|
||||
GOOGLE_CLIENT_SECRET=none
|
||||
|
||||
PAYPAL_API_URL=https://api-m.sandbox.paypal.com/v1/
|
||||
PAYPAL_WEBHOOK_ID=none
|
||||
PAYPAL_CLIENT_ID=none
|
||||
PAYPAL_CLIENT_SECRET=none
|
||||
PAYPAL_NVP_USERNAME=none
|
||||
PAYPAL_NVP_PASSWORD=none
|
||||
PAYPAL_NVP_SIGNATURE=none
|
||||
|
||||
STEAM_API_KEY=none
|
||||
|
||||
TREMENDOUS_API_URL=https://testflight.tremendous.com/api/v2/
|
||||
TREMENDOUS_API_KEY=none
|
||||
TREMENDOUS_PRIVATE_KEY=none
|
||||
TREMENDOUS_CAMPAIGN_ID=none
|
||||
|
||||
HCAPTCHA_SECRET=none
|
||||
|
||||
SMTP_FROM_NAME=Modrinth
|
||||
SMTP_FROM_ADDRESS=no-reply@mail.modrinth.com
|
||||
SMTP_USERNAME=
|
||||
SMTP_PASSWORD=
|
||||
SMTP_HOST=localhost
|
||||
SMTP_PORT=1025
|
||||
SMTP_TLS=none
|
||||
|
||||
SITE_VERIFY_EMAIL_PATH=auth/verify-email
|
||||
SITE_RESET_PASSWORD_PATH=auth/reset-password
|
||||
SITE_BILLING_PATH=none
|
||||
|
||||
SENDY_URL=none
|
||||
SENDY_LIST_ID=none
|
||||
SENDY_API_KEY=none
|
||||
|
||||
ANALYTICS_ALLOWED_ORIGINS=["http://127.0.0.1:3000", "http://localhost:3000", "https://modrinth.com", "https://www.modrinth.com", "*"]
|
||||
|
||||
CLICKHOUSE_REPLICATED=false
|
||||
CLICKHOUSE_URL=http://localhost:8123
|
||||
CLICKHOUSE_USER=default
|
||||
CLICKHOUSE_PASSWORD=default
|
||||
CLICKHOUSE_DATABASE=staging_ariadne
|
||||
|
||||
FLAME_ANVIL_URL=none
|
||||
|
||||
STRIPE_API_KEY=none
|
||||
STRIPE_WEBHOOK_SECRET=none
|
||||
|
||||
ADITUDE_API_KEY=none
|
||||
|
||||
PYRO_API_KEY=none
|
||||
|
||||
BREX_API_URL=https://platform.brexapis.com/v2/
|
||||
BREX_API_KEY=none
|
||||
|
||||
DELPHI_URL=http://localhost:59999
|
||||
DELPHI_SLACK_WEBHOOK=none
|
||||
|
||||
AVALARA_1099_API_URL=https://www.track1099.com/api
|
||||
AVALARA_1099_API_KEY=none
|
||||
AVALARA_1099_API_TEAM_ID=none
|
||||
AVALARA_1099_COMPANY_ID=207337084
|
||||
|
||||
COMPLIANCE_PAYOUT_THRESHOLD=disabled
|
||||
|
||||
ANROK_API_KEY=none
|
||||
ANROK_API_URL=none
|
||||
|
||||
GOTENBERG_URL=http://localhost:13000
|
||||
GOTENBERG_CALLBACK_BASE=http://host.docker.internal:8000/_internal/gotenberg
|
||||
GOTENBERG_TIMEOUT=30000
|
||||
|
||||
ARCHON_URL=none
|
||||
|
||||
MURALPAY_API_URL=https://api-staging.muralpay.com
|
||||
MURALPAY_API_KEY=none
|
||||
MURALPAY_TRANSFER_API_KEY=none
|
||||
MURALPAY_SOURCE_ACCOUNT_ID=none
|
||||
|
||||
DEFAULT_AFFILIATE_REVENUE_SPLIT=0.1
|
||||
@@ -0,0 +1,13 @@
|
||||
# vscode-kubernetes-tools: exclude
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: labrinth
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: labrinth
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: local-config
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: placeholder
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: nginx-gateway
|
||||
@@ -0,0 +1,17 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: Gateway
|
||||
metadata:
|
||||
name: main-gateway
|
||||
namespace: nginx-gateway
|
||||
spec:
|
||||
gatewayClassName: nginx
|
||||
listeners:
|
||||
- name: http
|
||||
port: 80
|
||||
protocol: HTTP
|
||||
allowedRoutes:
|
||||
namespaces:
|
||||
from: Selector
|
||||
selector:
|
||||
matchLabels:
|
||||
gateway-access: 'true'
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1alpha1
|
||||
kind: Componen
|
||||
images:
|
||||
- name: labrinth
|
||||
newName: modrinth.local/labrinth # Change with your local build of labrinth or a remote image build (like ghcr.io/modrinth/labrinth:main)
|
||||
newTag: latest
|
||||
@@ -0,0 +1,30 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources:
|
||||
- ../../scopes/apis
|
||||
- ../../scopes/auth
|
||||
- ../../scopes/billing
|
||||
- ../../scopes/friends
|
||||
- ../../scopes/teams
|
||||
- ../../scopes/version_files
|
||||
- ../../scopes/webhooks
|
||||
- ../../scopes/websocket
|
||||
- ./gateway.yaml
|
||||
components:
|
||||
- ./image-config
|
||||
configMapGenerator:
|
||||
- name: local-config
|
||||
envs:
|
||||
- config.env
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: true
|
||||
patches:
|
||||
- path: resources-patch.yaml
|
||||
target:
|
||||
kind: Deployment
|
||||
- path: envfrom-patch.yaml
|
||||
target:
|
||||
kind: Deployment
|
||||
- path: gateway-namespace-patch.yaml
|
||||
target:
|
||||
kind: HTTPRoute
|
||||
@@ -0,0 +1,17 @@
|
||||
# vscode-kubernetes-tools: exclude
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: labrinth
|
||||
spec:
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
- name: labrinth
|
||||
resources:
|
||||
requests:
|
||||
cpu: "0.25"
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 256Mi
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
NGINX_GATEWAY_FABRIC_TAG="v2.3.0"
|
||||
GATEWAY_API_TAG="v1.4.1"
|
||||
|
||||
kubectl config use-context orbstack
|
||||
|
||||
# Gateway api
|
||||
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/${GATEWAY_API_TAG}/standard-install.yaml
|
||||
kubectl kustomize "https://github.com/nginx/nginx-gateway-fabric/config/crd/gateway-api/standard?ref=${NGINX_GATEWAY_FABRIC_TAG}" | kubectl apply -f -
|
||||
kubectl apply --server-side -f https://raw.githubusercontent.com/nginx/nginx-gateway-fabric/${NGINX_GATEWAY_FABRIC_TAG}/deploy/crds.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/nginx/nginx-gateway-fabric/${NGINX_GATEWAY_FABRIC_TAG}/deploy/default/deploy.yaml
|
||||
|
||||
# Local overlay
|
||||
|
||||
kubectl apply -k k8s/overlays/local
|
||||
|
||||
# Check
|
||||
kubectl get pods
|
||||
@@ -0,0 +1,29 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /v3
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /v2
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /api/v1
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /_internal
|
||||
# Use this service as a fallback for all other routes
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /
|
||||
backendRefs:
|
||||
- name: api-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: api-
|
||||
commonLabels:
|
||||
scope: api
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
@@ -0,0 +1,25 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v3/user
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v2/user
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /_internal/auth
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /_internal/oauth
|
||||
backendRefs:
|
||||
- name: auth-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: auth-
|
||||
commonLabels:
|
||||
scope: auth
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /_internal/billing
|
||||
- path:
|
||||
type: Exact
|
||||
value: /_internal/_stripe
|
||||
backendRefs:
|
||||
- name: billing-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: billing-
|
||||
commonLabels:
|
||||
scope: billing
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /v3/friends
|
||||
- path:
|
||||
type: PathPrefix
|
||||
value: /v3/friend
|
||||
backendRefs:
|
||||
- name: friends-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: friends-
|
||||
commonLabels:
|
||||
scope: friends
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v3/teams
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v2/teams
|
||||
backendRefs:
|
||||
- name: teams-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: teams-
|
||||
commonLabels:
|
||||
scope: teams
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
@@ -0,0 +1,19 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v3/version_files
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v2/version_files
|
||||
backendRefs:
|
||||
- name: version-files-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: version-files-
|
||||
commonLabels:
|
||||
scope: version-files
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
@@ -0,0 +1,26 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
# The _stripe webhook is in the billing scope
|
||||
- path:
|
||||
type: Exact
|
||||
value: /_internal/gotenberg/success
|
||||
- path:
|
||||
type: Exact
|
||||
value: /_internal/gotenberg/error
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v3/payout/_paypal
|
||||
- path:
|
||||
type: Exact
|
||||
value: /v3/payout/_tremendous
|
||||
backendRefs:
|
||||
- name: webhooks-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: webhooks-
|
||||
commonLabels:
|
||||
scope: webhooks
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: gateway.networking.k8s.io/v1
|
||||
kind: HTTPRoute
|
||||
metadata:
|
||||
name: routes
|
||||
spec:
|
||||
parentRefs:
|
||||
- name: main-gateway
|
||||
namespace: ${GATEWAY_NAMESPACE}
|
||||
rules:
|
||||
- matches:
|
||||
- path:
|
||||
type: Exact
|
||||
value: /_internal/launcher_socket
|
||||
backendRefs:
|
||||
- name: websocket-labrinth
|
||||
port: 80
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
namePrefix: websocket-
|
||||
commonLabels:
|
||||
scope: websocket
|
||||
resources:
|
||||
- ../../base
|
||||
- httproute.yaml
|
||||
Reference in New Issue
Block a user