update testing hosts

This commit is contained in:
Andras Bacsai 2023-05-15 15:13:34 +02:00
parent bdd4a24567
commit 43a4b1c9cb
11 changed files with 18 additions and 113 deletions

View File

@ -19,4 +19,4 @@ yarn-error.log
/.vscode
/.npm
/.bash_history
/_volumes
/_data

2
.gitignore vendored
View File

@ -19,7 +19,7 @@ yarn-error.log
/.vscode
/.npm
/.bash_history
/_volumes
/_data
# Temp while developing Proxy deployment
resources/recipes

View File

@ -1,2 +0,0 @@
*
!.gitignore

View File

@ -11,7 +11,6 @@
class InstallProxy
{
public Collection $networks;
public function __invoke(Server $server): Activity
{
@ -21,9 +20,9 @@ public function __invoke(Server $server): Activity
return $docker['network'];
})->unique();
if ($networks->count() === 0) {
$this->networks = collect(['coolify']);
$networks = collect(['coolify']);
}
$create_networks_command = $this->networks->map(function ($network) {
$create_networks_command = $networks->map(function ($network) {
return "docker network ls --format '{{.Name}}' | grep '^$network$' >/dev/null 2>&1 || docker network create --attachable $network > /dev/null 2>&1";
});

View File

@ -36,14 +36,14 @@ services:
POSTGRES_DB: "${DB_DATABASE}"
POSTGRES_HOST_AUTH_METHOD: "trust"
volumes:
- ./_volumes/database/:/var/lib/postgresql/data
- ./_data/_volumes/database/:/var/lib/postgresql/data
redis:
ports:
- "${FORWARD_REDIS_PORT:-6379}:6379"
env_file:
- .env
volumes:
- ./_volumes/redis/:/data
- ./_data/_volumes/redis/:/data
vite:
image: node:19
working_dir: /var/www/html
@ -57,9 +57,10 @@ services:
container_name: coolify-testing-host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "./_data/coolify/proxy/testing-host-1:/data/coolify/proxy"
testing-host-2:
<<: *testing-host-base
container_name: coolify-testing-host-2
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- "./_testing_hosts/host_2_proxy:/root/projects/proxy"
- "./_data/coolify/proxy/testing-host-2:/data/coolify/proxy"

View File

@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM alpine:3.17
ARG TARGETPLATFORM
# https://download.docker.com/linux/static/stable/
@ -12,22 +12,10 @@ ARG PACK_VERSION=0.29.0
# https://github.com/railwayapp/nixpacks/releases
ARG NIXPACKS_VERSION=1.6.1
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git git-lfs supervisor \
sqlite3 libcap2-bin libpng-dev python2 dnsutils openssh-server sudo \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Setup sshd
RUN ssh-keygen -A
RUN mkdir -p /run/sshd
USER root
WORKDIR /root
RUN apk add --no-cache bash curl git git-lfs openssh-client openssh-server tar tini
RUN mkdir -p ~/.docker/cli-plugins
RUN if [[ ${TARGETPLATFORM} == 'linux/amd64' ]]; then \
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 && \
curl -sSL https://github.com/docker/compose/releases/download/v${DOCKER_COMPOSE_VERSION}/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose && \
@ -36,35 +24,14 @@ RUN if [[ ${TARGETPLATFORM} == 'linux/amd64' ]]; then \
curl -sSL https://nixpacks.com/install.sh | bash && \
chmod +x ~/.docker/cli-plugins/docker-compose /usr/bin/docker /usr/local/bin/pack /root/.docker/cli-plugins/docker-buildx \
;fi
RUN groupadd docker
# Setup coolify user
RUN useradd -ms /bin/bash coolify
RUN usermod -aG sudo coolify
RUN usermod -aG docker coolify
RUN echo 'coolify ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# Setup ssh'ing into the destination as Coolify User
USER coolify
RUN mkdir -p ~/.ssh
RUN echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuGmoeGq/pojrsyP1pszcNVuZx9iFkCELtxrh31QJ68 coolify@coolify-instance" >> ~/.ssh/authorized_keys
USER root
# Setup ssh'ing into the destination as Root
# Setup sshd
RUN ssh-keygen -A
RUN mkdir -p /run/sshd
RUN mkdir -p ~/.ssh
RUN echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFuGmoeGq/pojrsyP1pszcNVuZx9iFkCELtxrh31QJ68 coolify@coolify-instance" >> ~/.ssh/authorized_keys
EXPOSE 22
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["/usr/sbin/sshd", "-D", "-o", "ListenAddress=0.0.0.0"]
COPY start-container /usr/local/bin/start-container
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod +x /usr/local/bin/start-container
WORKDIR /root
# Prepare projects
RUN mkdir -p projects
COPY dummy-project projects/dummy-project
ENTRYPOINT ["start-container"]

View File

@ -1,31 +0,0 @@
FROM ubuntu:22.04
ARG WWWGROUP
WORKDIR /var/www/html
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=UTC
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update \
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git git-lfs supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils \
&& curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /usr/share/keyrings/ppa_ondrej_php.gpg > /dev/null \
&& echo "deb [signed-by=/usr/share/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
&& apt-get update \
&& apt-get install -y php8.2-cli php8.2-dev \
php8.2-curl php8.2-mbstring php8.2-xml php8.2-zip php8.2-bcmath \
php8.2-intl php8.2-readline php8.2-msgpack php8.2-igbinary \
&& php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
&& apt-get -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.2
EXPOSE 8000
COPY . .
ENTRYPOINT ["php", "-S", "0.0.0.0:8000"]

View File

@ -1,10 +0,0 @@
version: "3"
services:
dummy-project:
image: dummy-project
build:
context: .
dockerfile: Dockerfile
extra_hosts:
- "host.docker.internal:host-gateway"

View File

@ -1,3 +0,0 @@
<?php
echo "Hello World! " . date('Y-m-d H:i:s');

View File

@ -1,3 +0,0 @@
#!/usr/bin/env bash
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf

View File

@ -1,13 +0,0 @@
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
[program:sshd]
command=/usr/sbin/sshd -D
user=root
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0