Vagrant, Symfony, chmod permit - linux

Host: ubuntu latest x64
vagrant 1.7.2
Configuration (puphpet)
Yaml config:
vagrantfile:
target: local
vm:
box: puphpet/debian75-x64
box_url: puphpet/debian75-x64
hostname: developer
memory: '1024'
cpus: '1'
chosen_provider: virtualbox
network:
private_network: 192.168.56.2
forwarded_port:
vflnp_o959ky5yk541:
host: '8592'
guest: '22'
post_up_message: ''
provider:
virtualbox:
modifyvm:
natdnshostresolver1: on
showgui: '0'
vmware:
numvcpus: 1
parallels:
cpus: 1
provision:
puppet:
manifests_path: puphpet/puppet
manifest_file: site.pp
module_path: puphpet/puppet/modules
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
- '--parser future'
synced_folder:
vflsf_xjd88rswg95m:
source: ../Presta/www
target: /var/www/presta
sync_type: nfs
smb:
smb_host: ''
smb_username: ''
smb_password: ''
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
- .git/
auto: 'true'
# owner: www-data
# group: www-data
vflsf_htm6wvj2khq1:
source: '../Karty_Pracy/www'
target: /var/www/worksheets
sync_type: nfs
smb:
smb_host: ''
smb_username: ''
smb_password: ''
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
- .git/
auto: 'true'
# owner: www-user
# group: www-data
vfawf_htsadas3khq1:
source: '../Magazyn/www'
target: /var/www/warehouse
sync_type: nfs
smb:
smb_host: ''
smb_username: ''
smb_password: ''
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
- .git/
auto: 'true'
# owner: www-user
# group: www-data
# map_uid: 0
# map_gid: 0
usable_port_range:
start: 10200
stop: 10500
ssh:
host: null
port: null
private_key_path: null
username: vagrant
guest_port: null
keep_alive: true
forward_agent: false
forward_x11: false
shell: 'bash -l'
vagrant:
host: detect
server:
install: '1'
packages:
- htop
- zsh
- git
- mc
- unzip
- zip
- unrar
users_groups:
install: '1'
groups: { }
users: { }
firewall:
install: '1'
rules: { }
cron:
install: '1'
jobs: { }
nginx:
install: '0'
settings:
default_vhost: 1
proxy_buffer_size: 128k
proxy_buffers: '4 256k'
upstreams: { }
vhosts:
nxv_nwz3nbjvoere:
server_name: awesome.dev
server_aliases:
- www.awesome.dev
www_root: /var/www/awesome
listen_port: '80'
index_files:
- index.html
- index.htm
- index.php
client_max_body_size: 1m
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_port: '443'
ssl_protocols: ''
ssl_ciphers: ''
rewrite_to_https: '1'
spdy: '1'
locations:
nxvl_nfl6ndp0s1h1:
location: /
autoindex: off
try_files:
- $uri
- $uri/
- /index.php$is_args$args
fastcgi: ''
fastcgi_index: ''
fastcgi_split_path: ''
nxvl_oy9dxc91j6zf:
location: '~ \.php$'
autoindex: off
try_files:
- $uri
- $uri/
- /index.php$is_args$args
fastcgi: '127.0.0.1:9000'
fastcgi_index: index.php
fastcgi_split_path: '^(.+\.php)(/.*)$'
fast_cgi_params_extra:
- 'SCRIPT_FILENAME $request_filename'
- 'APP_ENV dev'
proxies: { }
apache:
install: '1'
settings:
user: www-data
group: www-data
default_vhost: true
manage_user: false
manage_group: false
sendfile: 0
modules:
- proxy_fcgi
- rewrite
vhosts:
presta:
servername: presta.dev
serveraliases:
- www.presta.dev
docroot: /var/www/presta
port: '80'
setenv:
- 'APP_ENV dev'
custom_fragment: ''
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
ssl_protocol: ''
ssl_cipher: ''
directories:
avd_hycw94gg20u6:
path: /var/www/presta
options:
- Indexes
- FollowSymlinks
- MultiViews
allow_override:
- All
require:
- 'all granted'
custom_fragment: ''
files_match:
avdfm_0yv1i2x4gd9j:
path: \.php$
sethandler: 'proxy:fcgi://127.0.0.1:9000'
custom_fragment: ''
provider: filesmatch
provider: directory
worksheets:
servername: worksheets.dev
serveraliases:
- www.worksheets.dev
docroot: /var/www/worksheets/web
port: '80'
setenv:
- APP_ENV_dev
custom_fragment: ''
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
ssl_protocol: ''
ssl_cipher: ''
directories:
avd_88fsnn8di1c5:
path: /var/www/worksheets/web
options:
- Indexes
- FollowSymlinks
- MultiViews
allow_override:
- All
require:
- 'all granted'
custom_fragment: ''
files_match:
avdfm_ro0fe2wzpcad:
path: \.php$
sethandler: 'proxy:fcgi://127.0.0.1:9000'
custom_fragment: ''
provider: filesmatch
provider: directory
warehouse:
servername: warehouse.dev
serveraliases:
- www.warehouse.dev
docroot: /var/www/warehouse/web
port: '80'
setenv:
- APP_ENV_dev
custom_fragment: ''
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
ssl_protocol: ''
ssl_cipher: ''
directories:
avd_88fsnn8diaw5:
path: /var/www/warehouse/web
options:
- Indexes
- FollowSymlinks
- MultiViews
allow_override:
- All
require:
- 'all granted'
custom_fragment: ''
files_match:
avdfm_ro0fe2wzpcad:
path: \.php$
sethandler: 'proxy:fcgi://127.0.0.1:9000'
custom_fragment: ''
provider: filesmatch
provider: directory
php:
install: '1'
settings:
version: '56'
modules:
php:
- cli
- intl
- mcrypt
- curl
- cgi
- gd
- imagick
- mysql
- mysqlnd
- sqlite
pear: { }
pecl:
- pecl_http
ini:
display_errors: On
error_reporting: '-1'
session.save_path: /var/lib/php/session
date.timezone: UTC
fpm_ini:
error_log: /var/log/php-fpm.log
fpm_pools:
phpfp_tl7whm0zxnuj:
ini:
prefix: www
listen: '127.0.0.1:9000'
security.limit_extensions: .php
user: www-user
group: www-data
composer: '1'
composer_home: ''
xdebug:
install: '1'
settings:
xdebug.default_enable: '1'
xdebug.remote_autostart: '1'
xdebug.idekey: PHPStorm
xdebug.remote_connect_back: '1'
xdebug.remote_enable: '1'
xdebug.remote_handler: dbgp
xdebug.remote_port: '9000'
blackfire:
install: '0'
settings:
server_id: ''
server_token: ''
agent:
http_proxy: ''
https_proxy: ''
log_file: stderr
log_level: '1'
php:
agent_timeout: '0.25'
log_file: ''
log_level: '1'
xhprof:
install: '0'
wpcli:
install: '0'
version: v0.19.0
drush:
install: '0'
version: 6.3.0
ruby:
install: '1'
versions: { }
python:
install: '1'
packages: { }
versions: { }
nodejs:
install: '1'
npm_packages:
- bower
hhvm:
install: '0'
nightly: 0
composer: '1'
composer_home: ''
settings: { }
server_ini:
hhvm.server.host: 127.0.0.1
hhvm.server.port: '9000'
hhvm.log.use_log_file: '1'
hhvm.log.file: /var/log/hhvm/error.log
php_ini:
display_errors: On
error_reporting: '-1'
date.timezone: UTC
mysql:
install: '1'
settings:
version: '5.6'
root_password: presta
override_options: { }
adminer: '1'
users:
mysqlnu_9vxflivbus3n:
name: presta
password: presta
mysqlnu_uvdxcu9kcnmf:
name: worksheets
password: worksheets
mysqlnu_9vxfladvbus3n:
name: warehouse
password: warehouse
databases:
mysqlnd_0eud6qyvgftl:
name: presta
sql: ''
mysqlnd_310bhtyb1ezk:
name: worksheets
sql: ''
mysqlnd_310bhaddsdasdw:
name: warehouse
sql: ''
grants:
mysqlng_er3ka00fh3xm:
user: presta
table: '*.*'
privileges:
- ALL
mysqlng_l0g86y9hymun:
user: worksheets
table: '*.*'
privileges:
- ALL
mysqlng_l0asdy9hymun:
user: warehouse
table: '*.*'
privileges:
- ALL
postgresql:
install: '0'
settings:
global:
encoding: UTF8
version: '9.3'
server:
postgres_password: '123'
databases: { }
users: { }
grants: { }
adminer: 0
mongodb:
install: '0'
settings:
auth: 1
bind_ip: 127.0.0.1
port: '27017'
databases: { }
redis:
install: '0'
settings:
conf_port: '6379'
sqlite:
install: '1'
adminer: 0
databases: { }
mailcatcher:
install: '1'
settings:
smtp_ip: 0.0.0.0
smtp_port: 1025
http_ip: 0.0.0.0
http_port: '1080'
mailcatcher_path: /usr/local/rvm/wrappers/default
from_email_method: headers
beanstalkd:
install: '0'
settings:
listenaddress: 0.0.0.0
listenport: '13000'
maxjobsize: '65535'
maxconnections: '1024'
binlogdir: /var/lib/beanstalkd/binlog
binlogfsync: null
binlogsize: '10485760'
beanstalk_console: 0
rabbitmq:
install: '0'
settings:
port: '5672'
users: { }
vhosts: { }
plugins: { }
elastic_search:
install: '0'
settings:
version: 1.4.1
java_install: true
solr:
install: '0'
settings:
version: 4.10.2
port: '8984'
Issue:
$ php app/console fos:user:change-password admin admin
[Symfony\Component\Debug\Exception\ContextErrorException] Warning:
chmod(): Operation not permitted
fos:user:change-password
On web issue expects too.
Permissions looks good:
$ ls -la
total 224
drwxrwxrwx 12 www-data www-data 4096 Jul 2 12:57 ./
drwxrwxr-x 6 root www-data 4096 Jul 3 06:39 ../
drwxrwxrwx 6 www-data www-data 4096 Jul 2 13:26 app/
drwxrwxrwx 2 www-data www-data 4096 Jun 26 10:51 bin/
-rwxrwxrwx 1 www-data www-data 362 Jul 2 12:57 bower.json*
-rwxrwxrwx 1 www-data www-data 35 Jul 2 12:57 .bowerrc*
-rwxrwxrwx 1 www-data www-data 3340 Jul 2 12:57 composer.json*
-rwxrwxrwx 1 www-data www-data 154557 Jul 2 09:50 composer.lock*
drwxrwxrwx 2 www-data www-data 4096 Jul 2 12:57 doc/
drwxrwxrwx 3 www-data www-data 4096 Jul 2 10:25 files/
drwxrwxrwx 8 www-data www-data 4096 Jul 3 06:47 .git/
-rwxrwxrwx 1 www-data www-data 164 Jul 2 12:57 .gitignore*
drwxrwxrwx 3 www-data www-data 4096 Jul 3 06:26 .idea/
drwxrwxrwx 3 www-data www-data 4096 Jul 2 12:57 src/
-rwxrwxrwx 1 www-data www-data 595 Jul 2 12:57 sync.sh*
-rwxrwxrwx 1 www-data www-data 245 Jul 2 12:57 TODO*
drwxrwxrwx 3 www-data www-data 4096 Jul 2 10:54 var/
drwxrwxrwx 37 www-data www-data 4096 Jul 2 09:59 vendor/
drwxrwxrwx 10 www-data www-data 4096 Jul 2 13:01 web/
So, this looks like bad mounting nfs(can't use chmod) How to solve this?

So, this looks like bad mounting nfs(can't use chmod) How to solve this?
You must treat the virtual box-side of a sync'ed folder as 'read-only.' Run commands which modify the contents of a sync'ed folder instead on the host computer itself (your Mac); for example, php composer.phar install. Remote OS's (virtual machines) will cause "Operation not permitted" errors when they try to change files originating on the host operating system.
For reference, see my answer to a similar question at this link:
The Operation not permitted problem...
There's another answer that discusses the importance of treating synced_folders as read-only file locations on your Virtual Machines.
How to use vagrant on multiple projects

You must run this command fos:user:change-password from /vagrant folder (not from /var/www/presta)

It might be related to this issue.
The solution is:
vagrant plugin uninstall vagrant-bindfs
vagrant reload
Hope it helps.

Related

mod-rewrite with apache 2.4 and CentOs 7 don't replace index.php in url

Have a Vagrantbox with centos 7 and apache 2.4. In /var/www/html have a Codeigniter PHP Site with pretty-url rewrite. I create the vm with puphpet config.yaml. The VM is running correct, VM-server is running correct, mode_rewrite ist activ and allowed to all, but i try a url like this:
http://codeigniter.dev/home ->file not found
http://codeigniter.dev/index.php/home -> site ok
There is no way to replace index.php, don't know why?
On my Server with Centos and apache this configrution runs perfect, but in my VM it didn't replace?!?
Here are my Configs:
puphpet/config.yaml
vagrantfile:
target: local
vm:
provider:
local:
box: puphpet/centos7-x64
box_url: puphpet/centos7-x64
box_version: '0'
chosen_virtualizer: virtualbox
virtualizers:
virtualbox:
modifyvm:
natdnshostresolver1: false
showgui: 0
vmware:
numvcpus: 1
parallels:
linked_clone: 0
check_guest_tools: 0
update_guest_tools: 0
machines:
vflm_via243h8nsof:
id: codeigniter
hostname: codeigniter.dev.local
network:
private_network: 192.168.56.101
forwarded_port:
vflmnfp_57zntu84qm8k:
host: '9583'
guest: '22'
memory: '2048'
cpus: '1'
provision:
puppet:
manifests_path: puphpet/puppet/manifests
module_path:
- puphpet/puppet/modules
- puphpet/puppet/manifests
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
synced_folder:
vflsf_f72ykqm374hd:
source: ./
target: /var/www
sync_type: default
smb:
smb_host: ''
smb_username: ''
smb_password: ''
mount_options:
dir_mode: '0775'
file_mode: '0664'
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
- .git/
auto: 'true'
owner: www-data
group: www-data
usable_port_range:
start: 10200
stop: 10500
post_up_message: ''
ssh:
host: 'false'
port: 'false'
private_key_path: 'false'
username: vagrant
guest_port: 'false'
keep_alive: '1'
forward_agent: 'false'
forward_x11: 'false'
shell: 'bash -l'
insert_key: 'false'
vagrant:
host: detect
proxy:
http: ''
https: ''
ftp: ''
no_proxy: ''
server:
install: '1'
packages: { }
users_groups:
install: '1'
groups:
- www-data
users:
- www-data
locale:
install: '1'
settings:
default_locale: de_DE.UTF-8
locales:
- en_GB.UTF-8
- en_US.UTF-8
timezone: Europe/Berlin
firewall:
install: '1'
rules: { }
cron:
install: '1'
jobs: { }
apache:
install: '1'
settings:
version: 2.4
user: www-data
group: www-data
default_vhost: true
manage_user: false
manage_group: false
sendfile: 0
modules:
- proxy_fcgi
- rewrite
vhosts:
av_myrx1sclhqnx:
servername: codeigniter.dev
serveraliases:
- www.codeigniter.dev
docroot: /var/www/html
port: '80'
setenv:
- 'APP_ENV dev'
setenvif:
- 'Authorization "(.*)" HTTP_AUTHORIZATION=$1'
custom_fragment: ''
ssl: '0'
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
ssl_protocol: ''
ssl_cipher: ''
directories:
avd_6sroj6oyuexi:
path: /var/www/html
options:
- Indexes
- FollowSymlinks
- MultiViews
allow_override:
- All
require:
- 'all granted'
custom_fragment: ''
files_match:
avdfm_o1gz78z6saqx:
path: \.php$
sethandler: 'proxy:fcgi://127.0.0.1:9000'
custom_fragment: ''
provider: filesmatch
provider: directory
letsencrypt:
install: '1'
settings:
email: admin#codeigniter.dev
domains: { }
php:
install: '1'
settings:
version: '7.1'
modules:
php:
- cli
- intl
- xml
pear: { }
pecl: { }
ini:
display_errors: 'On'
error_reporting: '-1'
session.save_path: /var/lib/php/session
date.timezone: UTC
fpm_ini:
error_log: /var/log/php-fpm.log
fpm_pools:
phpfp_jncm5era33zg:
ini:
prefix: www
listen: '127.0.0.1:9000'
security.limit_extensions: .php
user: www-user
group: www-data
composer: '1'
composer_home: ''
ruby:
install: '1'
versions:
rv_dpiw29f3bvhv:
default: '1'
bundler: '1'
version: 2.3.1
gems:
- deep_merge#1.0.1
- activesupport#4.2.6
- vine#0.2
python:
install: '1'
packages: { }
versions: { }
nodejs:
install: '1'
settings:
version: '6'
npm_packages: { }
mysql:
install: '1'
settings:
version: '5.7'
root_password: '123'
override_options: { }
adminer: 0
users:
mysqlnu_r5di0ad1ifk2:
name: dbuser
password: '123'
databases:
mysqlnd_k34jv21bgnjk:
name: codeigniter
sql: ''
grants:
mysqlng_rn6tn59qj8nf:
user: dbuser
table: '*.*'
privileges:
- ALL
.htaccess
RewriteEngine On
RewriteBase /
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
VM/ /etc/httpd/conf/httpd.conf
# Security
ServerTokens OS
ServerSignature On
TraceEnable On
ServerName "codeigniter.dev.local"
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 120
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15
LimitRequestFieldSize 8190
User www-data
Group www-data
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
HostnameLookups Off
ErrorLog "/var/log/httpd/error_log"
LogLevel warn
EnableSendfile Off
#Listen 80
Include "/etc/httpd/conf.modules.d/*.load"
Include "/etc/httpd/conf.modules.d/*.conf"
Include "/etc/httpd/conf/ports.conf"
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" forwarded
I read a lot of posting for this problem, but no solution, so i hope to get some help here.

Invalid (corrupted) package.json file after npm install in a vagrant box

I have been trying to fix a vagrant setup for a laravel project.
Context
Host: Mac
Guest: Ubuntu 16.04
versions:
$ npm --version
2.15.9
$ node --version
v4.5.0
Problem
When I run $ npm install some of the dependency packages (apparently randomly) come with invalid characters and $ gulp fails.
To be more precise, the end of the corrupted file shows some invalid characters:
$ gulp
module.js:85
throw e;
^
SyntaxError: Error parsing /vagrant/node_modules/gulp-bower/node_modules/bower/lib/node_modules/graceful-fs/package.json: Unexpected token
And if you go to the file you will see, in the pointed line, a lot of weird characters.
But, as I said, the invalid dependency package varies every time I rm -Rf node_modules and then run a $ npm install again.
For the second time, for instance, I've got this:
$gulp
module.js:85
throw e;
^
SyntaxError: Error parsing /vagrant/node_modules/gulp-bower/node_modules/bower/lib/node_modules/configstore/package.json: Unexpected token
The invalid package.json file looks like this:
{
"_args": [
[
"configstore#^2.0.0",
"/private/var/folders/22/xz6_9gpx3jggts_8j68_25g80000gn/T/tmp-51023WwSVKpwQ7KvH"
]
],
"_from": "configstore#>=2.0.0 <3.0.0",
"_id": "configstore#2.0.0",
"_inCache": true,
"_installable": true,
"_location": "/configstore",
"_nodeVersion": "4.3.0",
"_npmOperationalInternal": {
"host": "packages-5-east.internal.npmjs.com",
"tmp": "tmp/configstore-2.0.0.tgz_1456822157166_0.897884224774316"
},
"_npmUser": {
"email": "sindresorhus#gmail.com",
"name": "sindresorhus"
},
"_npmVersion": "2.14.12",
"_phantomChildren": {},
"_requested": {
"name": "configstore",
"raw": "configstore#^2.0.0",
"rawSpec": "^2.0.0",
"scope": null,
"spec": ">=2.0.0 <3.0.0",
"type": "range"
},
"_requiredBy": [
"/",
"/update-notifier"
],
"_resolved": "https://registry.npmjs.org/configstore/-/configstore-2.0.0.tgz",
"_shasum": "8d81e9cdfa73ebd0e06bc985147856b2f1c4e764",
"_shrinkwrap": null,
"_spec": "configstore#^2.0.0",
"_where": "/private/var/folders/22/xz6_9gpx3jggts_8j68_25g80000gn/T/tmp-51023WwSVKpwQ7KvH",
"author": {
"email": "sindresorhus#gmail.com",
"name": "Sindre Sorhus",
"url": "sindresorhus.com"
},
"bugs" Bp6��5�f5���Ip6���G�9Y��G�9)F[���т]�=ٞp6�1AP��1AP���#��yAP���v�nY��G�91AP���AP��ٞp6�1AP��1AP���#��yAP���v�nY��G�91AP���AP�� Bp6��G�9yAP���Ip6��>6���ys7)F[��I�Mq8�6�f5I�Mq8�Ip6� ��ys7�:�ys7)F[���6�f5Q5��~
In�f5q5��~
a��G�99Sp6�P7/
AIp6�dpackage/library/fn/array/virtual/reduce.js�iCp6��y��G�9�^�.1AP��1AP�����f5���f5Y�O{�AP��}^�.1AP��1AP�����f5Y�O{�AP���AP����f��1AP��1AP�����f5Y�O{�AP���AP����f��1AP��1AP�����f5���f5Y�O{�AP��AIp6�(db3204cd5a9de2e6cd890b85c6e2f66bcf4f620aAIp6�inflight#>=1.0.4 <2.0.0AIp6�3.9.1AIp6�5.10.1�s��'1AP��1AP��y�G�9��G�9�AP���AP��a�f��1AP��1AP�����f5���f5Y�O{�AP���f��I��O{��G�9���'1AP��1AP����G�99�G�9�AP���AP����`��1AP��1AP��Y�O{�AP���AP���AP��AIp6�8https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgzAIp6�ERROR: No README data found!/nAIp6�� has}
aMp6�Z�gu�
Mp6�45��G�91 Y�� Bp6�Y>�f5���Ip6���G�9I��G�9
If I run $ npm install from the host machine, the packages are downloaded correctly and $ gulp runs just fine.
My Configuration
I don't believe that my configuration is going to be relevant because the commands were executed after a $ vagrant ssh but, here they are:
Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "geerlingguy/ubuntu1604"
config.vm.synced_folder "../laravel", "/vagrant",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=775"]
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct: true
config.vm.network :forwarded_port, guest: 3306, host: 3306, auto_correct: true
config.vm.provision :hostmanager
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
config.vm.provider "virtualbox" do |vb|
vb.gui = false
vb.memory = "1024"
vb.cpus = "1"
vb.name = "Dev"
end
config.vm.define "dev" do |dev|
config.vm.hostname = "dev.local"
dev.vm.network :private_network, ip: '192.168.11.25'
dev.vm.provision "ansible" do |ansible|
ansible.playbook = "provisioning/playbook.yml"
end
end
end
main.yml
#Apache 2 Settings
apache_listen_port: 80
apache_create_vhosts: true
apache_remove_default_vhost: true
apache_global_vhost_settings: |
DirectoryIndex index.php index.html
apache_vhosts:
- servername: "dev.local"
documentroot: "/vagrant/public/"
serveralias: "dev.local"
#PHP Settings
php_use_managed_ini: false
php_error_reporting: "E_ALL & ~E_DEPRECATED & ~E_STRICT"
php_display_errors: "On"
php_display_startup_errors: "On"
php_packages:
- libapache2-mod-php7.0
- php7.0-mysql
- php7.0-curl
- php7.0-mcrypt
- php7.0-mbstring
- php7.0-xml
- php7.0-gd
- php7.0-common
- php7.0-cli
- php7.0-dev
- php7.0-fpm
- libpcre3-dev
- php7.0-imap
- php7.0-json
- php7.0-opcache
- php7.0-intl
- php7.0-zip
- php-sqlite3
- php-apcu
#MySQL Settings
mysql_root_password: root
mysql_root_password_update: yes
mysql_bind_address: '0.0.0.0'
# NodeJS
nodejs_version: "4.x"
#Redis Settings
redis_port: 6379
redis_bind_interface: 0.0.0.0
playbook.yml
---
- name: Dev machine setup
hosts: dev
user: vagrant
become: yes
vars_files:
- vars/main.yml
pre_tasks:
- apt: name=unzip update_cache=yes state=present
roles:
- role: geerlingguy.mysql
- role: geerlingguy.apache
- role: geerlingguy.php
- role: geerlingguy.php-mysql
- role: geerlingguy.nodejs
- role: geerlingguy.redis
- role: geerlingguy.apache-php-fpm
- role: geerlingguy.php-xdebug
- role: geerlingguy.composer
tasks:
- name: Allow root remote access
shell: >
mysql -u root -proot -NBe
"GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' IDENTIFIED BY 'root';"
- name: Ensure MySQL databases are present.
mysql_db:
name: appdb
encoding: utf8
collation: utf8_unicode_ci
# .env File Settings
- name: Copy and rename .env.example
template: src=../../laravel/.env.example dest=/vagrant/.env
- name: set DB_HOST=dev.local
lineinfile: dest=/vagrant/.env regexp='^DB_HOST=' line=DB_HOST=dev.local
- name: set DB_DATABASE=appdb
lineinfile: dest=/vagrant/.env regexp='^DB_DATABASE=' line=DB_DATABASE=appdb
- name: set DB_USERNAME=root
lineinfile: dest=/vagrant/.env regexp='^DB_USERNAME=' line=DB_USERNAME=root
- name: set DB_PASSWORD=root
lineinfile: dest=/vagrant/.env regexp='^DB_PASSWORD=' line=DB_PASSWORD=root
# Storage Settings
- file: path=/vagrant/storage/framework/sessions state=directory mode=0777
- file: path=/vagrant/storage/framework/views state=directory mode=0777
- file: path=/vagrant/storage/framework/cache state=directory mode=0777
# Composer
- composer: command=install working_dir=/vagrant/ no_dev=no
# NPM Global
- name: Install Gulp-cli globally.
npm: name=gulp-cli global=yes
- name: Install gulp globaly
npm: name=gulp global=yes
- name: Install bower globally.
npm: name=bower global=yes
# Artisan Tasks
- name: Install Migrations and Seed
command: php artisan migrate:refresh --seed
become: true
become_user: vagrant
args:
chdir: /vagrant/
- name: Generate a new app key
command: php artisan key:generate
become: true
become_user: vagrant
args:
chdir: /vagrant/
- name: Generate JS Routes
command: php artisan laroute:generate
become: true
become_user: vagrant
args:
chdir: /vagrant/
- name: Create Symbolic Link
file: src=/vagrant/storage/app/public dest=/vagrant/public/storage state=link
It turns out that it was a problem during folder syncing. I've changed to this
config.vm.synced_folder "../laravel", "/vagrant",
:nfs => true,
:linux__nfs_options => ['rw','no_subtree_check','all_squash','async']
And it started working.
Finally!

puphpet failes to install packages

I'm new to puphpet and I'm tring to deploy a machine with the following config file:
vagrantfile:
target: local
vm:
provider:
local:
box: puphpet/ubuntu1404-x64
box_url: puphpet/ubuntu1404-x64
box_version: '0'
chosen_virtualizer: virtualbox
virtualizers:
virtualbox:
modifyvm:
natdnshostresolver1: false
showgui: 0
machines:
vflm_iuacklmx1q1l:
id: roes
hostname: roes.puphpet
network:
private_network: 192.168.50.101
forwarded_port:
vflmnfp_f8witajbpcdk:
host: '80'
guest: '80'
memory: '3072'
cpus: '3'
provision:
puppet:
manifests_path: puphpet/puppet/manifests
module_path: puphpet/puppet/modules
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
synced_folder:
vflsf_c0lu72vfwayv:
source: 'C:\Users\Jelle\symfony\VrijwilligersTool'
target: /var/www/VrijwilligersTool
sync_type: default
smb:
smb_host: ''
smb_username: ''
smb_password: ''
mount_options:
dir_mode: '0775'
file_mode: '0664'
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
- .git/
auto: 'true'
owner: www-data
group: www-data
usable_port_range:
start: 10200
stop: 10500
post_up_message: ''
ssh:
host: 'false'
port: 'false'
private_key_path: 'false'
username: vagrant
guest_port: 'false'
keep_alive: '1'
forward_agent: 'false'
forward_x11: 'false'
shell: 'bash -l'
insert_key: 'false'
vagrant:
host: detect
proxy:
http: ''
https: ''
ftp: ''
no_proxy: ''
server:
install: '1'
packages: { }
users_groups:
install: '1'
groups: { }
users: { }
locale:
install: '1'
settings:
default_locale: nl_BE.UTF-8
locales:
- nl_BE.UTF-8
timezone: Europe/Brussels
firewall:
install: '1'
rules: { }
cron:
install: '1'
jobs: { }
python:
install: '1'
packages: { }
versions: { }
hhvm:
install: '1'
nightly: 0
composer: '1'
composer_home: ''
settings: { }
server_ini:
hhvm.server.host: 127.0.0.1
hhvm.server.port: '9000'
hhvm.log.use_log_file: '1'
hhvm.log.file: /var/log/hhvm/error.log
php_ini:
display_errors: 'On'
error_reporting: '-1'
date.timezone: UTC
mysql:
install: '1'
settings:
version: '5.7'
root_password: secret
override_options: { }
adminer: 0
users:
mysqlnu_rw5biplek6za:
name: homestead
password: secret
databases:
mysqlnd_osndwm6tnrw5:
name: homestead
sql: ''
grants:
mysqlng_j4jxg3loo0o1:
user: homestead
table: '*.*'
privileges:
- ALL
elastic_search:
install: '0'
settings:
version: 2.3.1
java_install: true
instances:
esi_cygoi2r38jmu:
name: es-01
When is execute vagrant up I'm getting a sea of errors.
Normally I'd go through them all but this is a very niche thing to google and I'm totally new to this. Can someone help me out and show me my mistakes?
log file: http://pastebin.com/YK65A7zR

How to configure vagrant to work with node.js

I have problem with running node.js with vagrant.
I have following structure of project:
- public
- hello.js
- vagrant
- puphpet
- Vagrantfile
Here's my puphpet config:
---
vagrantfile-local:
vm:
box: puphpet/debian75-x64
box_url: E:\vagrant boxes\debian-7.5-x86_64-v1.2-virtualbox.box
hostname: ''
memory: '1024'
cpus: '1'
chosen_provider: virtualbox
network:
private_network: 192.168.56.102
forwarded_port:
BD200PpFPN2U:
host: '3000'
guest: '3000'
post_up_message: ''
provider:
virtualbox:
modifyvm:
natdnshostresolver1: on
vmware:
numvcpus: 1
parallels:
cpus: 1
provision:
puppet:
manifests_path: puphpet/puppet
manifest_file: site.pp
module_path: puphpet/puppet/modules
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
- '--parser future'
synced_folder:
uREBTumUq032:
owner: www-data
group: www-data
source: ../
target: /var/www
sync_type: default
rsync:
args:
- '--verbose'
- '--archive'
- '-z'
exclude:
- .vagrant/
auto: 'false'
usable_port_range:
start: 10200
stop: 10500
ssh:
host: null
port: null
private_key_path: null
username: vagrant
guest_port: null
keep_alive: true
forward_agent: false
forward_x11: false
shell: 'bash -l'
vagrant:
host: detect
server:
install: '1'
packages: { }
firewall:
install: '1'
rules: null
apache:
install: '1'
settings:
user: www-data
group: www-data
default_vhost: true
manage_user: false
manage_group: false
sendfile: 0
modules:
- rewrite
vhosts:
XWIOX0y1wPTF:
servername: nodeapp.com
docroot: /var/www/public
port: '80'
setenv:
- 'APP_ENV dev'
override:
- All
options:
- Indexes
- FollowSymLinks
- MultiViews
engine: php
custom_fragment: ''
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
mod_pagespeed: 0
Here is hello.js file
var http = require('http');
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World!");
});
server.listen(3000);
I log to SSH then I go to var/www/public there is file hello.js. I run
node hello.js
I dont get any error/message.
Then I go to 192.168.56.102:3000 and after while I get:
The connection has timed out
Address 192.168.56.102 returns 404 status code, so apache is working.
I tried change host and guest in config.yaml to port 8080 but it didnt work.
Did I do something wrong?
Try removing the forwarded port to 3000 and adding that into the firewall section.

htaccess not recognized in vagrant VM / PuPHPet

I'm in the process of setting up my first puphpet / vagrant box and all is well except that I can't get my site's .htaccess to be recognized. I installed CentOS with apache2 and MySQL and I'm running a rewrite to remove .php extensions:
# Redirect to remove .php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
However I keep getting page not found errors when I browse to, for example, site.com/login but I hit the page at site.com/login.php. I read a few threads here about changing /etc/httpd/conf/httpd.conf and /etc/httpd/conf.d/10-default_vhost_80.conf to AllowOverride All, which I did, but had no luck after restarting httpd. Here's my config.yaml:
vagrantfile-local:
vm:
box: puphpet/centos65-x64
box_url: puphpet/centos65-x64
hostname: null
memory: '1024'
cpus: '1'
chosen_provider: vmware_fusion
network:
private_network: 192.168.10.200
forwarded_port: { }
provider:
virtualbox:
modifyvm:
natdnshostresolver1: on
setextradata:
VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root: 1
vmware:
numvcpus: 1
parallels:
cpus: 1
provision:
puppet:
manifests_path: puphpet/puppet
manifest_file: site.pp
module_path: puphpet/puppet/modules
options:
- '--verbose'
- '--hiera_config /vagrant/puphpet/puppet/hiera.yaml'
- '--parser future'
synced_folder:
ljjVKPIgQuXE:
source: '/Users/Sean/Documents/Websites/RE Lynx'
target: /var/www/relynx
sync_type: default
rsync:
auto: 'false'
usable_port_range:
start: 10200
stop: 10500
post_up_message: ''
ssh:
host: null
port: null
private_key_path: null
username: vagrant
guest_port: null
keep_alive: true
forward_agent: false
forward_x11: false
shell: 'bash -l'
vagrant:
host: detect
server:
install: '1'
packages: { }
firewall:
install: '1'
rules: null
apache:
install: '1'
settings:
user: www-data
group: www-data
default_vhost: true
manage_user: false
manage_group: false
sendfile: 0
modules:
- rewrite
vhosts:
asawJQkN36Oa:
servername: relynx.dev
serveraliases:
- www.relynx.dev
docroot: /var/www/relynx
port: '80'
setenv:
- 'APP_ENV dev'
override:
- All
options:
- Indexes
- FollowSymLinks
- MultiViews
engine: php
custom_fragment: ''
ssl_cert: ''
ssl_key: ''
ssl_chain: ''
ssl_certs_dir: ''
mod_pagespeed: 0
nginx:
install: '0'
settings:
default_vhost: 1
proxy_buffer_size: 128k
proxy_buffers: '4 256k'
vhosts:
AYbF7pKHAyh0:
server_name: awesome.dev
server_aliases:
- www.awesome.dev
www_root: /var/www/awesome
listen_port: '80'
location: \.php$
index_files:
- index.html
- index.htm
- index.php
envvars:
- 'APP_ENV dev'
engine: php
ssl_cert: ''
ssl_key: ''
php:
install: '1'
version: '55'
composer: '1'
composer_home: ''
modules:
php:
- cli
- intl
- mcrypt
pear: { }
pecl:
- pecl_http
ini:
display_errors: On
error_reporting: '-1'
session.save_path: /var/lib/php/session
timezone: America/Chicago
mod_php: 0
hhvm:
install: '0'
nightly: 0
composer: '1'
composer_home: ''
settings:
host: 127.0.0.1
port: '9000'
ini:
display_errors: On
error_reporting: '-1'
timezone: null
xdebug:
install: '0'
settings:
xdebug.default_enable: '1'
xdebug.remote_autostart: '0'
xdebug.remote_connect_back: '1'
xdebug.remote_enable: '1'
xdebug.remote_handler: dbgp
xdebug.remote_port: '9000'
xhprof:
install: '0'
drush:
install: '0'
version: 6.3.0
ruby:
install: '1'
versions:
IpeE5TzgGzXe:
version: ''
nodejs:
install: '0'
npm_packages: { }
mysql:
install: '1'
root_password: 'something'
adminer: '1'
databases:
RuNUheO1cH27:
grant:
- ALL
name: rladmin_rladmin
host: localhost
user: rladmin_rladmin
password: 'somethingelse'
sql_file: /var/www/relynx/sql/rladmin_rladmin.sql
8UkJkd4eF2TR:
grant:
- ALL
name: rladmin_rlhpsi
host: localhost
user: rladmin_rlhpsi
password: 'somethingelseentirely'
sql_file: /var/www/relynx/sql/rladmin_rlhpsi.sql
postgresql:
install: '0'
settings:
root_password: '123'
user_group: postgres
encoding: UTF8
version: '9.3'
databases: { }
adminer: 0
mariadb:
install: '0'
root_password: '123'
adminer: 0
databases: { }
version: '10.0'
sqlite:
install: '0'
adminer: 0
databases: { }
mongodb:
install: '0'
settings:
auth: 1
port: '27017'
databases: { }
redis:
install: '0'
settings:
conf_port: '6379'
mailcatcher:
install: '0'
settings:
smtp_ip: 0.0.0.0
smtp_port: 1025
http_ip: 0.0.0.0
http_port: '1080'
mailcatcher_path: /usr/local/rvm/wrappers/default
beanstalkd:
install: '0'
settings:
listenaddress: 0.0.0.0
listenport: '13000'
maxjobsize: '65535'
maxconnections: '1024'
binlogdir: /var/lib/beanstalkd/binlog
binlogfsync: null
binlogsize: '10485760'
beanstalk_console: 0
binlogdir: /var/lib/beanstalkd/binlog
rabbitmq:
install: '0'
settings:
port: '5672'
elastic_search:
install: '0'
settings:
java_install: true
autoupgrade: true
As an aside, I also tried this with Ubuntu 14 and got the same problem -- though at least in Ubuntu I could see that the vhost had AllowOveride All set, which I couldn't find in CentOS. However, it appears to do no good either as my site's .htaccess file is not recognized in Ubuntu either.
I had a similar issue today. From my debugging, I found that there is an issue with RewriteRules containing .php extension. I got it working by switching to mod_php as it appears to be an issue with the implementation of PHP-FPM.
For more information on what I found and to see if you are having the same issue, please check out this issue: https://github.com/puphpet/puphpet/issues/1051
Note that switching to mod_php is a temporary solution until a better solution can be found.

Resources