Skip to content

Commit

Permalink
Merge pull request #420 from aurell/417_Konfiguracja_dockera
Browse files Browse the repository at this point in the history
417 konfiguracja dockera
  • Loading branch information
adam-boduch committed Jun 9, 2018
2 parents 00be0e6 + d8c3458 commit 56ee1d5
Show file tree
Hide file tree
Showing 12 changed files with 347 additions and 53 deletions.
36 changes: 36 additions & 0 deletions .env.docker
@@ -0,0 +1,36 @@
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomString

DB_HOST=db
DB_DATABASE=coyote
DB_USERNAME=postgres
DB_PASSWORD=

MONGO_HOST=mongodb
MONGO_DATABASE=coyote
MONGO_USERNAME=
MONGO_PASSWORD=

ELASTICSEARCH_HOST=elasticsearch

REDIS_HOST=redis

CACHE_DRIVER=redis
QUEUE_DRIVER=sync

VENDOR_NAME="Adam Boduch"
VENDOR_VAT_ID="PL8942780717"
VENDOR_ADDRESS="ul. Wojanowska 66/7"
VENDOR_POSTAL_CODE="54-050"
VENDOR_CITY="Wrocław"

PAYLANE_USERNAME=test-api-adamboduch
PAYLANE_PASSWORD=ta9hu8ti

MAIL_DRIVER=smtp
MAIL_HOST=smtp
MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -62,3 +62,7 @@ tests/_output/*
tests/acceptance.suite.yml

app/Plugins/*

.vagrant
.data
Vagrantfile
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -17,7 +17,7 @@ addons:
postgresql: "9.4"
apt:
packages:
- oracle-java8-set-default
- oracle-java9-set-default

env:
- NODE_RELEASE=6.x
Expand Down
23 changes: 21 additions & 2 deletions README.md
Expand Up @@ -62,13 +62,32 @@ Działanie projektu wymaga zainstalowania serwera HTTP takiego jak Apache czy Ng

## Vagrant

### Instalacja Docker

W folderze projektu wykonujemy następujące polecenia:
1. `cp .env.docker .env`
2. `cp Vagrantfile.docker Vagrantfile`

3. `vagrant up`
4. `vagrant ssh`
5. `cd /vagrant`

6. `sudo docker-compose build`
7. `sudo docker-compose up -d`
8. `sudo docker-compose exec php make install-dev`
9. `sudo docker-compose exec php php artisan key:generate`
10. `sudo docker-compose exec php php artisan es:create`
11. `sudo docker-compose exec php php artisan es:mapping`

Strona jest dostępna w przeglądarce pod adresem: `175.0.0.10:8880`

### Instalacja Puppet

Aby nie instalować wszystkich pakietów lokalnie, można skorzystać z Vagranta. Obecna wersja nie umożliwia jeszcze całkowitej instalacji z wnętrza Vagranta (jeśli wiesz, jak sprawić, by `npm install` i `gulp` działało na Vagrancie pod systemem Windows, daj znać), więc wymagane są następujące narzędzia zainstalowane lokalnie:
* Vagrant
* npm
* gulp (instalowane przez `npm install -g gulp`)

### Instalacja

1. vagrant up
2. npm install
3. gulp
Expand Down
100 changes: 52 additions & 48 deletions Vagrantfile
@@ -1,52 +1,56 @@
# Vagrant file specific for version 2
Vagrant.configure("2") do |config|

config.vm.box = "bento/ubuntu-16.10"
config.vm.hostname = "coyote.dev"
config.vm.network :private_network, ip: "192.168.10.10"
#nginx
config.vm.network :forwarded_port, guest: 80, host: 8080
#postgresql
config.vm.network :forwarded_port, guest: 5432, host: 5433
config.ssh.forward_agent = true

# Specify folder which you would like to have available in your box
#config.vm.synced_folder ".", "/vagrant"

# In case speed is lacking, try the NFS option
config.vm.synced_folder ".", "/vagrant", :nfs => true

# Specific configuration options for Virtualbox
config.vm.provider "virtualbox" do |v|
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Show gui instead of default, which is headless
v.gui = false
MACHINE_IP = "175.0.0.10"
PROJECT_LOCATION = "/gc"

# Use modern chipset
v.customize ["modifyvm", :id, "--chipset", "ich9"]
module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
end

# Increase default memory size
v.customize ["modifyvm", :id, "--memory", 1024]
raise "Only for windows. (Docker-toolbox setup)" unless OS.windows?

# Dual core
v.customize ["modifyvm", :id, "--cpus", 2]

#prevent npm issues
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant", "1"]
end

# Install puppet
config.vm.provision "shell", path: "puppet/env/dev/manifests/install-puppet.sh"

# Start puppet
config.vm.provision :puppet do |puppet|
puppet.environment = "dev"
puppet.environment_path = "puppet/env"
puppet.manifests_path = 'puppet/env/dev/manifests'
puppet.manifest_file = 'init.pp'
puppet.module_path = 'puppet/env/dev/modules'
end

# Install Coyote
config.vm.provision "shell", path: "puppet/env/dev/manifests/after-puppet.sh"
end
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: MACHINE_IP
config.ssh.forward_agent = true

if OS.windows?
config.vm.synced_folder "./", PROJECT_LOCATION, type: "nfs"
else
config.vm.synced_folder "./", PROJECT_LOCATION,
mount_options: ["noatime,intr,nordirplus,nolock,async,noacl,fsc,tcp"],
type: "nfs"
end

config.vm.boot_timeout = 9000

config.vm.provider "virtualbox" do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end

config.vm.provision "shell", env: {"PROJECT_LOCATION" => PROJECT_LOCATION}, inline: <<-SHELL
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y docker-ce
sudo curl -sL https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
curl -sL https://github.com/docker/machine/releases/download/v0.12.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine
chmod +x /tmp/docker-machine
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> /home/ubuntu/.bashrc
echo "cd ${PROJECT_LOCATION}" >> /home/ubuntu/.bashrc
cd ${PROJECT_LOCATION}
SHELL
end
56 changes: 56 additions & 0 deletions Vagrantfile.docker
@@ -0,0 +1,56 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :

MACHINE_IP = "175.0.0.10"
PROJECT_LOCATION = "/gc"

module OS
def OS.windows?
(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
end
end

raise "Only for windows. (Docker-toolbox setup)" unless OS.windows?

Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.network "private_network", ip: MACHINE_IP
config.ssh.forward_agent = true

if OS.windows?
config.vm.synced_folder "./", PROJECT_LOCATION, type: "nfs"
else
config.vm.synced_folder "./", PROJECT_LOCATION,
mount_options: ["noatime,intr,nordirplus,nolock,async,noacl,fsc,tcp"],
type: "nfs"
end

config.vm.boot_timeout = 9000

config.vm.provider "virtualbox" do |vb|
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end

config.vm.provision "shell", env: {"PROJECT_LOCATION" => PROJECT_LOCATION}, inline: <<-SHELL
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y docker-ce
sudo curl -sL https://github.com/docker/compose/releases/download/1.16.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
curl -sL https://github.com/docker/machine/releases/download/v0.12.2/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine
chmod +x /tmp/docker-machine
sudo cp /tmp/docker-machine /usr/local/bin/docker-machine
echo "PS1='\${debian_chroot:+(\$debian_chroot)}\\[\\033[01;32m\\]\\u@\\h\\[\\033[00m\\]:\\[\\033[01;34m\\]\\w\\[\\033[00m\\]\\$ '" >> /home/ubuntu/.bashrc
echo "cd ${PROJECT_LOCATION}" >> /home/ubuntu/.bashrc
cd ${PROJECT_LOCATION}
SHELL
end
52 changes: 52 additions & 0 deletions Vagrantfile.puppet
@@ -0,0 +1,52 @@
# Vagrant file specific for version 2
Vagrant.configure("2") do |config|

config.vm.box = "bento/ubuntu-16.10"
config.vm.hostname = "coyote.dev"
config.vm.network :private_network, ip: "192.168.10.10"
#nginx
config.vm.network :forwarded_port, guest: 80, host: 8080
#postgresql
config.vm.network :forwarded_port, guest: 5432, host: 5433
config.ssh.forward_agent = true

# Specify folder which you would like to have available in your box
#config.vm.synced_folder ".", "/vagrant"

# In case speed is lacking, try the NFS option
config.vm.synced_folder ".", "/vagrant", :nfs => true

# Specific configuration options for Virtualbox
config.vm.provider "virtualbox" do |v|

# Show gui instead of default, which is headless
v.gui = false

# Use modern chipset
v.customize ["modifyvm", :id, "--chipset", "ich9"]

# Increase default memory size
v.customize ["modifyvm", :id, "--memory", 1024]

# Dual core
v.customize ["modifyvm", :id, "--cpus", 2]

#prevent npm issues
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate//vagrant", "1"]
end

# Install puppet
config.vm.provision "shell", path: "puppet/env/dev/manifests/install-puppet.sh"

# Start puppet
config.vm.provision :puppet do |puppet|
puppet.environment = "dev"
puppet.environment_path = "puppet/env"
puppet.manifests_path = 'puppet/env/dev/manifests'
puppet.manifest_file = 'init.pp'
puppet.module_path = 'puppet/env/dev/modules'
end

# Install Coyote
config.vm.provision "shell", path: "puppet/env/dev/manifests/after-puppet.sh"
end
2 changes: 1 addition & 1 deletion config/database.php
Expand Up @@ -100,7 +100,7 @@

'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'host' => env('REDIS_HOST', 'localhost'),
'port' => 6379,
'database' => 0,
],
Expand Down
2 changes: 1 addition & 1 deletion config/elasticsearch.php
Expand Up @@ -11,7 +11,7 @@
|
| http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html
*/
'hosts' => ['localhost:9200'],
'hosts' => [ env('ELASTICSEARCH_HOST', 'localhost:9200')],

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 56ee1d5

Please sign in to comment.