The goal of trackpack is to track my package ‘lazytrade’
This repository was created using golem framework for developing Shiny App. Simple shiny app was developed as an R package.
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:
- Install/launch Docker Desktop
- Run in the Terminal:
docker run -it --rm -p 80:80 vladdsm/docker-trackpack
- Launch Shiny App using
http://0.0.0.0
Or, it is possible to fork or clone this repository and then:
- Open the trackpack.Rproj file
- Load and build the package
- Launch application by running the code
trackpack::run_app()
- Open script
'/dev/03_deploy.R'
- Run code:
golem::add_dockerfile()
to build Dockerfile - Build docker image in the terminal
cd '/usr/trackpack/'
docker build -t vladdsm/docker-trackpack .
[or use different image name]- Launch docker container with Shiny App (see above)
Example of docker-compose.yml file is available in the repository compose-example
- Clone code from the repository into the local folder
- 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) - Launch script
Run_Shiny_Trackpack
(this will start container) - Test ShinyApp in the browser
http://0.0.0.0
- Stop container by launching
Stop_Shiny_Trackpack
or by executingdocker-compose down
in the Terminal
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()
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:
- Create branch dev_feature1
- Implement changes, test locally
- Make a pull request
- Wait until the Travis test will be ok
- Join changes into Master Branch
Users may get a new version as soon as Docker autobuild will build updated image
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!