Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.

Commit

Permalink
Merge pull request #87 from scytherswings/dev
Browse files Browse the repository at this point in the history
Push v0.12.0 to master!
  • Loading branch information
scytherswings committed Apr 15, 2017
2 parents 216f630 + 1fe3ba9 commit a914a79
Show file tree
Hide file tree
Showing 37 changed files with 362 additions and 587 deletions.
10 changes: 6 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
.git
.dockerignore
config/secrets.yml
coverage
.bundle
tmp
public/images
coverage/
.bundle/
tmp/
public/images/
public/assets/
test/
log/*
db/*.sqlite3
server_config.yml
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,31 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [v0.12.0] : 2017-4-15
### Changed
- __!!!IMPORTANT!!!__ \
The `server_config.yml` file has changed formats. You will need to delete the one you have
in order to consume this update!
- The new format makes more sense and has better descriptions along with examples.
- [update.sh](update.sh) was changed so you'll need to do a `git pull` before you run it. \
This is because `update.sh` cannot manipulate itself while it is running. I will figure out something more
graceful in the future.
- If you have issues you might need to do a `git reset --hard` to get your local changes back to an update-able state.
- Overhauled the overhauled scripts again. They now provide better support for windows.
- Added `set -e` to all of the scripts so they will stop if any errors occur.

### Added
- Docker support is here!
- You can find the container [here](https://hub.docker.com/r/scytherswings/plex-board/).
- Docker is the preferred deployment strategy on Windows systems as it resolves all of the
cross-platform issues.
- See the install guide [here](https://github.com/scytherswings/Plex-Board/wiki/Plex-Board-Docker-Installation-Guide).


## [v0.11.0] : 2017-4-6
### Changed
- Major overhaul to the `bash` scripts.
- `runServer.sh` was renamed to `startServer.sh`
- `runServer.sh` was renamed to [startServer.sh](startServer.sh)
- All scripts will try to run in the directory in which they are located so they should
be safe to call from anywhere.
- The server now defaults to running as a daemon! This means you don't have to leave
Expand Down
36 changes: 18 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
# Base our image on an official, minimal image of our preferred Ruby
FROM ruby:2.3.4-slim

ENV RAILS_ROOT /var/www/plexdashboard
ENV RAILS_ROOT /app
ENV RAILS_ENV production
# Install essential Linux packages
RUN apt-get update -qq && apt-get install -y \
bundler \
nodejs \
curl \
libsqlite3-dev \
git \
&& rm -rf /var/lib/apt/lists/*

ENV DOCKER true
ENV LOG_TO_STDOUT true

# Create application home. App server will need the pids dir so just create everything in one shot
RUN mkdir -p $RAILS_ROOT/tmp/pids
# Install essential Linux packages
RUN apt-get update -qq \
&& apt-get install -y \
bundler \
nodejs \
libsqlite3-dev \
&& rm -rf /var/lib/apt/lists/*

# Set our working directory inside the image
RUN mkdir $RAILS_ROOT
WORKDIR $RAILS_ROOT

# Use the Gemfiles as Docker cache markers. Always bundle before copying app src.
Expand All @@ -27,18 +26,19 @@ COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock

# Prevent bundler warnings; ensure that the bundler version executed is >= that which created Gemfile.lock
RUN gem install bundler

# Finish establishing our Ruby enviornment
RUN bundle install --binstubs --without development test
RUN gem install bundler rake \
&& bundle install --jobs=5 --without development test \
&& bundle clean --force

# Copy the Rails application into place
COPY . .

RUN /var/www/plexdashboard/serverSetup.sh >> /tmp/bullshit.txt
RUN $RAILS_ROOT/serverSetup.sh

EXPOSE 3000

# Define the script we want run once the container boots
# Use the "exec" form of CMD so our script shuts down gracefully on SIGTERM (i.e. `docker stop`)
CMD exec bundle exec puma -C config/docker-puma.rb config.ru
CMD exec bundle exec puma -e production -C $RAILS_ROOT/config/puma.rb $RAILS_ROOT/config.ru

VOLUME $RAILS_ROOT/db/
5 changes: 2 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ gem 'bootstrap-sass', '~> 3.3.7'
gem 'sprockets-rails', '~> 3.2.0'
gem 'simple_form', '~> 3.4.0'
gem 'strip_attributes', '~> 1.8.0'
gem 'puma', '~> 3.8.2'
gem 'rest-client', '~> 2.0.1'
gem 'json', '~> 1.8.6'
gem 'sass', '~> 3.4.23'
Expand All @@ -26,7 +25,7 @@ gem 'geocoder', '~> 1.4.3'
gem 'tzinfo', '~> 1.2.3'
gem 'tzinfo-data'
gem 'lograge', '~> 0.4.1'
gem 'browserlog', git: 'https://github.com/scytherswings/browserlog'
# gem 'browserlog', git: 'https://github.com/scytherswings/browserlog'

group :development, :test do
gem 'spring', '~> 2.0.1'
Expand Down Expand Up @@ -56,5 +55,5 @@ group :test do
end

group :production do

gem 'puma', '~> 3.8.2'
end
9 changes: 0 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
GIT
remote: https://github.com/scytherswings/browserlog
revision: 7b4eabc2649b1514a096f55f37f918814444a671
specs:
browserlog (0.0.3)
jquery-rails (>= 3)
rails (>= 3.2.18)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -233,7 +225,6 @@ PLATFORMS
DEPENDENCIES
autoprefixer-rails (~> 6.7.7.1)
bootstrap-sass (~> 3.3.7)
browserlog!
coffee-rails (~> 4.2.1)
coveralls (~> 0.8.20)
execjs (~> 2.7.0)
Expand Down
62 changes: 32 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# Plex-Board
## Version 0.11.0
## Version 0.12.0


[![Build Status](https://travis-ci.org/scytherswings/Plex-Board.svg?branch=master)](https://travis-ci.org/scytherswings/Plex-Board)
[![Coverage Status](https://coveralls.io/repos/scytherswings/Plex-Board/badge.svg?branch=dev&service=github)](https://coveralls.io/github/scytherswings/Plex-Board?branch=dev)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scytherswings/Plex-Board?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
[![Coverage Status](https://coveralls.io/repos/scytherswings/Plex-Board/badge.svg?branch=master&service=github)](https://coveralls.io/github/scytherswings/Plex-Board?branch=master)
[![Gitter](https://badges.gitter.im/scytherswings/Plex-Board.svg)](https://gitter.im/scytherswings/Plex-Board?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=B6MNRRPVZ34TN)

What is Plex-Board? Put simply, it is a dynamic dashboard for checking the status of multiple services related
to Plex Media Server (Plex, Couchpotato, Sickrage, Deluge, Sabnzbd+, etc.).

This is essentially a revamp of a cool project ([Network-Status-Page](https://github.com/scytherswings/Network-Status-Page)) I forked a little while ago.

Pronounced "Plex Dashboard" like that ghetto name [La-a](http://www.urbandictionary.com/define.php?term=la-a) (La Dash A)... sorry...
Pronounced "Plex *dash* board" like that ghetto name [La-a](http://www.urbandictionary.com/define.php?term=la-a) (La *dash* A)... sorry...

Just for clarification, yes this is _another_ Plex dashboard, but this project is _different_ and I'll tell you why.

[PlexWatchWeb](https://github.com/ecleese/plexWatchWeb) and [PlexPy](https://github.com/JonnyWong16/plexpy)
are projects oriented more towards statistics etc. \
are projects oriented more towards statistics etc.

__Plex-Board__ is meant to help the users **and** administrators of a Plex server get a quick overview on the
status of the various services related to, and including Plex itself.
There's a large list of features I plan to support in the future and I take all requests into consideration.
If there is something you'd like to see, feel free to chat about it on
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scytherswings/Plex-Board?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
, or create a feature request ticket.
[Gitter](https://gitter.im/scytherswings/Plex-Board?utm_source=share-link&utm_medium=link&utm_campaign=share-link), or create a feature request ticket.


Here are a few screenshots of v0.4.2 (the last major UI update):
Expand All @@ -43,25 +43,20 @@ You should have enough space to allow logs and an image cache, so I wouldn't rec

Rails can probably run on 512MB of RAM fine and CPU usage will vary. You can probably get away with a single core, but dual core may run smoother.

It will run on the original Raspberry Pi which is pretty neat.


## Install Instructions
##### Development branch status:
It will run on the original Raspberry Pi B+ which is pretty neat.

[![Build Status](https://travis-ci.org/scytherswings/Plex-Board.svg?branch=dev)](https://travis-ci.org/scytherswings/Plex-Board)

### This project is not ready for real production use yet, so don't expect stability until a 1.0.0 release.
Then when things break you can yell at me and use this readme as an excuse
## Installation Instructions

#### Other supported operating systems:
#### Other supported systems:

[Plex-Board Wiki Homepage](https://github.com/scytherswings/Plex-Board/wiki)
* [Plex-Board Wiki Homepage](https://github.com/scytherswings/Plex-Board/wiki)
* [Docker!!!](https://github.com/scytherswings/Plex-Board/wiki/Plex-Board-Docker-Installation-Guide)

##### Ubuntu 16.04 LTS
### Ubuntu 16.04 LTS

These instructions have been tested on a fresh install of Ubuntu 16.04 using bash as of 4/7/2017.
Other operating systems will probably work, but for now I'm only going to write instructions for Ubuntu.
These instructions have been tested on a fresh install of Ubuntu 16.04 LTS using `bash` as of 4/7/2017 on
[v0.11.0](https://github.com/scytherswings/Plex-Board/releases/tag/v0.11.0).

1. `sudo apt-get update && sudo apt-get install git bundler nodejs curl -y;`

Expand All @@ -71,7 +66,7 @@ Other operating systems will probably work, but for now I'm only going to write
3. `source /usr/local/rvm/scripts/rvm`

4. `cd /opt` \
Now at this point, you might have to give your user write permissions to this directory.
You might have to give your user write permissions to this directory.
If that is the case run: \
`sudo chmod 777 /opt -R`

Expand All @@ -86,8 +81,7 @@ Now at this point, you might have to give your user write permissions to this di
or reboot with: \
`sudo reboot` \
Start at the next step if you choose to reboot.
Also, installing ruby could take a while if it has to compile from source.
It should be about 1 beer long.
Also, installing ruby could take a while if it has to compile from source, about 1 beer.

7. `cd /opt/Plex-Board`

Expand All @@ -99,27 +93,35 @@ If you're not running behind a reverse proxy then you shouldn't need to touch th
10. __Plex-Board__ should now be installed!

## Running Instructions
1. `./startServer.sh` \
If you use RVM you'll need to make sure you use the gemset that
we set up earlier each time you run the server.
This way you will isolate Plex-Board dependencies from the rest of your system.

1. `./startServer.sh` \
If you get an error that looks like:\
...`Address family not supported by protocol - socket(2) for "::1" port 3000 (Errno::EAFNOSUPPORT)`\
You can either disable IPv6 for your OS or edit the `server_config.yml` to use a specific IP address on your system e.g. \
`http://192.168.0.102:3000` \
`192.168.0.102` \
See the `server_config.yml` file for more details.

2. `./stopServer.sh` will stop the server.


Auto-start instructions coming soon.

## Updating Instructions
1. Stop the service. On \*nix you can use `./stopServer.sh`

1. `./update.sh` Will run `git pull` and `serverSetup.sh` for you.


## If you have issues
1. Read the [CHANGELOG.md](CHANGELOG.md) to make sure you haven't missed any important changes! \
I try to keep breaking changes to a minimum but sometimes it just isn't possible.
Any time this happens the changelog will detail what the change is and how to fix it.

### This project is not ready for real production use yet, so don't expect stability until a 1.0.0 release.
Then when things break you can yell at me and use this readme as an excuse.

### Feedback
If you run into any bugs, please, make a ticket or ask in the
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scytherswings/Plex-Board?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge)
[Gitter](https://gitter.im/scytherswings/Plex-Board?utm_source=share-link&utm_medium=link&utm_campaign=share-link)
chat room.
I'm sure I'll miss something in my testing so feel free to let me know what I overlooked.
Since I work on this project in my free time, I can't always respond to chats immediately but I'll do the best I can to get back to you within the day.
2 changes: 1 addition & 1 deletion app/assets/javascripts/notification_handler.js.coffee.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"<% require 'yaml' %>"
# Yes, this will blow up if server_config.yml doesn't exist. Sucks to suck. RTFM
source = new EventSource("<%= (YAML.load_file('server_config.yml')['relative_root'] || '') + '/notifications' %>")
source = new EventSource("<%= (YAML.load_file(Rails.root.join 'server_config.yml')['relative_root'] || '') + '/notifications' %>")

########### Service Online Status ############

Expand Down
17 changes: 0 additions & 17 deletions app/assets/stylesheets/application.css

This file was deleted.

4 changes: 4 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
@import "bootstrap-sprockets";
@import "bootstrap";
@import "carousel";
@import "custom";
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
@import "bootstrap-sprockets";
@import "bootstrap";

html, body {
height: 100%;
}
Expand Down
3 changes: 0 additions & 3 deletions app/assets/stylesheets/info.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/notifications.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/plex_services.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/services.scss

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/stylesheets/weather.scss

This file was deleted.

9 changes: 4 additions & 5 deletions app/models/plex_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PlexObject < ActiveRecord::Base
validates_presence_of :thumb_url

@@images_dir = 'public/images'
DEFAULT_IMAGE_PATH = 'test/fixtures/images'
DEFAULT_IMAGE_PATH = 'public/'
#TODO Configure placeholder image
DEFAULT_IMAGE = 'placeholder.png'

Expand Down Expand Up @@ -112,21 +112,20 @@ def fetch_image

imagefile = "#{@@images_dir}/#{self.id}.jpeg"

#TODO: Add control for timeouts
begin
tries ||= 1
File.open(imagefile, 'wb') do |f|
f.write(RestClient::Request.execute(method: :get, url: "#{connection_string}#{self.thumb_url}",
headers: headers, verify_ssl: OpenSSL::SSL::VERIFY_NONE,
timeout: 2, open_timeout: 2))
end
rescue Errno::ENOENT, RestClient::NotFound, RestClient::Exceptions::Timeout, RestClient::Exceptions::OpenTimeout
rescue => e
if (tries -= 1) >= 0
logger.warn {"An error occurred trying to fetch an image for plex_object: #{id}. Will retry #{tries} more time(s). Error: #{e}"}
create_default_image_directory
retry
end

logger.error "There was a problem opening the image file: #{imagefile} for write-binary mode. Returning placeholder.png"
logger.error "There was a problem fetching or writing the image file: #{imagefile}. Returning placeholder.png. Error: #{e}"
return DEFAULT_IMAGE
end
self.update!(image: "#{self.id}.jpeg")
Expand Down

0 comments on commit a914a79

Please sign in to comment.