This commit is contained in:
Andras Bacsai 2023-09-05 15:43:56 +02:00
parent 1338e68b8c
commit a4b44bacc1
6 changed files with 32 additions and 9 deletions

View File

@ -65,7 +65,7 @@ public function __invoke(Server $server, StandalonePostgresql $database)
], ],
'networks' => [ 'networks' => [
$this->database->destination->network => [ $this->database->destination->network => [
'external' => false, 'external' => true,
'name' => $this->database->destination->network, 'name' => $this->database->destination->network,
'attachable' => true, 'attachable' => true,
] ]

View File

@ -10,8 +10,14 @@ class InstallDocker
{ {
public function __invoke(Server $server, Team $team) public function __invoke(Server $server, Team $team)
{ {
$dockerVersion = '23.0'; $dockerVersion = '24.0';
$config = base64_encode('{ "live-restore": true }'); $config = base64_encode('{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
}
}');
if (isDev()) { if (isDev()) {
$activity = remote_process([ $activity = remote_process([
"echo ####### Installing Prerequisites...", "echo ####### Installing Prerequisites...",

View File

@ -77,7 +77,7 @@ public function handle(): void
$ip = Str::slug($this->server->ip); $ip = Str::slug($this->server->ip);
$this->backup_dir = backup_dir() . "/coolify" . "/coolify-db-$ip"; $this->backup_dir = backup_dir() . "/coolify" . "/coolify-db-$ip";
} }
$this->backup_file = "/dumpall-" . Carbon::now()->timestamp . ".sql"; $this->backup_file = "/dumpall-" . Carbon::now()->timestamp . ".dump";
$this->backup_location = $this->backup_dir . $this->backup_file; $this->backup_location = $this->backup_dir . $this->backup_file;
$this->backup_log = ScheduledDatabaseBackupExecution::create([ $this->backup_log = ScheduledDatabaseBackupExecution::create([
@ -107,7 +107,7 @@ private function backup_standalone_postgresql(): void
try { try {
ray($this->backup_dir); ray($this->backup_dir);
$commands[] = "mkdir -p " . $this->backup_dir; $commands[] = "mkdir -p " . $this->backup_dir;
$commands[] = "docker exec $this->container_name pg_dumpall -U {$this->database->postgres_user} > $this->backup_location"; $commands[] = "docker exec $this->container_name pg_dump -Fc -U {$this->database->postgres_user} > $this->backup_location";
$this->backup_output = instant_remote_process($commands, $this->server); $this->backup_output = instant_remote_process($commands, $this->server);

View File

@ -1,11 +1,28 @@
FROM debian:12-slim FROM debian:12-slim
ARG TARGETPLATFORM
# https://download.docker.com/linux/static/stable/
ARG DOCKER_VERSION=24.0.5
# https://github.com/docker/compose/releases
ARG DOCKER_COMPOSE_VERSION=2.21.0
# https://github.com/docker/buildx/releases
ARG DOCKER_BUILDX_VERSION=0.11.2
# https://github.com/buildpacks/pack/releases
ARG PACK_VERSION=0.30.0
# https://github.com/railwayapp/nixpacks/releases
ARG NIXPACKS_VERSION=1.13.0
USER root USER root
WORKDIR /root WORKDIR /root
ENV PATH "$PATH:/host/usr/local/sbin:/host/usr/local/bin:/host/usr/sbin:/host/usr/bin:/host/sbin:/host/bin" ENV PATH "$PATH:/host/usr/local/sbin:/host/usr/local/bin:/host/usr/sbin:/host/usr/bin:/host/sbin:/host/bin"
RUN apt update && apt -y install openssh-client openssh-server curl wget git jq jc RUN apt update && apt -y install openssh-client openssh-server curl wget git jq jc
RUN mkdir -p ~/.docker/cli-plugins
RUN curl -sSL https://github.com/docker/buildx/releases/download/v${DOCKER_BUILDX_VERSION}/buildx-v${DOCKER_BUILDX_VERSION}.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx
RUN curl -sSL https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
RUN (curl -sSL https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz | tar -C /usr/bin/ --no-same-owner -xzv --strip-components=1 docker/docker)
RUN chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker /root/.docker/cli-plugins/docker-buildx
# Setup sshd # Setup sshd
RUN ssh-keygen -A RUN ssh-keygen -A

View File

@ -0,0 +1,2 @@
psql -U postgres -c "create table if not exists test (id SERIAL UNIQUE NOT NULL,article TEXT);"
psql -U postgres -c "insert into test (article) select md5(random()::text) from generate_series(1, 1000000) s(i);"

View File

@ -6,7 +6,7 @@
########### ###########
VERSION="1.0.0" VERSION="1.0.0"
DOCKER_VERSION="23.0" DOCKER_VERSION="24.0"
CDN="https://cdn.coollabs.io/coolify" CDN="https://cdn.coollabs.io/coolify"
OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"') OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"')
@ -54,7 +54,6 @@ mkdir -p /etc/docker
test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json /etc/docker/daemon.json.original-$DATE || cat >/etc/docker/daemon.json <<EOL test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json /etc/docker/daemon.json.original-$DATE || cat >/etc/docker/daemon.json <<EOL
{ {
"live-restore": true,
"log-driver": "json-file", "log-driver": "json-file",
"log-opts": { "log-opts": {
"max-size": "10m", "max-size": "10m",
@ -64,7 +63,6 @@ test -s /etc/docker/daemon.json && cp /etc/docker/daemon.json /etc/docker/daemon
EOL EOL
cat >/etc/docker/daemon.json.coolify <<EOL cat >/etc/docker/daemon.json.coolify <<EOL
{ {
"live-restore": true,
"log-driver": "json-file", "log-driver": "json-file",
"log-opts": { "log-opts": {
"max-size": "10m", "max-size": "10m",