init
This commit is contained in:
4
neuralink/.env
Executable file
4
neuralink/.env
Executable file
@@ -0,0 +1,4 @@
|
||||
POSTGRES_USER=neuralink
|
||||
POSTGRES_DB=neuralink_db
|
||||
POSTGRES_PASSWORD=neuralink_password
|
||||
PGDATA=/data/postgres
|
||||
7
neuralink/build/cleaner/Dockerfile
Executable file
7
neuralink/build/cleaner/Dockerfile
Executable file
@@ -0,0 +1,7 @@
|
||||
FROM ubuntu:24.04
|
||||
RUN apt-get update && apt-get install postgresql-client -yqq \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --chmod=755 cleaner.sh /cleaner.sh
|
||||
|
||||
CMD ["/cleaner.sh"]
|
||||
7
neuralink/build/cleaner/cleaner.sh
Executable file
7
neuralink/build/cleaner/cleaner.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
while true; do
|
||||
psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@db:5432/$POSTGRES_DB -c "DELETE FROM users WHERE timestamp <= NOW() - INTERVAL '15 minutes'";
|
||||
psql postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@db:5432/$POSTGRES_DB -c "DELETE FROM implants WHERE timestamp <= NOW() - INTERVAL '15 minutes'";
|
||||
sleep 60;
|
||||
done
|
||||
3
neuralink/build/database/Dockerfile
Executable file
3
neuralink/build/database/Dockerfile
Executable file
@@ -0,0 +1,3 @@
|
||||
FROM postgres:16.3
|
||||
|
||||
COPY db.sql /docker-entrypoint-initdb.d/
|
||||
18
neuralink/build/database/db.sql
Executable file
18
neuralink/build/database/db.sql
Executable file
@@ -0,0 +1,18 @@
|
||||
CREATE TABLE users (
|
||||
id SERIAL PRIMARY KEY,
|
||||
username VARCHAR(256) NOT NULL,
|
||||
password VARCHAR(256) NOT NULL,
|
||||
securitycode VARCHAR(3) NOT NULL,
|
||||
timestamp TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE implants (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(256) NOT NULL,
|
||||
info VARCHAR(256) NOT NULL,
|
||||
ownername VARCHAR(256) NOT NULL,
|
||||
timestamp TIMESTAMP NOT NULL
|
||||
);
|
||||
|
||||
ALTER TABLE users ALTER COLUMN timestamp SET DEFAULT now();
|
||||
ALTER TABLE implants ALTER COLUMN timestamp SET DEFAULT now();
|
||||
10
neuralink/build/service/Dockerfile
Executable file
10
neuralink/build/service/Dockerfile
Executable file
@@ -0,0 +1,10 @@
|
||||
FROM ubuntu:25.04
|
||||
|
||||
RUN apt-get update && apt-get install socat libpqxx-dev libsodium-dev lsb-release -yqq \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --chmod=755 ./server.sh /home/
|
||||
COPY --chmod=755 ./chip_manager_service /home/
|
||||
COPY ./[^scD]* .
|
||||
|
||||
ENTRYPOINT /home/server.sh
|
||||
BIN
neuralink/build/service/chip_manager_service
Executable file
BIN
neuralink/build/service/chip_manager_service
Executable file
Binary file not shown.
3
neuralink/build/service/server.sh
Executable file
3
neuralink/build/service/server.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
socat TCP-LISTEN:1224,reuseaddr,fork SYSTEM:"timeout -s SIGKILL 60 /home/chip_manager_service"
|
||||
56
neuralink/docker-compose.yml
Executable file
56
neuralink/docker-compose.yml
Executable file
@@ -0,0 +1,56 @@
|
||||
services:
|
||||
chip_manager_service:
|
||||
build: build/service/
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- path: ./.env
|
||||
ports:
|
||||
- "1224:1224"
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 2G
|
||||
logging:
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "10k"
|
||||
max-file: "3"
|
||||
networks:
|
||||
- neuralink
|
||||
db:
|
||||
build: build/database/
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- path: ./.env
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 2G
|
||||
healthcheck:
|
||||
test: ["CMD", "psql", "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
networks:
|
||||
- neuralink
|
||||
cleaner:
|
||||
build: build/cleaner/
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- path: ./.env
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
cpus: '2'
|
||||
memory: 2G
|
||||
networks:
|
||||
- neuralink
|
||||
|
||||
networks:
|
||||
neuralink:
|
||||
driver: bridge
|
||||
Reference in New Issue
Block a user