init
This commit is contained in:
4
ticktalk/docker/.env
Executable file
4
ticktalk/docker/.env
Executable file
@@ -0,0 +1,4 @@
|
||||
POSTGRES_USER=ticktalk_user
|
||||
POSTGRES_PASSWORD=ticktack
|
||||
POSTGRES_DB=ticktalk_db
|
||||
TEAM_TOKEN=7ajI7AlyA5Lu9KKA
|
||||
37
ticktalk/docker/backend/Dockerfile
Executable file
37
ticktalk/docker/backend/Dockerfile
Executable file
@@ -0,0 +1,37 @@
|
||||
FROM lukemathwalker/cargo-chef:latest-rust-1.91.1-slim-trixie AS chef
|
||||
WORKDIR /app
|
||||
|
||||
FROM chef AS planner
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
COPY crates/ ./crates/
|
||||
RUN cargo chef prepare --recipe-path recipe.json
|
||||
|
||||
FROM chef AS builder
|
||||
COPY --from=planner /app/recipe.json recipe.json
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
RUN cargo chef cook --release --recipe-path recipe.json
|
||||
RUN cargo install diesel_cli --no-default-features --features postgres
|
||||
|
||||
COPY . .
|
||||
RUN cargo build --release --bin ticktalk-backend
|
||||
|
||||
FROM ubuntu:24.04 AS runtime
|
||||
WORKDIR /app
|
||||
|
||||
COPY docker/backend/entrypoint.sh .
|
||||
COPY --from=builder /app/target/release/ticktalk-backend /usr/local/bin/backend
|
||||
COPY --from=builder /usr/local/cargo/bin/diesel ./diesel
|
||||
COPY --chmod=755 client/kauth /usr/local/bin/kauth
|
||||
COPY crates/db/migrations ./migrations
|
||||
COPY crates/db/diesel.toml .
|
||||
|
||||
RUN apt-get update && apt install -y \
|
||||
libpq-dev \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& chmod +x ./entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "./entrypoint.sh" ]
|
||||
4
ticktalk/docker/backend/entrypoint.sh
Executable file
4
ticktalk/docker/backend/entrypoint.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
|
||||
./diesel setup || exit 1
|
||||
exec /usr/local/bin/backend
|
||||
8
ticktalk/docker/cleaner/Dockerfile
Executable file
8
ticktalk/docker/cleaner/Dockerfile
Executable file
@@ -0,0 +1,8 @@
|
||||
FROM ubuntu:24.04
|
||||
RUN apt update && apt install -y postgresql-client && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./cleaner.sh /cleaner.sh
|
||||
RUN chmod +x /cleaner.sh
|
||||
|
||||
ENTRYPOINT [ "/cleaner.sh" ]
|
||||
28
ticktalk/docker/cleaner/cleaner.sh
Executable file
28
ticktalk/docker/cleaner/cleaner.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DIR="/caches"
|
||||
|
||||
while true; do
|
||||
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
echo "[$TIMESTAMP] Starting cleanup"
|
||||
|
||||
if [ -d "${DIR}" ]; then
|
||||
find "${DIR}" -type f -mmin +6 -delete 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -n "${DATABASE_URL}" ]; then
|
||||
psql "${DATABASE_URL}" -v "ON_ERROR_STOP=1" <<'SQL'
|
||||
BEGIN;
|
||||
DELETE FROM chats WHERE created_at <= NOW() - INTERVAL '6 minutes';
|
||||
DELETE FROM messages WHERE created_at <= NOW() - INTERVAL '6 minutes';
|
||||
DELETE FROM users WHERE created_at <= NOW() - INTERVAL '6 minutes';
|
||||
COMMIT;
|
||||
SQL
|
||||
else
|
||||
echo " DATABASE_URL not set, skipping DB cleanup"
|
||||
fi
|
||||
|
||||
echo "[$TIMESTAMP] Cleanup completed"
|
||||
sleep 60
|
||||
done
|
||||
17
ticktalk/docker/kdc/Dockerfile
Executable file
17
ticktalk/docker/kdc/Dockerfile
Executable file
@@ -0,0 +1,17 @@
|
||||
FROM ubuntu:24.04
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
g++ \
|
||||
libssl-dev \
|
||||
libboost-system-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . /app/
|
||||
|
||||
RUN mkdir -p /var/log && mkdir -p /app/data
|
||||
|
||||
EXPOSE 88
|
||||
|
||||
CMD ["./kerberos_kdc"]
|
||||
17
ticktalk/docker/kdc/config.json
Executable file
17
ticktalk/docker/kdc/config.json
Executable file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"kdc": {
|
||||
"port": 88,
|
||||
"thread_pool_size": 10,
|
||||
"realm": "TICKTALK.LOCAL",
|
||||
"team_id": "2",
|
||||
"principals_file": "/app/data/principals.json",
|
||||
"krbtgt_key_file": "/app/data/krbtgt_key.txt"
|
||||
},
|
||||
"redis": {
|
||||
"host": "redis",
|
||||
"port": 6379
|
||||
},
|
||||
"logging": {
|
||||
"levels": "INFO,WARNING,ERROR,DEBUG"
|
||||
}
|
||||
}
|
||||
BIN
ticktalk/docker/kdc/kerberos_kdc
Executable file
BIN
ticktalk/docker/kdc/kerberos_kdc
Executable file
Binary file not shown.
Reference in New Issue
Block a user