amnh-library / API-Portal

AMNH Library API
http://api-dev.library.amnh.org/api/v1/people
5 stars 0 forks source link

Change user directories in dev #5

Closed mik3caprio closed 7 years ago

mik3caprio commented 7 years ago

Move all apps & code from mcaprio user in dev to apiproject user

mik3caprio commented 7 years ago

Hey @pdelong42 - I cloned over the repos and set up the environment variables in apiproject user, but I think I can't start the API server with the other instance running in systemd. When you get a chance can you turn it off? Then I'll test it out, and maybe we can debug it from that user and stuff.

pdelong42 commented 7 years ago

@mik3caprio, you should be able to stop the server using one of the the commands listed in "sudo -l". Let me know if you have any issue with this.

pdelong42 commented 7 years ago

@mik3caprio, try restarting the nodejs-api service now, and let me know how it goes. I've updated its configuration in systemd, to point at the instance that now lives in /home/apiproject, so it should run as that user next time it starts.

pdelong42 commented 7 years ago

@mik3caprio, I took a stab at restarting nodejs-api.service just now, and it appears to work swimmingly, from my point-of-view at-least. Please give it a whirl.

If this works as expected, then we can set-up a systemd config file for the metasearch code as well.

FYI, I needed to change the Apache process to point at TCP/3020 (it was configured to point at TCP/3000 earlier), for the proxied api-dev.library.amnh.org URLs to work.

Test and get back to me.

pdelong42 commented 7 years ago

@mik3caprio, I get an error when I try to run metasearch as user "apiproject". An excerpt is included below - it's large, so I just included the part I thought was relevant (of-course, for more details look in /home/apiproject/metasearch/library-metasearch/npm-debug.log):

[root@lbry-web-005 ~]# su - apiproject
Last login: Mon May  1 13:59:35 EDT 2017 on pts/1
[apiproject@lbry-web-005 ~]$ cd metasearch/library-metasearch
[apiproject@lbry-web-005 library-metasearch]$ pwd
/home/apiproject/metasearch/library-metasearch
[apiproject@lbry-web-005 library-metasearch]$ npm start

> library-metasearch@0.0.1 start /home/apiproject/metasearch/library-metasearch
> react-scripts start

sh: react-scripts: command not found
mik3caprio commented 7 years ago

@pdelong42 So it looks like the issue here was just that 'npm install' needed to be run in the directory to install react-scripts. However the building of the library-metasearch app is not launching to the proper directory, and I think that can be addressed by running a particular server module for the app.

If you could globally install this: 'npm install -g pushstate-server', we can use 'pushstate-server ~/path/to/build; open http://localhost:$DEV_SEARCHSERVER_PORT' as the command to launch the app locally (or whatever syntax will take advantage of the port number as an env var). The React framework production deploy process is a little different than the one for the API serving node app.

mik3caprio commented 7 years ago

The production build of metasearch is now running.