diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml new file mode 100644 index 0000000..65bf1f2 --- /dev/null +++ b/.github/workflows/r.yml @@ -0,0 +1,22 @@ +name: Deploy EC2 +on: + push: + branches: + - master + pull_request: + types: [closed] +jobs: + merge-PR: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install SSH key + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.EC2_SSH_KEY }} + name: id_rsa + known_hosts: ${{ secrets.KNOWN_HOSTS }} + - name: rsync over ssh + run: ./deploy_to_aws.sh diff --git a/ClassifyData.R b/ClassifyData.R index deb46ca..b24c8cd 100644 --- a/ClassifyData.R +++ b/ClassifyData.R @@ -4,14 +4,14 @@ # Copyright (c) 2011, under the Creative Commons Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) License # For more information see: https://creativecommons.org/licenses/by-nc/3.0/ # All rights reserved. - - +# new addition +#cool # # Generate extra date cols # -generateExtraDateCols <- function(data, col.index) { - lMonths <- c("January","February","March", "April","May","June","July","August","September", "October","November","December") +generateExtraDateCols < function(data, col.index) + lMonths <- c("January","February","March", "April,"May","June","July","August","September", "October","November","December") lDays <- c("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday") #data$Day_generated=factor(weekdays(data[,col.index]), levels=lDays, ordered=TRUE) data$Day_g=factor(weekdays(data[,col.index]), levels=lDays) @@ -264,4 +264,4 @@ testClassification <- function() { # #`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/] - } \ No newline at end of file + } diff --git a/CreatePADS.R b/CreatePADS.R index 73040c0..9dec68d 100644 --- a/CreatePADS.R +++ b/CreatePADS.R @@ -75,10 +75,10 @@ loadStates <- function(){ # # Initialize Padification Process # -initializeSystem <- function(stack=0){ +initializeSystem <- function(stack=0{ # turn off scientific formatting - getOption("scipen") - options(scipen=999) + options(scipen=999; # day and months facors lMonths <- c("January","February","March", "April","May","June","July","August","September", "October","November","December") @@ -87,7 +87,7 @@ initializeSystem <- function(stack=0){ assign("lDays", lDays, envir=.GlobalEnv) #loadStates - loadStates() + loadStates( #initialize solr docs #assign("solr.index.docs", list(), envir=.GlobalEnv) @@ -278,4 +278,4 @@ padify <- function(series, series.data, x.plot.band=NULL, y.plot.band=NULL){ # "subcategory"=pmd$subcategory, "tags"=pmd$tags, "author"="system") # solr.index.docs[[length(solr.index.docs)+1]] <<- doc } -} \ No newline at end of file +} diff --git a/DefaultChartForPAD.R b/DefaultChartForPAD.R index 15c87a8..1f994fe 100644 --- a/DefaultChartForPAD.R +++ b/DefaultChartForPAD.R @@ -16,7 +16,7 @@ # Get default info for pad # getDefault <- function(){ - return(list(dim="", mea="", size="", yaxis=list(), xaxis=list(), chart=list())) + return(list(dim="", mea="", size="", yaxis=list(), xaxis=list(), chart=list()) } # diff --git a/FetchData/FetchBeerRatings.R b/FetchData/FetchBeerRatings.R index 174a726..f8a587f 100644 --- a/FetchData/FetchBeerRatings.R +++ b/FetchData/FetchBeerRatings.R @@ -7,7 +7,7 @@ # For more information see: https://creativecommons.org/licenses/by-nc/3.0/ # All rights reserved. require(data.table) -startup <- function() { +startup <- function( { #initialize system initializeSystem(0) @@ -43,4 +43,4 @@ setkey(beer.data, beer_beerid) b.d.500 <- beer.data[, list(no_of_reviews=nrow(.SD)), by=beer_beerid][no_of_reviews >= 500] setkey(b.d.500, beer_beerid) #merge to get all records ofbeers which have 500 or more reviews -b.d.500 <- merge(b.d.500, beer.data, all=F) \ No newline at end of file +b.d.500 <- merge(b.d.500, beer.data, all=F) diff --git a/deploy_to_aws.sh b/deploy_to_aws.sh new file mode 100644 index 0000000..4cb22dc --- /dev/null +++ b/deploy_to_aws.sh @@ -0,0 +1,10 @@ +#!/bin/bash +echo 'Starting to Deploy...' +ssh ubuntu@3.234.99.37 -i ~/.ssh/id_rsa " sudo docker image prune -f + cd /newstorage/users/sujay/R_check + sudo docker-compose down + git fetch origin + git reset --hard origin && echo 'You are doing well' + sudo docker-compose build && sudo docker-compose up -d + " +echo 'Deployment completed successfully'