Connect two apps via custom subdomain on heroku - ruby-on-rails-4

I have two separate rails apps. I'd like to connect them by simply linking them in the header. One is, for example, http://example.com and I'd like the other to be, for example http://different.example.com.
I added the relevant domain to the first heroku app and it's working. I created a subdomain with my domain host, setting the host CNAME to the previously referenced "different." I then attempted to add the subdomain to the heroku app by running the command:
$ heroku domains:add different.example.com
Despite that, it's not working. Any thoughts on what I've done wrong? I followed the instructions from my domain host and on heroku's documentation.

If you made a recent change, it's possible that your connection to the Internet or ISP might be serving you a cached, old version of where you want to go.
Try accessing the site from another entry point such as through a third party like https://crossbrowsertesting.com and then you can rule out this possibility.

Related

Creating subdomain in django

I want to know the proper way of creating subdomain in django. Take for instance, a django project that has more than one apps and you want to assign subdomain to each. Apart from using django-hosts; what can one do in production especially if one deploys to digitalocean with gunicorn and nginx?
Note: I've tried django-hosts which worked well locally but did flopped in production as my static files couldn't be located.
I've search online and I don't seem to see a solution to this.
Thanks in advance
Making a subdomain in django at production is relatively simple and straight forward.
N.B: you don't need any plug in like django-hosts or django-subdomain to make this happen.
What I did with my project is splitting it into two different projects calling them different names.
I put both of the projects in the same projectdir as recommended when deploying single project to digitalocean using nginx and gunicorn.
I created gunicorn.sock and gunicorn.service for each project changing gunicorn to the name of the project e.g if my projects name is blog and forum, I will have blog.sock and blog.service for blog and created corresponding name for the other project.
The same thing will be done for nginx too. You place the domain that you want in the server part of the nginx.
Make sure that you properly fill the directory well especially the gunicorn.service(in this case, blog.service and the other).
Also, if you want to run any command relating to gunicorn, you will the name of your service file.
Good luck.

How to host two websites on AWS on Windows and Apache but only one site works

I have two sites we'll call Site1.com and Site2.com.
I recently converted my VPS with another host to an image and imported the image into AWS. On the VPS, I was able to serve up both sites. Under AWS, whichever URL is accessed first, the second site will display the content and the URL will change to the first accessed site.
The setup is unique in that it is Windows running an apache web server (very old application). No changes to the conf files have been made since the conversion so I can only assume that it's something unique with the AWS setup.
Why is it doing this and more importantly how can I fix this so that I don't have to spin up a second instance.
Turns out the issue is with the instance type. When I bumped it up to medium (from small), the issue resolved itself. Go figure.

Multiple environments on one server

What is the best practice or tutorial to set up a droplet to showcase my React/Express and Django fullstack projects on a single server?
I've found NGINX server blocks, but not sure if I'm going in the right direction.
I want users to go to a React site that will have links to several other React or Django projects running on the same server.
Finally figured it all out.
You can use all of the regular server block documentation if you have another domain name or subdomain name you want to point to the server. That documentation can be found at Nginx Documentation on Server Blocks and Digital Ocean post on server blocks
If you want to make multiple server blocks within subdirectories of the root server you can use location as seen here in the Nginx documentation: ServerFault question/answer

Is it possible to have a Heroku app I built be on the same domain as my Wordpress website?

I have a website hosted on Wordpress at domain [my domain name].com. I built an app using Django that is currently deployed on Heroku at [my domain name].herokuapp.com. The apps do not have conflicting routes. For example, the '/' route does not exist on the app I built myself. Is it possible to configure my DNS settings on Heroku such that I can use my custom domain name where a Wordpress website already lives?
I think you are asking if both of your applications can live at the same domain.
The answer is yes....sort of.
Subdomains
Your two sites would need to be on separate subdomains. For example your heroku app might have a CNAME record pointing to it like this
djangoapp.YOURDOMAIN.com. CNAME [my domain name].herokuapp.com.
I realize this might be confusing, but your django app would live at a prefix/subdomain.
Then the CNAME for your wordpress site might look like:
www.YOURDOMAIN.com. CNAME wordpress.com/YOURBLOG
No. Not in the same domain.
Treas gave you a compromise but you understand that siteA.mydomain.com and siteB.mydomain.com are two different domains.
You CAN NOT have the following situation:
mydomain.com/ <- This goes to the wordpress site
mydomain.com/a <- This one goes to the heroku site
mydomain.com/a/b <- But this one goes to the wordpress site
mydomain.com/c <- and this one goes to the wordpress again.
You have a DNS configuration issue. It is not related to Heroku nor Wordpress. DNS can not be configured with routes. They can with sub-domains like trejas has described.

Launching a Mezzanine site live

I'm new to mezzanine and Django. I have set up a site, everything is working but I can only launch the server on "development". I would like to access de site on the port 80 on the internet instead of internally, as I have no way other than redirecting the port via SSH to access it. I would like to know how to do that.
And another question, is Nginx included with Mezzanine automatically ? Cause I have a tuned up Nginx server there and I'm not sure what I need to do, if run it with my existing Nginx server or with the one included with Django if that is how it works .... thank you for bring some light on this.
NGINX is not included with Mezzanine, it's an entirely separate piece of software, similar to Apache.
Mezzanine includes a fabric script which can automatically set up a production server if you'd like to use it, and will install NGINX on the server for you, among many other things.
Given your question, I can't recommend enough that you read and understand all the related documentation on this topic. Start with the Mezzanine link below, it references many other documentation sites - Django, Fabric, NGINX, plus more.
Enjoy the adventure: http://mezzanine.jupo.org/docs/deployment.html