techx/quill

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

DaleMitchell opened this issue · 8 comments

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?

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 :)

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.

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!

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.

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.

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).

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!

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;
    }
}