ConservationInternational / COA001

COASST Database App & API
0 stars 0 forks source link

Moving devops related Vagrant provisiong files #5

Closed seansu4you87 closed 9 years ago

seansu4you87 commented 9 years ago

Hey @d-g-h I moved all of the COA001 box provisioning files to a /devops folder. I'm doing some file reorg and going to start actually coding backend related stuff today. If this isn't good for you, let me know and and we can figure something out

d-g-h commented 9 years ago

@seansu4you87

That should be OK for now. What is the correct path on the machine though?

I also realize why I coupled the frontend and backend into one repo, and stack in another.

I'm not sure how to replicate what you have...and I'm not sure how to navigate paths on the server

/var/www/coa001/api ?

So, I think we might have to drop the devOps repo all together, and pass boxes via Dropbox.

That's OK. Though slow.

seansu4you87 commented 9 years ago

Hey @d-g-h, I thought everything should be the same for you, you would just work out of /devops instead of the root repo directory. I believe the Vagrantfile that's in the repo, plus all the *.yml files were used by you to make a COA001 box that I downloaded via dropbox (the original README, which is now in /devops states not to access this Vagrantfile).

I still create a new folder /COA001DB in another directory, and just change the Vagrantfile in that directory to reference the COA001 box. Was I mistaken?

What do you mean by frontend and backend into one repo? Is this COA001 repo supposed to have both frontend and backend code? I remember you me and @edwerd chatted on Slack last week and it sounded like there would be a separate repo for the frontend code. I assumed this COA001 box only contained the postgres database.

Lemme know if I should be doing something different. Thanks!

d-g-h commented 9 years ago

I see. Maybe, you are working exclusively in the box? It's might to be used as hydrid environment as part of the server path is accessible on the host machine.

I still create a new folder /COA001DB in another directory, and just change the Vagrantfile in that directory to reference the COA001 box. Was I mistaken?

That is correct. I just need to know the path for NGINX and Node path on the GUEST, so I can update Ansible, and so I can know what to deploy to staging.

This is the reason for https://github.com/RadishLab/COA001/blob/master/devops/Vagrantfile#L18 VM(GUEST, ubuntu node forever)---OSX(HOST SYSTEM, osx node grunt) So /var/www/(backend/frontend-code/index.html), would be accessible via your local node setup on OSX, I need that do all the frontend stuff, and the backend stuff as well, most importantly to use our git configs, vim configs, sublime configs, etc,

I really trying to replicate the server env, I'm not trying to run the app at localhost:8000/

I realize that having a setup that is different from the above would be weird as I gave that to you.

Sorry for the confusion, here is the setup, let's continue with it.

COA001 = DB/API

COA002 = REACT

I can talk about in a hangout real quick. Let me what time is good. I think the main problem is that I provisioned to box for you to only checkout the DB. It was not meant for application code, as I didn't provision Node or configure a proxy for it in NGINX, or even configure NGINX plain and simple.

I don't mind rerolling this as we have a setup were are using that is extremely similiar, but easier to provision because we are using MongoDB, and API and Frontend are together

screen shot 2015-02-10 at 8 47 50 pm

Your API, stack would be here though.

screen shot 2015-02-10 at 8 51 55 pm

We would adjust .gitignore as necessary

seansu4you87 commented 9 years ago

Ahh @d-g-h I see where I got confused. I was under the impresion COA001 is only to be used as the database, and there would be 2 other boxes, one for the backend, and one for the frontend.

I'm cool with whatever setup you want to do, since you have a better idea of how production will play out than I do. Right now, I'm just running tests to make sure everything works, so I'm not using the COA001 box for anything besides a postgres database. I'm starting to work on the React components for UI, but don't mind pointing them at localhost for now, while you get the boxes set up.

All of my server code is in /src. To start the node server, the command is:

node /src/server/hapi.js

Let me know if you need anymore info to set up the boxes. If you want to do a quick hangout, tomorrow (thurs) or Fri at 12pm EST is good for me, just shoot me a calendar invite.

Thanks!

d-g-h commented 9 years ago

Perfect. I will set something up. I'm not trying to get you to do it my way. I am trying to find a way that works for replication, but at the same time I want to respect your local development env.

d-g-h commented 9 years ago
server {

        listen 80;
        listen 443 ssl;

        server_name coa001.staging.radishlab.com *.coa001.staging.radishlab.com;

        ssl_certificate /etc/nginx/ssl/nginx.crt;
        ssl_certificate_key /etc/nginx/ssl/nginx.key;

        root /var/www/amn001/frontend/app;

        location / {
                try_files $uri$args $uri /index.html;
        }

        location = /favicon.ico { access_log off; log_not_found off; }
        location = /robots.txt { access_log off; log_not_found off; }
        location = /apple-touch-icon.png { access_log off; log_not_found off; }
        location = /apple-touch-icon-precomposed.png { access_log off; log_not_found off; }
        # deny access to all .invisible files
        location ~ /\. { deny  all; access_log off; log_not_found off; }
        location /api {
                auth_basic off;
                proxy_pass          http://127.0.0.1:8000;
                proxy_buffering off;
                proxy_redirect off;
                proxy_set_header        Host            $http_host;
                proxy_set_header        X-Real-IP       $remote_addr;
                proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-NginX-Proxy true;
                expires 0;
        }

        location ~ ^/(images/|img/|fonts/|javascript/|js/|css/|stylesheets/|flash/|media/|static/|robots.txt|humans.txt) {
                access_log off;
                expires 0;
        }

        error_page   500 502 503 504  /50x.html;
}