/docker-env

WIP - Development environment based on Docker - 2017 🔥

Primary LanguageShell

Docker environment

Basic Elements

1. Check server informations about users and access
2. Install Docker and Docker-compose
3. Install Git
  • sudo apt-get install git
4. Install Letsencrypt
5. Docker-env
6. If it is necessary Create network manually
  • docker network create men_default

Docker-env Architecture

LAMP
  • service-apache
  • service-mariadb
  • service-pma (PhpMyAdmin)
MEN
  • service-node
  • service-mongo
  • service-mongo-webadmin (Webtool for MongoDB)
Create or set subfolder for building
  • ./apache-php7/var/www/html
  • ./apache-php7/sites-enabled
  • ./apache-php7/fail2ban/jail.local
  • ./apache-php7/iptables/firewall.sh
  • ./apache-php7/letsencrypt/ssl-renewal.sh
  • ./mariadb/shared
Set .env (default)
  • DEV_PROJECT_PATH=./apache-php7/var/www/html
  • DEV_VHOST_PATH=./apache-php7/sites-enabled
  • MYSQL_DATA_PATH=./mariadb/shared
  • MYSQL_ROOT_PASSWORD=XXX
  • LETSENCRYPT_PATH=/etc/letsencrypt
  • LETSENCRYPT_LIB=/var/lib/letsencrypt

Quick installation

1. Use Docker:

Start
docker-compose build
docker-compose up -d
docker-compose restart
Restart
docker-compose down
docker-compose restart
Manage
docker images
docker ps

2. Create a project clone

3. If is Node.js, start your project

docker exec -i service-node bash
pm2 start projectpath

4. Generate letsencrypt files in local

sudo /opt/letsencrypt/letsencrypt-auto --apache -d mondomaine.fr

5. Set Vhost

More informations

Auto renew for letsencrypt certificats

Crontab based on ssl-renewal.sh, is he defined to exec

sudo crontab -e 0 0 1 * 1 /usr/local/sbin/ssl-renewal mondomaine.fr --post-hook "service apache2 restart" >> ~/var/log/ssl-renewal.log

Start/Restart Apache

docker exec -i service-apache bash
service apache2 restart

Add an ssh authorized key

ssh-copy-id -i ~/.ssh/id_rsa.pub $utilisateur_distant@$hôte_distant

Autodeploy next project release with Capistrano

cap production:deploy