We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
Docker container as web backend.
Docker container as web backend.
I'm create proxy template that build and run docker container and setup it as web backend for nginx. So i'm interesting if someone trying some similar?
In my case i use it for build and configure some specific php environment. Default user doc_root attached to container as a volume. And host installed mysql server connected to container via socket volume.
/usr/local/vesta/data/templates/web/nginx/docker.sh
/usr/local/vesta/data/templates/web/nginx/docker.tpl
In my case i use it for build and configure some specific php environment. Default user doc_root attached to container as a volume. And host installed mysql server connected to container via socket volume.
/usr/local/vesta/data/templates/web/nginx/docker.sh
SpoilerShow
Code: Select all
#!/bin/bash
# Changing public_html permission
user="$1"
domain="$2"
ip="$3"
home_dir="/home/$user"
docroot="$4"
port_prefix="3"
userid=`id -u $user`
port="$port_prefix$userid"
#chmod 755 $docroot
mkdir -p $home_dir/docker/log
cp -R -a /usr/local/vesta/data/templates/web/skel/docker/* $home_dir/docker
echo "/usr/local/vesta/data/templates/web/nginx/docker/default.sh was running with user $user and $home_dir and doc_root $docroot" > $home_dir/docker.flag
sed -i "s/11080/$port/" $home_dir/conf/web/nginx.conf
echo "version: '2'
services:
apache:
build: ./apache
ports:
- $port:80
volumes:
- $docroot:/var/www/html
- ./apache/date-timezone.conf:/etc/apache2/conf-enabled/date-timezone.conf
- ./apache/encoding.conf:/etc/apache2/conf-enabled/encoding.conf
- ./apache/php.ini:/usr/local/etc/php/php.ini
- ./log:/var/log/apache2
- /var/run/mysqld/mysqld.sock:/var/run/mysqld/mysqld.sock
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
stack: -1
environment:
- 'TZ=Asia/Vladivostok'
" > $home_dir/docker/docker-compose.yml
cd $home_dir/docker/
docker-compose -p $user down > $home_dir/docker/log/docker-compose_down.log
docker-compose -p $user up -d > $home_dir/docker/log/docker-compose_up.log
exit 0
SpoilerShow
Code: Select all
server {
listen %ip%:%proxy_port%;
server_name %domain_idn% %alias_idn%;
root %docroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
location / {
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
expires max;
}
proxy_pass http://localhost:11080;
}
error_page 403 /error/404.html;
error_page 404 /error/404.html;
error_page 500 502 503 504 /error/50x.html;
location /error/ {
alias %home%/%user%/web/%domain%/document_errors/;
}
location ~* "/\.(htaccess|htpasswd)$" {
deny all;
return 404;
}
include /etc/nginx/conf.d/phpmyadmin.inc*;
include /etc/nginx/conf.d/phppgadmin.inc*;
include /etc/nginx/conf.d/webmail.inc*;
include %home%/%user%/conf/web/nginx.%domain%.conf*;
}
-
- Posts: 1
- Joined: Fri Nov 18, 2016 1:18 pm
Re: Docker container as web backend.
Hi, did you take this into a production server? How is it going? Have you got any updated configs / code?
I am currently looking to do exactly the same. Have not started yet, still reading docker guides and getting my head around the best way to handle the persistent data volumes. Was thinking of rsyncing the vesta domain web folder with each docker volume web folder.
Also considering extending the add domain command to generate a docker, and set the configs and data volumes. So in principle you can setup a dockerised domain from the vesta front end. Could then add a few triggers to the vesta frontend to manage the container: reboot, reimage.
Happy wednesday
I am currently looking to do exactly the same. Have not started yet, still reading docker guides and getting my head around the best way to handle the persistent data volumes. Was thinking of rsyncing the vesta domain web folder with each docker volume web folder.
Also considering extending the add domain command to generate a docker, and set the configs and data volumes. So in principle you can setup a dockerised domain from the vesta front end. Could then add a few triggers to the vesta frontend to manage the container: reboot, reimage.
Happy wednesday
Re: Docker container as web backend.
Unlike the op, I implemented full docker for vestacp here: https://hub.docker.com/r/niiknow/vestacp/
Since it's a monolithic image, it does defeat the purpose of docker/microservice design. Of course, it was for a different purpose. I just want to host with VESTA but didn't want to blow away or mess up my external VPS setup. I currently run several of these in Production.
Since it's a monolithic image, it does defeat the purpose of docker/microservice design. Of course, it was for a different purpose. I just want to host with VESTA but didn't want to blow away or mess up my external VPS setup. I currently run several of these in Production.
Re: Docker container as web backend.
Hi ij3net, pottsonian, noogen, and others with the same interest of us;
Yes I'm new on this forum but, use VestaCP since over a year, contribute a little bit, love bash and docker...
I also works with docker through Libre.sh, Cloudron and my own project.
I already have basic scripts to install Docker and docker-compose on systemd system like Debian8-9, CentOS7 and Ubuntu 16LTS.
So my point is to see if someone want to work with me on integrating Docker in VestaCP for production ?
Nothing crazy at the beginning we could choose to work with only one OS and using portainer to have a WebUI (it's an example).
So Let's me know if you have an interest.
Regards!
Jonathan
PS: I also speak french if the person is more comfortable in this language.
Yes I'm new on this forum but, use VestaCP since over a year, contribute a little bit, love bash and docker...
I also works with docker through Libre.sh, Cloudron and my own project.
I already have basic scripts to install Docker and docker-compose on systemd system like Debian8-9, CentOS7 and Ubuntu 16LTS.
So my point is to see if someone want to work with me on integrating Docker in VestaCP for production ?
Nothing crazy at the beginning we could choose to work with only one OS and using portainer to have a WebUI (it's an example).
So Let's me know if you have an interest.
Regards!
Jonathan
PS: I also speak french if the person is more comfortable in this language.