Phew! Alrighty, I (finally) just got Plex Requests deployed and working and I have to say that I really enjoy it, but building the deployment server to deploy the app to my prod server took longer than actually manually deploying it would (I feel).

Ok, starting from the beginning. A good buddy of mine recently told me about Plex Requests (you can visit their GitHub page here: https://github.com/lokenx/plexrequests-meteor); it’s a phenomenal little tool for taking requests, approving them, and automatically sending the request (through API) to your favorite acquisition tools. Set up is super easy and is right on the GitHub page; install Meteor ( curl https://install.meteor.com/ | sh ), clone the project to the folder you want to run it from ( git clone https://github.com/lokenx/plexrequests-meteor.git ), then cd to that folder and run it by issuing the command meteor . Piece of cake. It runs on port 3000 by default, so you can now browse to http://localhost:3000 and you’ll get the awesome interface for Plex Requests (btw make sure to go to /admin/ first and set up your admin creds).

Now comes the problem. If you’re playing the home game, you most likely noticed that (as far as I can tell) there’s no way to run it in daemon mode, so getting it running and keeping it running is going to be a PITA. (Fair warning: my Linux skills are not at all what they should be) So of course I popped out to the trusty Google and found that there are a couple of ways to make this happen: you can use an Upstart script, you can use Forever (https://github.com/foreverjs/forever), (from what I understand) you can use a docker, or (apparently the most popular) is Meteor Up (https://github.com/arunoda/meteor-up). (More fair warning: my scripting/coding skills are non-existent) I tried Upstart, but got errors in the upstart log that, quite honestly, meant absolutely nothing to me. (below)

I looked into Forever and it really looked like something that was over my head, so I went the way that apparently everyone is using, Meteor Up. Meteor Up is a program for deploying all of the software required for Meteor projects to run (MongoDB, Node.js, PhantomJS), configuring Upstart and Forever, and converting your Meteor project to node.js and deploying it to your server. Holy crap, I do have to give props to the Meteor Up guys because they really did develop a phenomenal tool for deployment. Initially looking at it, my head went “Seriously? I have to build a server to deploy to a different server? This seems like a lot of screwing around for something that seems like it should be much simpler, especially since I already have the program running on my server…just not in the background like I want it.” but I figured I’d give it a shot.

I hopped on a different Ubuntu server that I had running and got to work, here’s how to do it.

  1. Install Node.js – sudo apt-get install nodejs
  2. Install the Node Package Manager  – sudo apt-get install npm
  3. Install Meteor (not positive I needed to do this, but I did)  – curl https://install.meteor.com/ | sh
  4. Install Meteor Up – sudo npm install -g mup
  5. Make your deployment project folder and cd to it (this can be whatever you want to call it, for simplicity sake I named it the same as the app)
    1. mkdir plexrequests-meteor
    2. cd plexrequests-meteor
  6. Initialize your project, this should create mup.json and settings.json  – mup init
    1. If you get the error “ /usr/bin/env: node: No such file or directory ” then run the following command sudo ln -s /usr/bin/nodejs /usr/bin/node  and re-run mup init
  7. Grab your Meteor app (Plex Requests in this case) – sudo git clone https://github.com/lokenx/plexrequests-meteor.git
  8. Edit your mup.json file with the specific information for the server you are deploying to. (Note: The Location of app is the only thing that references the local server that you are deploying from, it’s the local location of the app that you are converting to node.js and deploying to your prod server) By default the NodeVersion referenced in mup.json is 0.10.36 and you need to change it to 0.10.40 if you’re running Meteor 1.2 or later. Here’s my mup.json file.
  9. Set up the server with Node.js, PhantomJS, MongoDB and configure the environment and Upstart – sudo mup setup
    1. If you get the error sudo: no tty present and no askpass program specified  then you need to connect to the server you are deploying to, run sudo visudo  and add <username> ALL=(ALL) NOPASSWD:ALL  to the end of the file and save it. Then re-run sudo mup setup .
  10. Convert the app and deploy it to your server – mup deploy
    1. I ran into the following error and was able to resolve it by running sudo chmod -R 777 plexrequests-meteor/ (my project folder)
  11. If you change any of the env settings in the mup.json file (you’ll see I switched the port from the default 80 back to 3000) or the settings.json file, you can run mup reconfig  to reconfigure the app without having to completely redeploy it.

Anyway, it was a bit of an extensive process and longer than it needed to be, I think, but as you may have noticed a hell of a lot of the heavy lifting is taken care of by Meteor Up. From there, like I said, go to /admin/ first and set up your admin login, copy your API keys from Couchpotato and Sonarr to set up the automation and you’re pretty much all set!

UPDATE

Little update for this one, since Plex Requests is a relatively new project there are lots of updates to the code (which is awesome, thanks lokenx for keeping this rolling). There’s not a lot out there on how to update this app when you’ve deployed using Meteor Up. So here’s the process to update Plex Requests through Meteor Up.

  1. Connect to your Meteor Up deployment server and navigate to your Plex Requests project directory. You should be able to recognize this directory because if you run ls while you are in it you should see three things: mup.json, plexrequests-meteor directory, settings.json.  Once you are there, delete (or move) your existing plexrequests-meteor directory and clone the Github project again.
  2. Then redeploy the project using the command mup deploy .

This will deploy the updated code and will actually keep all of your settings and requests in Plex Requests. Pretty straightforward and easy! I figured I’d give the update since there’s not a lot of info out there on whether you’ll lose settings, etc. by re-deploying.

 

Thanks to the following pages for helping me through this!

https://www.youtube.com/watch?v=WLGdXtZMmiI

http://www.hostingadvice.com/how-to/install-nodejs-ubuntu-14-04/

http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error

https://github.com/nodejs/node-v0.x-archive/issues/3911

http://stackoverflow.com/questions/33020787/meteor-unable-to-deploy-requires-node-v0-10-40-or-later

And of course thanks to arunoda and lokenx for creating Meteor Up and Plex Requests.

 

 

4.00 avg. rating (80% score) - 1 vote
Tagged with →