mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-18 08:50:59 -05:00
Compare commits
No commits in common. "f7e9a14d635219925bf1323ab563aabd821d9200" and "d1b9d7a618de72ed9fb8be4d6d2b7c954a767c44" have entirely different histories.
f7e9a14d63
...
d1b9d7a618
@ -1,3 +1,4 @@
|
|||||||
|
# Pointless stuff
|
||||||
Dockerfile
|
Dockerfile
|
||||||
docker-compose.*.yml
|
docker-compose.*.yml
|
||||||
.ncurc.json
|
.ncurc.json
|
||||||
@ -8,4 +9,6 @@ docker-compose.*.yml
|
|||||||
.github
|
.github
|
||||||
postgres-replica-stuff
|
postgres-replica-stuff
|
||||||
README.md
|
README.md
|
||||||
|
|
||||||
|
# Startup files
|
||||||
startDocker.sh
|
startDocker.sh
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,5 +1,7 @@
|
|||||||
.env
|
.env
|
||||||
|
# Yarn stuff
|
||||||
.yarn
|
.yarn
|
||||||
|
# TypeScript stuff
|
||||||
dist
|
dist
|
||||||
src/private
|
src/private
|
||||||
src/*.json
|
src/*.json
|
||||||
|
11
postgres-replica-stuff/configs/postgres-hba.conf
Normal file
11
postgres-replica-stuff/configs/postgres-hba.conf
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# TYPE DATABASE USER ADDRESS METHOD
|
||||||
|
# "local" is for Unix domain socket connections only
|
||||||
|
local all all trust
|
||||||
|
# IPv4 local connections:
|
||||||
|
host all all 127.0.0.1/32 trust
|
||||||
|
# Allow replication connections from localhost, by a user with the
|
||||||
|
# replication privilege.
|
||||||
|
local replication all trust
|
||||||
|
host replication replicator 0.0.0.0/0 trust
|
||||||
|
|
||||||
|
host all all all scram-sha-256
|
23
postgres-replica-stuff/configs/postgres.conf
Normal file
23
postgres-replica-stuff/configs/postgres.conf
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
listen_addresses = '*'
|
||||||
|
|
||||||
|
max_connections = 128
|
||||||
|
shared_buffers = 256MB
|
||||||
|
effective_cache_size = 4GB
|
||||||
|
maintenance_work_mem = 128MB
|
||||||
|
work_mem = 8MB
|
||||||
|
checkpoint_completion_target = 0.9
|
||||||
|
wal_buffers = 16MB
|
||||||
|
default_statistics_target = 100
|
||||||
|
random_page_cost = 2.5
|
||||||
|
effective_io_concurrency = 1
|
||||||
|
min_wal_size = 64MB
|
||||||
|
max_wal_size = 2GB
|
||||||
|
max_worker_processes = 6
|
||||||
|
max_parallel_workers_per_gather = 4
|
||||||
|
|
||||||
|
# Standby replication setup
|
||||||
|
wal_level = replica
|
||||||
|
max_wal_senders = 12
|
||||||
|
max_replication_slots = 12
|
||||||
|
hot_standby = on
|
||||||
|
hot_standby_feedback = on
|
21
postgres-replica-stuff/docker-compose.yml
Normal file
21
postgres-replica-stuff/docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# This is for the Slave node, Master node is in the root directory of the same file.
|
||||||
|
services:
|
||||||
|
cache-slave:
|
||||||
|
container_name: redis-cache-slave
|
||||||
|
image: redis/redis-stack-server:7.2.0-v6
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 6379:6379/tcp
|
||||||
|
db-slave:
|
||||||
|
container_name: postgres-slave
|
||||||
|
image: postgres:16.2-alpine3.19
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- 5432:5432/tcp
|
||||||
|
volumes:
|
||||||
|
- /var/lib/docker/volumes/daggerbot-db:/var/lib/postgresql/data:rw
|
||||||
|
- ./configs/postgres-hba.conf:/var/lib/postgresql/data/pg_hba.conf:rw
|
||||||
|
- ./configs/postgres.conf:/var/lib/postgresql/data/postgresql.conf:rw
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
||||||
|
POSTGRES_DB: ${POSTGRES_DB}
|
8
postgres-replica-stuff/postgres-setup-replica.sql
Normal file
8
postgres-replica-stuff/postgres-setup-replica.sql
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
-- This is for the slave.
|
||||||
|
CREATE USER replicator WITH REPLICATION ENCRYPTED PASSWORD '<password_here>';
|
||||||
|
|
||||||
|
-- This is for the master.
|
||||||
|
SELECT * FROM pg_create_physical_replication_slot('replication_slot_slave');
|
||||||
|
SELECT * FROM pg_replication_slots;
|
||||||
|
|
||||||
|
-- https://medium.com/swlh/postgresql-replication-with-docker-c6a904becf77
|
@ -33,7 +33,7 @@ setInterval(async()=>{
|
|||||||
for await (const thread of forum.threads.cache.values()) {
|
for await (const thread of forum.threads.cache.values()) {
|
||||||
await thread.messages.fetch();
|
await thread.messages.fetch();
|
||||||
if (!thread.archived && thread.lastMessage.createdTimestamp <= Date.now() - 1555200000) {// check if thread is inactive for over 18 days
|
if (!thread.archived && thread.lastMessage.createdTimestamp <= Date.now() - 1555200000) {// check if thread is inactive for over 18 days
|
||||||
await thread.delete();
|
await thread.delete('Thread has been inactive for 18 days');
|
||||||
Logger.console('log', 'ThreadTimer', `"#${thread.name}" has been deleted due to inactivity for 18 days`);
|
Logger.console('log', 'ThreadTimer', `"#${thread.name}" has been deleted due to inactivity for 18 days`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user