Code Monkey home page Code Monkey logo

scott's Introduction

Scott

๐Ÿ’ผ The Podcast Manager

Badges

Build Status Code Climate Test Coverage

Contributing

Please consider reading our Contribution Guide before anything else.

Setup

It is expected to have already installed:

  • Ruby (rbenv/rvm)
  • ffmpeg (background audio analysis)
  • MongoDB
  • Redis
  • Docker (if you don't want to install Mongo/Redis)

If you are in a mac you can install the non-ruby or database dependencies by running brew bundle.

Run make install to install the dependencies and set the default environment variables.

Run make seed to add sample channels.

Environment variables

We are currently using Figaro to manage the environment variables.

The variables can be defined at config/application.yml and the default template setup with the list of all variables is available at config/application.default.yml.

The command make install already copies the default file template to config/application.yml.

Showtime

If you are using MongoDB locally, make sure it is already running, otherwise, if you are using docker, run make compose to start the Docker containers.

Finally, run make start to start the server.

The server will start at http://localhost:5000 by default.

To stop the docker compose daemon safely (without destroying the instances), use make decompose

To run the console, use make console

Admin Area

The application is using Rails Admin.

The admin area can be accessed at http://localhost:5000/admin by default.

Workers

We are now using sidekiq to manage our asynchronous jobs.

Sidekiq dashboard can be accessed at http://localhost:5000/admin/jobs by default.

Endpoints

  • GET /channels?page=N&per_page=Y - Returns the list of all channels
  • GET /channels/:slug - Returns the channel
  • GET /channels/:slug/episodes?page=N&per_page=Y - Returns the channel's episodes
  • GET /episodes?page=N&per_page=Y - Returns the list of all episodes
  • GET /episodes/:channel_slug/:episode_slug - Returns the specific episode
  • GET /episodes/:channel_slug/:episode_slug/next/:amount - Returns the queue of next episodes for the given one
  • GET /categories/:slug?page=N&per_page=Y - Returns the list of categories

scott's People

Contributors

hugoabonizio avatar joaocv3 avatar lpmi-13 avatar marceloboeira avatar marvin52 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

scott's Issues

Move indexer attributes to a query

Right now the indexer "query" is done on every request... it would be better to have it as a query...

Instead of

Episode.all.each do |episode|

if episde....

end
Episode.not_indexed.each do |episode|
...
end

where Episode.not_indexed is:

class Episode
  scope :not_indexed -> { where(indexed: nil).or(....) }
end
```

That improves the performance because it does not fetch all episodes from mongo to ruby's memory so it can run against the if-else.

(Add a mongo-index to `updated_at` && `indexed_at` so it can run faster)

Create a manual job to force indexing of all the episodes

Create a job that cleans the indexed_at attribute for all the episodes, forcing to clean.

That will come handy for migrations, new fields.

Remember to add it as recurring, but with a huge time interval, so we can disable it and run manually only:
screen shot 2017-09-11 at 08 26 11

Bug: Endpoint `/episodes` doesn't return total for page 1

I am having some strange behavior from the API. When I pass the page=1 it doesn't return the total.

Request URL:https://api.feedcast.io/episodes?page=1&per_page=30
Request Method:GET
Status Code:200  (from disk cache)
Remote Address:104.24.110.210:443
Referrer Policy:no-referrer-when-downgrade
Response Headers
access-control-allow-origin:*
access-control-expose-headers:total
cache-control:max-age=300, public
cf-ray:38c64c73e9f226b4-FRA
content-encoding:gzip
content-type:application/json
date:Thu, 10 Aug 2017 22:12:47 GMT
etag:W/"2b8bed4dd8afddd7ccb69ec17656afd3"
server:cloudflare-nginx
status:200
via:1.1 vegur
x-request-id:b8e255ff-28ca-40da-8a71-0869ba311937
x-runtime:0.022315

And passing a page to it:

Request URL:https://api.feedcast.io/episodes?page=2&per_page=30
Request Method:GET
Status Code:200  (from disk cache)
Remote Address:104.24.110.210:443
Referrer Policy:no-referrer-when-downgrade
Response Headers
access-control-allow-origin:*
access-control-expose-headers:total
cache-control:max-age=300, public
cf-ray:38c64ea5886026b4-FRA
content-encoding:gzip
content-type:application/json
date:Thu, 10 Aug 2017 22:14:17 GMT
etag:W/"55a845059d5108911ccb744467511178"
link:<http://api.feedcast.io/episodes?page=1&per_page=30>; rel="first", <http://api.feedcast.io/episodes?page=1&per_page=30>; rel="prev", <http://api.feedcast.io/episodes?page=519&per_page=30>; rel="last", <http://api.feedcast.io/episodes?page=3&per_page=30>; rel="next"
per-page:30
server:cloudflare-nginx
status:304
total:15557
via:1.1 vegur
x-request-id:f8b7e227-9e17-4053-938f-4426a4e393f9
x-runtime:0.256476

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.