DOCKER
installer et lancer docker
curl -sSL https://get.docker.com/ | sh sudo dockerd
setup mysql container
docker pull mysql:5.5 docker run --name mysql -e MYSQL_ROOT_PASSWORD=mysql -d mysql:5.5 docker exec -it mysql mysql -u root -p CREATE database foodsoftdb; CREATE user 'foodsoft'; GRANT ALL ON `foodsoftdb`.* TO foodsoft; FLUSH PRIVILEGES; docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql
setup redis container
docker pull redis:3.2 docker run --name redis redis:3.2 docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis
setup foodsoft container
d'abord éditer localement app_config.yml et l'envoyer sur le serveur
scp app_config.yml root@host.net:/var/www
puis lancer les containers propres à foodsoft
docker pull foodcoops/foodsoft:4.6.0
docker run --name foodsoft_web -p 3000 -e SECRET_KEY_BASE='mYunBreAkaBleKEY15476147654145' -e DATABASE_URL='mysql2://root:mysql@172.17.0.2/foodsoftdb?encoding=utf8' -e REDIS_URL='redis://172.17.0.4:6379' -e RAILS_FORCE_SSL=false -v /var/www/app_config.yml:/usr/src/app/config/app_config.yml:ro foodcoops/foodsoft:4.6.0
docker run --name foodsoft_setup --rm -e SECRET_KEY_BASE='mYunBreAkaBleKEY15476147654145' -e DATABASE_URL='mysql2://root:mysql@172.17.0.2/foodsoftdb?encoding=utf8' -e REDIS_URL='redis://172.20.0.4:6379' -v /var/www/app_config.yml:/usr/src/app/config/app_config.yml:ro foodcoops/foodsoft:4.6.0 bundle exec rake db:setup
docker run --name foodsoft_worker -e SECRET_KEY_BASE='mYunBreAkaBleKEY15476147654145' -e DATABASE_URL='mysql2://root:mysql@172.17.0.2/foodsoftdb?encoding=utf8' -e REDIS_URL='redis://172.17.0.4:6379' -v /var/www/app_config.yml:/usr/src/app/config/app_config.yml:ro foodcoops/foodsoft:4.6.0 ./proc-start worker
Commandes utiles
stopper puis supprimer tous les containers
docker stop $(docker ps -a -q) docker rm $(docker ps -a -q)
supprimer toutes les images téléchargées
docker rmi $(docker images -q) docker rmi $(docker images -q) --force
Docker-compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
MEMO
https://github.com/foodcoop-adam/foodsoft/wiki/Deployment-%28Debian%29
- installation de Ruby on Rails
Installer rvm
$apt-get sintall gpgv2 $curl -L get.rvm.io | bash -s stable
Ajouter son utilisateur au groupe rvm
$sudo usermod -a -G rvm toto
Set the rvm path
$source $HOME/.rvm/scripts/rvm
You should add this to the .bashrc file. Fetch the latest rvm and reload it
$echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc $rvm get head && rvm reload
Installer ruby avec rvm
$rvm list known $rvm install ruby-2.4.2
Get the rails gem
$gem install rails
Check if you have rails
$rails -v Rails 5.2.1