Setting Up PlexRequests Using Meteor Up
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 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)
path.js:360 throw new TypeError('Arguments to path.join must be strings'); ^ TypeError: Arguments to path.join must be strings at path.js:360:15 at Array.filter (native) at Object.exports.join (path.js:358:36) at Object.pathJoin (/home/mike/.meteor/packages/meteor-tool/.1.3.2_4.10vjkl$ at defaultWarehouseDir (/tools/packaging/tropohouse.js:35:16) at Object.<anonymous> (/tools/packaging/tropohouse.js:40:42) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12)
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.
- Install Node.js – sudo apt-get install nodejs
- Install the Node Package Manager – sudo apt-get install npm
- Install Meteor (not positive I needed to do this, but I did) – curl https://install.meteor.com/ | sh
- Install Meteor Up – sudo npm install -g mup
- 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)
- mkdir plexrequests-meteor
- cd plexrequests-meteor
- Initialize your project, this should create mup.json and settings.json – mup init
- 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
- Grab your Meteor app (Plex Requests in this case) – sudo git clone https://github.com/lokenx/plexrequests-meteor.git
- 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.
{ // Server authentication info "servers": [ { "host": "10.10.10.10", "username": "mike", "password": "password" // or pem file (ssh based authentication) //"pem": "~/.ssh/id_rsa" } ], // Install MongoDB in the server, does not destroy local MongoDB on future setup "setupMongo": true, // WARNING: Node.js is required! Only skip if you already have Node.js installed on server. "setupNode": true, // WARNING: If nodeVersion omitted will setup 0.10.36 by default. Do not use v, only version number. "nodeVersion": "0.10.40", // Install PhantomJS in the server "setupPhantom": true, // Show a progress bar during the upload of the bundle to the server. // Might cause an error in some rare cases if set to true, for instance in Shippable CI "enableUploadProgressBar": true, // Application name (No spaces) "appName": "plexrequests-meteor", // Location of app (local directory) "app": "/home/mike/plexrequests-meteor/plexrequests-meteor", // Configure environment "env": { "PORT": 3000, "ROOT_URL": "http://10.10.10.10" }, // Meteor Up checks if the app comes online just after the deployment // before mup checks that, it will wait for no. of seconds configured below "deployCheckWaitTime": 15 }
- Set up the server with Node.js, PhantomJS, MongoDB and configure the environment and Upstart – sudo mup setup
- 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 .
- Convert the app and deploy it to your server – mup deploy
- I ran into the following error and was able to resolve it by running sudo chmod -R 777 plexrequests-meteor/ (my project folder)
/home/mike/.meteor/packages/meteor-tool/.1.1.10.1ve9rny++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:278 throw(ex); ^ Error: EACCES, mkdir '/home/mike/plexrequests-meteor/plexrequests-meteor/.meteor/local' at Object.Future.wait (/home/mike/.meteor/packages/meteor-tool/.1.1.10.1ve9rny++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/lib/node_modules/fibers/future.js:398:15) at /tools/fs/files.js:1331:28 at Object.wrapper [as mkdir] (/tools/fs/files.js:1334:20) at Object.files.mkdir_p (/tools/fs/files.js:405:11) at Object.files.mkdir_p (/tools/fs/files.js:395:23) at [object Object]._.extend.buildLocalPackages (/tools/isobuild/isopack-cache.js:64:13) at /tools/project-context.js:735:25 at /tools/utils/buildmessage.js:356:18 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at /tools/utils/buildmessage.js:349:34 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at /tools/utils/buildmessage.js:347:23 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at Object.enterJob (/tools/utils/buildmessage.js:321:26) at ProjectContext._.extend._buildLocalPackages (/tools/project-context.js:734:18) at /tools/project-context.js:257:35 at /tools/utils/buildmessage.js:356:18 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at /tools/utils/buildmessage.js:349:34 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at /tools/utils/buildmessage.js:347:23 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at Object.enterJob (/tools/utils/buildmessage.js:321:26) at ProjectContext._.extend._completeStagesThrough (/tools/project-context.js:247:18) at ProjectContext._.extend.saveChangedMetadata (/tools/project-context.js:235:10) at ProjectContext._.extend.prepareProjectForBuild (/tools/project-context.js:240:10) at /tools/cli/commands.js:838:20 at /tools/utils/buildmessage.js:268:13 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at /tools/utils/buildmessage.js:261:29 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at /tools/utils/buildmessage.js:259:18 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at /tools/utils/buildmessage.js:250:23 at [object Object]._.extend.withValue (/tools/utils/fiber-helpers.js:114:14) at Object.capture (/tools/utils/buildmessage.js:249:19) at Object.main.captureAndExit (/tools/cli/main.js:270:29) at buildCommand (/tools/cli/commands.js:837:8) at Command.main.registerCommand._.extend.name [as func] (/tools/cli/commands.js:791:12) at /tools/cli/main.js:1378:23 - - - - - => Build Error. Check the logs printed above.
- I ran into the following error and was able to resolve it by running sudo chmod -R 777 plexrequests-meteor/ (my project folder)
- 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.
- 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.
sudo rm -rf plexrequests-meteor sudo git clone https://github.com/lokenx/plexrequests-meteor.git
- 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.
UPDATE #2
It seems that I should have done a some more digging before I went through and deployed the Meteor fork of this tool. It was a great learning experience for me (and made a cool post) but I was recently introduced to Ombi – which is actually built from the same source as Plex Requests (either they were forked off of the same source or one forked from the other). Anyway, I’m glad that they wrote Plex Requests for those that want to deploy using Meteor, but Ombi is a much better fit for me, easier to deploy and update, as well as quite a bit more polished than Plex Requests. Anyway I definitely recommend everyone take a look at Ombi! (https://ombi.io/)
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/
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.
Recent Comments