Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing ROOT_URL in the '.env' file does not have the desired effect #57

Open
DaleMitchell opened this issue Jan 15, 2018 · 8 comments

Comments

@DaleMitchell
Copy link

DaleMitchell commented Jan 15, 2018

I want to host Quill on the same domain as our event website, ie.
event website: make.osu.edu
event registration: make.osu.edu/register/

So I changed ROOT_URL in the '.env' file but, as my title of this issue reflects, it no workie workie.

Any ideas?

@jlin816
Copy link
Contributor

jlin816 commented Jan 16, 2018

When another hackathon ran into this issue a little while ago, there were a few additional things that needed to be done:

  • Set the href property here to be your new root url so the stylesheets can be served properly.
  • Prepend register/ to all node API calls.

Let me know if this fixes the problem! If you have an idea of how to pull this out into nice config settings so this is clearer / easier for other people in the future, feel free to put in a PR :)

@DaleMitchell
Copy link
Author

Hi Jessy,

Thank you for taking the time to respond. Surprisingly I managed to figure most of it out on my own but it required a fair amount more than those two steps. Although I had prior experience with Linux and Nginx, I am still very much a beginner to Node.js. However, Google came to the rescue.

When I meet with my peers, we will try to improve upon the work I've done to make a pull request related to this issue, so others can replicate what we did without the same struggle I had. :P

Our fork of the repo can be found here: https://github.com/ElectronicsOSU/quill-MakeOHIO-2018

Thanks,
Dale.

@DaleMitchell DaleMitchell changed the title Changing ROOT_URL in the '.env' file has no effect Changing ROOT_URL in the '.env' file does not have the desired effect Jan 16, 2018
@jlin816
Copy link
Contributor

jlin816 commented Jan 22, 2018

That would be awesome, @DaleMitchell, I think this would be in high demand since we've seen many other hackathons trying the same thing. Keep us updated on whether you're planning to work on this!

@DaleMitchell
Copy link
Author

Buckeye Hackers will host "Hack the Hack" on February 3 on Ohio State's campus at the 18th Ave Library (Room 070) from about 10 AM to 4 PM. The goal of the event is to improve anything related to our hackathon program. I'll be there to push this as a priority at the event, so we should be able to get most of it done.

@DaleMitchell
Copy link
Author

We made a lot of progress but there are some finishing touches that still need to be completed. I'll revisit this issue next weekend.

@DaleMitchell
Copy link
Author

DaleMitchell commented Feb 11, 2018

Made a commit related to this issue to our fork for MakeOHI/O. See ElectronicsOSU@0dd81bf

Also need to add documentation for using Nginx as a proxy (so Quill can be accessed from the same webserver as the event website, which was the intent of bringing this issue forward).

Perhaps this addition to the readme:

It is possible to host Quill and a website (i.e. an event's website)
on the same domain and port (no subdomain needed). Set ROOT_URL in .env
and also configure the event's webserver to act as a proxy. Example using Nginx:

/etc/nginx/sites-available/default

---------------------------------------------------------------
server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /usr/share/nginx/html;
        index index.html index.htm;

        # Make site accessible from http://localhost/
        server_name localhost;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        location /register {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-NginX-Proxy true;
                proxy_pass    http://127.0.0.1:3000/register;
        }
}

Apply configuration using 'nginx -s reload' or rebooting webserver.

I'd like to make a pull request with these changes but since we just used the whole fork we made for our event there will be conflicts due to our branding and other features we have implemented. After acknowledging this, I think that it would be best for me to make a new branch just to make improvements/add features in order to keep them separate from customizations like branding (maybe I'll call the branch that I'm describing 'vanilla', seems like a good choice, also makes me hungry for some vanilla ice cream lol).

@DaleMitchell
Copy link
Author

With that said, I'm pretty busy and need to prioritize schoolwork, but if someone wants to beat me to a pull request for this issue, feel free!

@DaleMitchell
Copy link
Author

Also interesting how a different Node.js project accomplished the feature related to this issue:
https://github.com/mrvautin/adminMongo

Configuration

adminMongo will listen on host: localhost and port: 1234 by default. This can be overwritten by adding a config file in /config/app.json. For example:

{
    "app": {
        "host": "10.0.0.1",
        "port": 4321,
        "password": "secureadminpassword",
        "locale": "de",
        "context": "dbApp",
        "monitoring": false
    }
}

Setting a context path

Setting a context of "dbApp" is like changing the base URL of the app and will mean the app will listen on http://10.0.0.1:4321/dbApp. Ommiting a context will mean the application will listen on
root. Eg: http://10.0.0.1:4321. This setting can be useful when running adminMongo behind Nginx etc.

An example Nginx server block. Note the location /dbApp { and proxy_pass http://10.0.0.1:4321/dbApp; lines match
the context set in the /config/app.json file.

server {
    listen 80;

    server_name mydomain.com www.mydomain.com;

    location /dbApp {
        proxy_pass http://10.0.0.1:4321/dbApp;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants