Sharing the domain/subdomain urls created on vagrant machine? - vagrant

What I have done till now.
1- I have used below vagrant box
https://scotch.io/bar-talk/introducing-scotch-box-a-vagrant-lamp-stack-that-just-works
2- After that I have created a virtual subdomain/domain on the Vagrrantmachine that are pointing to different folders on code directory
-- say abc.def.com pointing to var/www/public/pmtool
-- and aaa.def.com pointing to var/www/public/pmtool2
and these domains are enabled on virtual machine and running fine.
that is to say http://abc.def.com points to proper directory.
3- Now when I issue vagrant share command it provides me a url that is pointing to /var/www/public directory,
What I need to know that how I could get the urls aliases for these folders (domains/subdomains). i.e.an url alias to pointing to these directories.

You shouldn't feel too bad as other people have had this issue as well. The most relevant is this SO question, with the currently most upvoted answer being:
Change your WhateverItIs.conf file followingly by adding ServerAlias:
ServerName WhateverItIs.com
ServerAlias *.vagrantshare.com
and now you are good to go.

Another way to look at is that vagrant gives a url in the "vagrantshare.com" domain and what you want is to use "abc.def.com" and "aaa.def.com" still. The DNS that would make this possible would be for you to own the "def.com" domain and add CName records to it for both "abc.def.com" and "aaa.def.com", both pointing to the "vagrantshare.com" hostname generated for you by vagrant.

Related

OKD openshift-ansible: Updating 'openshift_master_cluster_public_hostname' and certificate

I have Openshift deployed and working fine, but now am putting a DNS record and a valid certificate in front of it. I haven't had any luck and haven't found any documentation on doing this.
My strategy just to update the hostname was to sed the existing public hostname with the new one in all files in the master/node configurations, but that didn't seem to work.
Is there a specific playbook/inventory fields I need to use/update in order to update this easily from the Ansible master?
UPDATE: I ran the 'openshift-master/redeploy-certificates.yaml' after I updated the inventory file with the following:
openshift_master_overwrite_named_certificates=true
openshift_master_cluster_public_hostname=new-public-hostname.com
Afterwards I checked the certs on the master node and they seemed to have added a new SAN to the master.server.crt and etcd.server.crt. However, when I go to the new hostname, it still redirects me to the old hostname. Is there another playbook I'm missing to update that in the system?
The redirection might be caused by the web console service that probably is not configured and uses the old masterURL.
Check this previous thread https://stackoverflow.com/a/54399071/2802150 as it addresses the same problem.

ICANN collision in chrome, view source works

So, I've just created a new site on Laravel Homestead. I pretty much always use .app as my local tld, and I've not had a problem with it before.
I've just created 2 new ones in my homestead.yaml file:
admin.philcross.app
philcross.app
I've run vagrant reload --provision and verified it's in my /etc/hosts file. Both domains are, and point to my VM.
If I go to philcross.app, it works. I see the webpage. If I go to admin.philcross.app, it fails, tells men There's an ICANN collision. However if I view the source, I see my webpage source. Not the error source.
To make it even more weirder, I already use a couple of local other domains locally exactly like the above (for example subdomain.domain.app locally). And it works.
The admin.philcross.app domain also works in Firefox.
I'm using Chrome, on Ubuntu 16.10.
I've tried altering the order of the domain mapping in my homestead.yaml file (ie putting admin.philcross.app before philcross.app and vice versa).
I've tried multiple timesvagrant halt / vagrant up / vagrant reload --provision / vagrant provision`
I've tried opening my hosts file with sudo and saving
Does anyone else have any ideas? I'm completely stuck, and all googling so far has just said to put the subdomain in the homestead.yaml file (not helpful).
.app is a real TLD, owned by Google. It isn't open for registrations yet, but it is likely to become available soon; your browser is warning you that your domain is likely to conflict with a real domain in the near future.
Don't use .app for internal applications or development, even locally. (Don't use .dev either; it, too, is a real TLD that belongs to Google!) Use one of the four top-level domains that has been explicitly and permanently reserved for testing:
.test
.example
.invalid
.localhost
map your sites to same root:
sites:
- map: philcross.app
to: /home/vagrant/philcross/public
- map: admin.philcross.app
to: /home/vagrant/philcross/public

Clone development environment on an office server to use locally

Situation:
As a developer I'd like to "clone" our development environment (on an office server) so we can use it locally (for example when no/limited internet access is available). We've decided to give Vagrant a try.
What did I do?
First I used PuPHPet to create a basic config including nginx, php (incl modules), composer, git, memcached etc. You can find my config here. I also added a nginx vhost for our website.dev. This is where I run into the first problem.
We use a few additional config settings to the location block. A rewrite, a fastcgi_pass and a include. This is not available so I searched a lot online and I found out I could use the following statement (was more a try/fail/retry).
location_cfg_append:
{ rewrite: ".* /dispatch.php break", include: "fastcgi-params.conf", fastcgi_pass: "127.0.0.1:9000" }
First question:
This does work, however is this the way to do this? I'm not sure if I should be editing this config file (the file generated by PuPHPet) directly.
Second question:
How should I 'upload' the fastcgi-params.conf file I want to include? I did not find a way to do this in the config.yaml but there is a way to run some scripts. For now I've added a echo [contents] > /etc/nginx/fastcgi-params.conf that does work. However...
Third question:
When the VM is provisioned the nginx config is created. When that is done nginx is restarted. However at that moment the fastcgi-params.conf file does not exist yet (this is created AFTER the provisioning).
When nginx reloads this will fail, trigger an error and the machine can not finish the provision sequence (so it will never create the config file).
I can create this file on the next boot (and then nginx will work) but this cannot be the correct way to do this. So: how can I (before nginx 'installation') create / deploy a file to the VM? Or more generic (question 2): How can I upload a file to the VM?
If this is totally not the way to go please let me know! This are our first steps into creating a locally development machine so other/better methods are welcome.
First question: This does work, however is this the way to do this? I'm not sure if I should be editing this config file (the file generated by PuPHPet) directly.
Yes, I encourage this.
Second question: How should I 'upload' the fastcgi-params.conf file I want to include?
Place it inside one of your shared folders. It'll be available within the VM and you can reference it that way.
Third question
The above answer fixes this issue.

Vagrant - Global Setup among many sites + domain aliases

Coming from a MAMP Pro background, I loved the ability to have a "base" folder (/Sites in this case), have all of my projects underneath it and set custom server names/aliases with it. With Vagrant, it looks like I can accomplish the name/alias part with vagrant-hostsupdater, but if I really did just want to have the Vagrant files in /Sites and then all of them use the same config, what's the best way to specify a subfolder disk location with those custom host names?
I'm most likely over-thinking this, have just been a sucker for GUI interfaces and would love to know how to accomplish this. Thanks as always!
Clarification
What I'm used to
I used to use MAMP Pro, which allows you to setup custom host additions with their GUI interface. So, within my ~/Sites directory, I have several different projects going on, all in subfolders. The screen shot below shows how I can set a server name and specify a disk location, all from this central location.
What I'd like to do with Vagrant
Now I do know of (and used vagrant-hostsupdater), but what I was wondering is if I can set my Vagrant file in my ~/Sites directory (which is kind of like the root of the server; since all of my projects require the same setup) and then have individual host names setup for each project - so instead of having to access a subfolder like local.dev/project-1 or local.dev/project-2 I could setup server names such aslocal.project-1.comandlocal.project-2.com` from within that top-level Vagrant file and specify the subfolder it should attach that rewrite rule too.
The reason I'd like to do this is so I only have to run one vagrant up and I can then access all of my projects from one Vagrant instance as well as only keep track of one Vagrant file. Thanks!
You need to tell vagrant what hostnames you would like to use.
Directory based hostnames
Assuming you set you would like to set your hostnames based on the directory name; you can get all of the hostnames with ruby and pass them to the hostsupdater configuration.
SITES_DIR = "~/Sites"
config.hostsupdater.aliases = Dir["#{SITES_DIR}/*/"].map { |d| d.chomp('/') }
Configuration based hostnames
Alternatively you can mock up some sort of configuration that is desirable to you and what you are trying to do and evaluate/process it in ruby within the Vagrantfile.

Where can i find the .cache folder on a linux hosting

I am trying to add a rss feed into an HTML page. After some searching found something called simplepie.
On trying i get an warning
Warning: ./cache is not writeable.
Make sure you've set the correct
relative or absolute path, and that
the location is server-writable. in
xxx/inc/simplepie.inc on line 1780
On checking for the cache folder on the server i couldnt locate the folder. I am on a linux server. Would creating a cache folder be enough or do i need to get the hosting company to look into it
Thanks
In addition to creating the folder, you will need to make it writable by the user that the script will run as. You may need the hosting company's help on this. Otherwise, you can make it world-writable, though if you can restrict it to just allow the user the script runs as, then that would be best.

Resources