Compare commits

..

No commits in common. "50670fcbf599b1b75326f6a0196a53828d395211" and "c8e91312fb3f77c878eee3e5897ff913c89816f2" have entirely different histories.

7 changed files with 3 additions and 174 deletions

View File

@ -123,8 +123,6 @@ spec:
value: "" value: ""
- name: HTTP_CHECK_TIMEOUT_SEC - name: HTTP_CHECK_TIMEOUT_SEC
value: "15" value: "15"
- name: MONERO_GET_INFO_URL
value: http://monerod.crypto.svc.cluster.local:18084/get_info
- name: PORTAL_DB_POOL_MIN - name: PORTAL_DB_POOL_MIN
value: "0" value: "0"
- name: PORTAL_DB_POOL_MAX - name: PORTAL_DB_POOL_MAX

View File

@ -57,9 +57,6 @@ spec:
- --rpc-bind-ip=0.0.0.0 - --rpc-bind-ip=0.0.0.0
- --rpc-bind-port=18081 - --rpc-bind-port=18081
- --confirm-external-bind - --confirm-external-bind
- --rpc-ssl=disabled
- --log-file=/tmp/monerod.log
- --max-log-files=2
- --p2p-bind-ip=0.0.0.0 - --p2p-bind-ip=0.0.0.0
- --p2p-bind-port=18080 - --p2p-bind-port=18080
- --no-igd - --no-igd
@ -109,45 +106,8 @@ spec:
volumeMounts: volumeMounts:
- { name: data, mountPath: /data } - { name: data, mountPath: /data }
- { name: tmp, mountPath: /tmp } - { name: tmp, mountPath: /tmp }
- name: status-proxy
image: python:3.11-alpine
command: ["python", "/app/status_proxy.py"]
ports:
- { name: status, containerPort: 18084 }
env:
- name: MONEROD_LOG_FILE
value: /tmp/monerod.log
- name: MONEROD_STATUS_RPC_TIMEOUT_SEC
value: "1.25"
readinessProbe:
httpGet:
path: /healthz
port: status
initialDelaySeconds: 2
periodSeconds: 10
timeoutSeconds: 2
livenessProbe:
httpGet:
path: /healthz
port: status
initialDelaySeconds: 10
periodSeconds: 20
timeoutSeconds: 2
resources:
requests:
cpu: 10m
memory: 32Mi
limits:
cpu: 100m
memory: 128Mi
volumeMounts:
- { name: tmp, mountPath: /tmp }
- { name: status-proxy, mountPath: /app/status_proxy.py, subPath: status_proxy.py }
volumes: volumes:
- name: data - name: data
persistentVolumeClaim: { claimName: monerod-chain } persistentVolumeClaim: { claimName: monerod-chain }
- name: tmp - name: tmp
emptyDir: {} emptyDir: {}
- name: status-proxy
configMap:
name: monerod-status-proxy

View File

@ -4,7 +4,6 @@ kind: Kustomization
resources: resources:
- pvc.yaml - pvc.yaml
- cm-release-keys.yaml - cm-release-keys.yaml
- status-proxy-configmap.yaml
- deployment.yaml - deployment.yaml
- service.yaml - service.yaml
- ingress.yaml - ingress.yaml

View File

@ -10,6 +10,5 @@ spec:
selector: { app: monerod } selector: { app: monerod }
ports: ports:
- { name: rpc, port: 18081, targetPort: 18081 } - { name: rpc, port: 18081, targetPort: 18081 }
- { name: status, port: 18084, targetPort: 18084 }
- { name: p2p, port: 18080, targetPort: 18080 } - { name: p2p, port: 18080, targetPort: 18080 }
- { name: zmq, port: 18083, targetPort: 18083 } - { name: zmq, port: 18083, targetPort: 18083 }

View File

@ -1,94 +0,0 @@
# services/crypto/monerod/status-proxy-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: monerod-status-proxy
namespace: crypto
data:
status_proxy.py: |
from __future__ import annotations
import json
import os
import re
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib import error, request
LOG_FILE = os.environ.get("MONEROD_LOG_FILE", "/tmp/monerod.log")
LISTEN_PORT = int(os.environ.get("MONEROD_STATUS_PORT", "18084"))
RPC_TIMEOUT_SEC = float(os.environ.get("MONEROD_STATUS_RPC_TIMEOUT_SEC", "1.25"))
RPC_URL = os.environ.get("MONEROD_RPC_URL", "http://127.0.0.1:18081/get_info")
SYNC_RE = re.compile(r"Synced\s+(\d+)/(\d+).*?(\d+)\s+left")
CANDIDATE_RE = re.compile(
r"candidate:\s+(\d+)\s+->\s+(\d+).*?node is\s+(\d+)\s+blocks",
re.IGNORECASE,
)
def _tail_log(path: str, limit: int = 262_144) -> str:
try:
size = os.path.getsize(path)
with open(path, "rb") as handle:
handle.seek(max(0, size - limit))
return handle.read().decode("utf-8", "ignore")
except OSError:
return ""
def _sync_from_logs() -> tuple[int, int]:
for line in reversed(_tail_log(LOG_FILE).splitlines()):
match = SYNC_RE.search(line) or CANDIDATE_RE.search(line)
if match:
return int(match.group(1)), int(match.group(2))
return 0, 0
def _rpc_get_info() -> dict:
with request.urlopen(RPC_URL, timeout=RPC_TIMEOUT_SEC) as response:
payload = json.loads(response.read().decode("utf-8"))
if isinstance(payload, dict):
payload.setdefault("rpc_status", "ok")
return payload
return {"status": "BAD_UPSTREAM", "rpc_status": "bad_upstream"}
def _busy_status() -> dict:
height, target_height = _sync_from_logs()
return {
"nettype": "mainnet",
"status": "SYNCING_RPC_BUSY",
"height": height,
"target_height": target_height,
"synchronized": False,
"rpc_status": "busy",
}
class Handler(BaseHTTPRequestHandler):
def _json(self, status: int, payload: dict) -> None:
body = json.dumps(payload).encode("utf-8")
self.send_response(status)
self.send_header("Content-Type", "application/json")
self.send_header("Content-Length", str(len(body)))
self.end_headers()
self.wfile.write(body)
def do_GET(self) -> None: # noqa: N802
if self.path == "/healthz":
self._json(200, {"status": "ok"})
return
if self.path.split("?", 1)[0] != "/get_info":
self._json(404, {"status": "NOT_FOUND"})
return
try:
self._json(200, _rpc_get_info())
except (OSError, TimeoutError, ValueError, error.URLError):
self._json(200, _busy_status())
def log_message(self, fmt: str, *args) -> None:
return
if __name__ == "__main__":
ThreadingHTTPServer(("", LISTEN_PORT), Handler).serve_forever()

View File

@ -1,7 +1,6 @@
# services/gitea/oneoffs/veles-feedback-acl-ensure-job.yaml # services/gitea/oneoffs/veles-feedback-acl-ensure-job.yaml
# One-off job for gitea/veles-feedback-acl-ensure-2. # One-off job for gitea/veles-feedback-acl-ensure-2.
# Purpose: keep Veles feedback anonymously readable while limiting write access # Purpose: keep Veles testers on the feedback repo without granting source access.
# to testers/admins and avoiding source-code repository access.
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:

View File

@ -49,41 +49,11 @@ end $$;
update gitea.team team update gitea.team team
set authorize = 1, set authorize = 1,
includes_all_repositories = false, includes_all_repositories = true,
can_create_org_repo = false can_create_org_repo = false
from veles_acl_ids ids from veles_acl_ids ids
where team.id = ids.team_id; where team.id = ids.team_id;
update gitea."user" org
set visibility = 0
from veles_acl_ids ids
where org.id = ids.org_id;
update gitea.repository repo
set is_private = false
from veles_acl_ids ids
where repo.id = ids.repo_id;
delete from gitea.repo_unit unit
using veles_acl_ids ids
where unit.repo_id = ids.repo_id
and unit.type in (1, 3, 4, 5, 6, 7, 8, 9, 10);
insert into gitea.repo_unit (repo_id, type, config, created_unix, everyone_access_mode)
select
ids.repo_id,
2,
'{"EnableTimetracker":false,"AllowOnlyContributorsToTrackTime":true,"EnableDependencies":true}',
extract(epoch from now())::bigint,
0
from veles_acl_ids ids
where not exists (
select 1
from gitea.repo_unit existing
where existing.repo_id = ids.repo_id
and existing.type = 2
);
insert into gitea.team_repo (org_id, team_id, repo_id) insert into gitea.team_repo (org_id, team_id, repo_id)
select ids.org_id, ids.team_id, ids.repo_id select ids.org_id, ids.team_id, ids.repo_id
from veles_acl_ids ids from veles_acl_ids ids
@ -97,7 +67,7 @@ where not exists (
delete from gitea.team_unit unit delete from gitea.team_unit unit
using veles_acl_ids ids using veles_acl_ids ids
where unit.team_id = ids.team_id where unit.team_id = ids.team_id
and unit.type in (1, 2, 3, 4, 5, 6, 7, 8, 9, 10); and unit.type in (1, 2, 3, 4, 5, 8, 9, 10);
insert into gitea.team_unit (org_id, team_id, type, access_mode) insert into gitea.team_unit (org_id, team_id, type, access_mode)
select ids.org_id, ids.team_id, desired.type, desired.access_mode select ids.org_id, ids.team_id, desired.type, desired.access_mode
@ -109,8 +79,6 @@ cross join (
(3, 0), (3, 0),
(4, 0), (4, 0),
(5, 0), (5, 0),
(6, 0),
(7, 0),
(8, 0), (8, 0),
(9, 0), (9, 0),
(10, 0) (10, 0)