Landrush won`t start after vagrant reload - dns

At the begin I would like to highlight that I am new in vagrant.
I am using Vagrant 1.8.6, ubuntu/trusty64 box and landrush plugin.
I have a huge problem when I reload my vagrant then landrush won't start.
I tried to restart this plugin but I got this message: "Pid 5731 is not running. Has daemon crashed?" The landrush status says that the deamon status is unknown and .vagrant.d/data/landrush/run/landrush.pid exists, but process is not running.
Here is the content of landrush log file:
I, [2016-11-24T12:23:32.193495 #5458] INFO -- : Starting RubyDNS server (v0.8.5)...
I, [2016-11-24T12:23:32.193953 #5458] INFO -- : Listening on udp:0.0.0.0:10053
I, [2016-11-24T12:23:32.194205 #5458] INFO -- : Listening on tcp:0.0.0.0:10053
I, [2016-11-24T12:34:54.220574 #5458] INFO -- : Resource class: Resolv::DNS::Resource::IN::A
I, [2016-11-24T12:34:54.221674 #5458] INFO -- : Resource: #<Resolv::DNS::Resource::IN::A:0x00000101335f20 #address=#<Resolv::IPv4 10.10.12.10>>
After vagrant landrush vms I got: No dependent VMs.
My Vagrantfile:
Vagrant.configure('2') do |config|
config.ssh.forward_agent = true
synced_folder_type = ENV.fetch('SYNC_TYPE', 'nfs')
synced_folder_type = nil if 'vboxsf' == synced_folder_type
config.vm.synced_folder '.', '/home/vagrant/www.mysite.pl',
:type => synced_folder_type,
:rsync__args => ['--verbose', '--archive', '-- delete', '-z']
config.vm.define 'default', primary: true do |config|
config.vm.box = 'ubuntu/trusty64'
config.vm.hostname = 'shop.local.mysite.pl'
if Vagrant.has_plugin? 'landrush'
config.landrush.enabled = true
config.landrush.tld = 'local.mysite.pl'
config.landrush.host 'mysite.pl.local.mysite.pl'
config.landrush.host 'www.mysite.pl.local.mysite.pl'
config.landrush.host 'test.mysite.pl.local.mysite.pl'
config.landrush.host 'mysite.com.local.mysite.pl'
config.landrush.host 'www.mysite.com.local.mysite.pl'
config.landrush.host 'test.mysite.com.local.mysite.pl'
end
config.vm.network :forwarded_port, guest: 22, host: 22220, id: 'ssh'
config.vm.network :private_network, ip: '10.10.12.10'
config.vm.network :public_network, :bridge => 'en0: Wi-Fi (AirPort)'
config.vm.provision 'shell', path: 'provision/scripts/install.sh'
end
end
I can not find right way to resolve this problem. Only vagrant destroy helps but this is not the solution. I googled about it a few hours but nothing works. Anyone had a simmilar problem ? Thank you in advance for yours answers.

Related

Vagrant-Azure: Guest machine can't connect to host machine (Unable to copy SMB files)

I've been working on Vagrant only locally until now and now I want to create VM with Azure as the provider, but unfortunately I've got the error that can be seen on the image accesible through the link. I understand what it says but I have absolutely no idea how to fix it.
Error
I am also appending my Vagrantfile:
require 'vagrant-azure'
Vagrant.configure("2") do |config|
config.vm.box = 'azure'
config.vm.box_url = 'https://github.com/azure/vagrant-azure/raw/master/dummy.box'
config.vm.network "private_network", guest: 80, host: 80
config.ssh.username = 'vagrant'
config.ssh.private_key_path = '~/.ssh/id_rsa'
config.vm.synced_folder '.', '/vagrant', :disabled => true
config.vm.provider :azure do |azure, override|
azure.tenant_id = ****
azure.client_id = ****
azure.client_secret = ****
azure.subscription_id = ****
azure.tcp_endpoints = '80'
azure.vm_name = 'grafmuvivm'
azure.vm_size = 'Standard_B1s'
azure.vm_image_urn = 'Canonical:UbuntuServer:18.04-LTS:latest'
azure.resource_group_name = 'grafmuvirg'
azure.location = 'westeurope'
virtual_network_name = 'grafmuvivm-vagrantPublicIP'
end
# Declare where chef repository path
chef_repo_path = "./chef"
# Provisioning Chef-Zero
config.vm.provision :chef_zero do |chef|
# Added necessary chef attributes
chef.cookbooks_path = 'chef/cookbooks'
chef.nodes_path = 'chef/cookbooks'
#### Adding recipes ####
chef.add_recipe "api::ssh_user"
chef.add_recipe "api::grafmuvi"
# Running recipes
chef.run_list = [
'recipe[api::ssh_user]',
'recipe[api::grafmuvi]'
]
# Accept chef license
chef.arguments = "--chef-license accept"
end
end
If I run 'vagrant up --debug' it can be seen that guest machine cannot ping any of the host machine IPs.
Could someone please tell me how to properly setup networking on Vagrant? I've checked the GitHub issues related to this topic but I didn't find anything useful...
EDIT:
I worked with Vagrant but not with Vagrant-azure. But, can you change configuration in the following way and show the output:
azure.vm.network "private_network", ip: "192.168.50.10"

Vagrant : An AMI must be configured via "ami" (region: #{region})

I got an error as below when run vagrant command,
# vagrant up --provider=aws
There are errors in the configuration of this machine. Please fix
the following errors and try again:
AWS Provider:
* An AMI must be configured via "ami" (region: #{region})
I'm using Vagrant 2.0.1 with vagrant-aws 0.7.2
Vagrant file:
Vagrant.configure("2") do |config|
require 'vagrant-aws'
Vagrant.configure('2') do |config|
config.vm.box = 'Vagarent'
config.vm.provider 'aws' do |aws, override|
aws.access_key_id = "xxxxxxxxxxxxxxxxxx"
aws.secret_access_key = "xxxxxxxxxxxxxxxxxxxxxxxx"
aws.keypair_name = 'ssh-keypair-name'
aws.instance_type = "t2.micro"
aws.region = 'us-west-2a'
aws.ami = 'ami-1122298f0'
aws.security_groups = ['default']
override.ssh.username = 'ubuntu'
override.ssh.private_key_path = '~/.ssh/ssh-keypair-file'
end
end
How to solve it?
us-west-2a is not a valid region name, see https://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region for the full list of available region and end-points.
If you AMI is location in US West (Oregon), then you need to replace with us-west-2 in your Vagrantfile
Going through "vagrant-aws" documentation, following worked for me.
Installed "vagrant-aws" plugin with shell:
vagrant plugin install vagrant-aws
Added AWS compatible 'dummy-box' named "aws" added in config.vm.box = "aws":
vagrant box add aws https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
Created following Vagrant file:
# Require the AWS provider plugin
require 'vagrant-aws'
Vagrant.configure(2) do |config|
config.vm.box = "aws"
config.vm.box_url = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box"
config.vm.provider :aws do |aws, override|
aws.access_key_id = ENV['AWS_ACCESS_KEY']
aws.secret_access_key = ENV['AWS_SECRET_KEY']
aws.region = "us-east-1"
#aws.availability_zone = "us-east-1c"
# EC2 Instance AMI
aws.ami = "ami-aa2ea6d0" # Ubuntu 16.04 in US-EAST
aws.keypair_name = "awswindows" #change as per your key
aws.instance_type = "t2.micro"
aws.block_device_mapping = [{ 'DeviceName' => '/dev/sda1', 'Ebs.VolumeSize' => 10 }]
aws.security_groups = ["YOUR_SG"]
aws.tags = {
'Name' => 'Vagrant EC2 Instance'
}
# Credentials to login to EC2 Instance
override.ssh.username = "ubuntu"
override.ssh.private_key_path = ENV['AWS_PRIVATE_KEY']
end
end
Fired vagrant up --provider=aws.
Check once and let me know if you face any issue.

Cannot connect to node js server hosted on vagrant machine

I'm trying out vagrant as a local testing server and I'm having difficulty connecting to nodejs app server from the hosting windows machine, but I can connect to nginx server just fine.
My vagrant file:
Vagrant.configure("2") do |config|
config.vm.define "web" do |web|
web.vm.box = "ubuntu/trusty64"
web.vm.network "private_network", ip: "55.55.55.55"
end
config.vm.define "app_0" do |app_0|
app_0.vm.box = "ubuntu/trusty64"
app_0.vm.network "private_network", ip: "55.55.55.1"
end
config.vm.define "db" do |db|
db.vm.box = "ubuntu/trusty64"
db.vm.network "private_network", ip: "55.55.55.56"
end
end
My node js index.js(helloworld) from app_0 at 55.55.55.1:
// Load the http module to create an http server.
var http = require('http');
// Configure our HTTP server to respond with Hello World to all requests.
var server = http.createServer(function (request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.end("Hello World\n");
});
// Listen on port 80, IP defaults to 127.0.0.1
server.listen(80, '0.0.0.0', function() {
console.log('Listening to port: ' + 80);
});
Which is run with sudo node index.js and is visible locally on the vagrant machine, but I cannot connect to it from hosting machine at 55.55.55.1:80
Please do not mark this duplicate of this: Connect to node js server running on vagrant machine as it does not use port-forwarding.
I see 2 things:
55.55.55.x is not a private network IP (see https://en.wikipedia.org/wiki/Private_network) so you might reach a valid IP and even when setting your host file, you might have conflict.
Do not use address with .1 at the end, it is the default gateway/router
so how vagrant will reach the host.
Pick a valid IP from the private network range and it will work
Vagrant.configure("2") do |config|
config.vm.define "web" do |web|
web.vm.box = "ubuntu/trusty64"
web.vm.network "private_network", ip: "192.168.55.10"
end
config.vm.define "app_0" do |app_0|
app_0.vm.box = "ubuntu/trusty64"
app_0.vm.network "private_network", ip: "192.168.55.11"
end
config.vm.define "db" do |db|
db.vm.box = "ubuntu/trusty64"
db.vm.network "private_network", ip: "192.168.55.12"
end
end

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.

Vagrant, setuping machine for Node.js - Chef failure

My Vagrantfile:
Vagrant::Config.run do |config|
config.vm.box = "lucid32"
config.ssh.forward_agent = true
config.vm.forward_port 3000, 3000
# allow for symlinks in the app folder
config.vm.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/app", "1"]
config.vm.customize ["modifyvm", :id, "--memory", 512, "--cpus", 1]
config.vm.provision :chef_solo do |chef|
chef.cookbooks_path = "cookbooks"
chef.add_recipe "apt"
chef.add_recipe "build-essential"
chef.add_recipe "nodejs-cookbook"
chef.add_recipe "chef-hosts"
chef.add_recipe "git"
chef.json = {
"nodejs" => {
"version" => "0.8.12",
"install_method" => "source",
"npm" => "1.1.62"
},
"host_aliases" => [{
"name" => "awesomeapp",
"ip" => "127.0.0.1"
}]
}
end
end
When I run vagrant reload I got following exception from Chef:
[2012-11-25T07:58:23+01:00] ERROR: Running exception handlers
[2012-11-25T07:58:23+01:00] ERROR: Exception handlers complete
[2012-11-25T07:58:24+01:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
[2012-11-25T07:58:24+01:00] FATAL: Chef::Exceptions::CookbookNotFound: Cookbook nodejs not found. If you're loading nodejs from another cookbook, make
sure you configure the dependency in your metadata
Chef never successfully completed! Any errors should be visible in the
output above. Please fix your recipes so that they properly complete.
SOLVED: In cookbook folder I renamed nodejs-cookbook to nodejs and corrected Vagrant file.
chef.add_recipe "nodejs-cookbook"
After I ran
vagrant provision
Everything were installed fine!
add_recipe should be the name of the recipe. e.g. file structure:
cookbooks/nodejs
And importantly:
cookbooks/nodejs/metadata.rb should contain: name "nodejs"

Resources