Code Monkey home page Code Monkey logo

trackpack's Introduction

trackpack

Lifecycle: experimental Travis build status

The goal of trackpack is to track my package ‘lazytrade’

Goal of this Repository

This repository was created using golem framework for developing Shiny App. Simple shiny app was developed as an R package.

Installation

This repository will not be released on CRAN. If it would, then it could be installed with:

install.packages("trackpack")

However it is possible to:

Pull and launch ready to use Docker Container with Shiny App trackpack

  1. Install/launch Docker Desktop
  2. Run in the Terminal: docker run -it --rm -p 80:80 vladdsm/docker-trackpack
  3. Launch Shiny App using http://0.0.0.0

Or, it is possible to fork or clone this repository and then:

Build R package to launch App locally

  1. Open the trackpack.Rproj file
  2. Load and build the package
  3. Launch application by running the code trackpack::run_app()

Build a Dockerfile and build Docker image locally

  1. Open script '/dev/03_deploy.R'
  2. Run code: golem::add_dockerfile() to build Dockerfile
  3. Build docker image in the terminal
  4. cd '/usr/trackpack/'
  5. docker build -t vladdsm/docker-trackpack . [or use different image name]
  6. Launch docker container with Shiny App (see above)

Launch Docker container using docker-compose

Example of docker-compose.yml file is available in the repository compose-example

  1. Clone code from the repository into the local folder
  2. Edit script Run_Shiny_Trackpack and replace local folder path. Well, also replace image name in case local image is available (see above how to build docker image locally)
  3. Launch script Run_Shiny_Trackpack (this will start container)
  4. Test ShinyApp in the browser http://0.0.0.0
  5. Stop container by launching Stop_Shiny_Trackpack or by executing docker-compose down in the Terminal

App ‘business logic’

This is a basic core code that is used to solve a common problem:

## business logic code
library(ggplot2)
library(cranlogs)
stats <- cran_downloads("lazytrade", from = Sys.Date() - 100, to = Sys.Date() - 1) 
#sum(stats$count)


ggplot(stats, aes(date, count)) + 
  geom_col() + 
  labs(
    title = sprintf(
      "{stats} downloads to %s", 
      Sys.Date() - 1
      ), 
    caption = "data from {cranlogs}"
  ) + 
  theme_minimal()

Continous Integration

Golem framework also containing ‘helper’ functions allowing to setup:

  • Version control in the repository
  • Use travis ci to test the package
  • Setup autobuilds on Dockerhub

This is creating possibility of ‘sustainable’ development. e.g. if new feature is needed, then:

  1. Create branch dev_feature1
  2. Implement changes, test locally
  3. Make a pull request
  4. Wait until the Travis test will be ok
  5. Join changes into Master Branch

Users may get a new version as soon as Docker autobuild will build updated image

Technical Comment

You’ll still need to render README.Rmd regularly, to keep README.md up-to-date.

In that case, don’t forget to commit and push the resulting figure files, so they display on GitHub!

Source

thinkr blog golem vignette

trackpack's People

Contributors

vladdsm avatar

Watchers

 avatar  avatar

Forkers

odapes

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.