Skip to content

Commit

Permalink
Release v0.2.0 (#11)
Browse files Browse the repository at this point in the history
* Fix app source and connected users count

* Fix instance phasing out and stopping

* Fix random auth token secret

* Document and setup CodeQL analysis
  • Loading branch information
martinv13 authored Jan 27, 2022
1 parent 7510e66 commit 829a78d
Show file tree
Hide file tree
Showing 16 changed files with 332 additions and 176 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '32 15 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
2 changes: 1 addition & 1 deletion .github/workflows/release-dry-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
-
name: Run GoReleaser dry run
uses: goreleaser/goreleaser-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.16.x, 1.17.x]
go-version: [1.17.x]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
Expand Down
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Martin Vergier

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,31 @@ AppservR allows deploying R Shiny applications easily on your server. Distribute

Under the hood, AppservR manages several instances of your apps, using Rscript executable, and proxy requests from your users to these instances.

This project is not suited for production use yet and is in active development. Pre-prod releases can be found on the [releases page](https://github.com/appservR/appservR/releases).

## Features

As R is a single-process software, deploying R apps often requires third-party software to allow dealing with multiple clients at the same time. AppservR achieves this with a ready-to-use, cross platform binary with no dependencies. It aims at simplicity, while not giving up on performance. Its distinctive features compared to other solutions are the following:
As R is a single-process software, deploying R apps often requires third-party software to allow dealing with multiple clients at the same time. AppservR achieves this with a ready-to-use, cross-platform binary with no dependencies. It aims at simplicity, while not giving up on performance. Its distinctive features compared to other solutions are the following:

* **Cross platform**: written in the Go programming language, it runs on every platform R runs on,
* **Cross platform**: written in the Go programming language, it runs on most platforms (compiled versions available for Windows and Linux),
* **No dependencies**: AppservR does not require Java, Docker or other dependency; it ships as a standalone binary which simply runs your apps using the Rscript executable from your R installation and proxy client requests accordingly,
* **Authentication**: built in authentication to restrict access to specific apps or customize user experience,
* **Unlimited apps**: you can run as many apps as you wish on different paths, including nested paths (i.e. for instance "/" and "/myapp" and "/myapp/private"),
* **Hot config**: you can configure your apps through a web interface without restarting the server, which means that you do not need admin permissions on the server to add or update a Shiny app, but only a AppservR admin account.

## Install

No prod release is available yet (coming soon).
* Download the latest release for your platform from the [releases](https://github.com/appservR/appservR/releases/latest) page.
* Extract the downloaded archive at a location of your choice.
* Run the executable.
* Navigate to `http://localhost:8080` to see a demo Shiny app running!

Please check out our [Documentation website](https://appservR.github.io) for more details.

## What is Shiny anyway?

[Shiny](https://shiny.rstudio.com/) is an amazing R package created and maintained primarily by [Rstudio](https://rstudio.com) to build interactive web applications with the R programming language. It is more flexible than most BI softwares, and much easier to set up compared to a "complete" web app (backend + frontend). Also, it is free and open-source. Whether you want to build simple business dashboards or full-featured data apps, Shiny is probably worth looking at.
[Shiny](https://shiny.rstudio.com/) is an amazing R package created and maintained primarily by [Rstudio](https://rstudio.com) to build interactive web applications with the R programming language. It is more flexible than most BI software, and much easier to set up compared to a "complete" web app (backend + frontend). Also, it is free and open-source. Whether you want to build simple business dashboards or full-featured data apps, Shiny is probably worth looking at.

## Alternatives

[Rstudio](https://rstudio.com) offer professional solutions to Shiny apps deployment (no free version for multi-process server however).
[ShinyProxy](https://www.openanalytics.eu/tags/shinyproxy/) is an other open-source solution with a different approach as it runs a new Shiny app instance in a new Docker container for every client of your app.
[Rstudio](https://rstudio.com) offer professional solutions to Shiny apps' deployment (no free version for multi-process server however).

[ShinyProxy](https://www.openanalytics.eu/tags/shinyproxy/) is another open-source solution with a different approach as it runs a new Shiny app instance in a new Docker container for every client of your app.
21 changes: 15 additions & 6 deletions controllers/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/appservR/appservR/models"
"github.com/appservR/appservR/modules/appserver"
"github.com/appservR/appservR/modules/appsource"
"github.com/appservR/appservR/modules/config"
"github.com/gin-gonic/gin"
)
Expand All @@ -18,6 +19,7 @@ type AppController struct {
config config.Config
}

// Create a new controller object
func NewAppController(appModel models.AppModel, appServer *appserver.AppServer, config config.Config) *AppController {
return &AppController{
appModel: appModel,
Expand Down Expand Up @@ -60,12 +62,14 @@ func (ctl *AppController) GetApp() gin.HandlerFunc {
}
}

// Form bindings for apps settings
type AppSettings struct {
Name string `form:"appname" binding:"required"`
Path string `form:"path" binding:"required"`
Properties []string `form:"properties[]"`
RestrictAccess int `form:"restrictaccess"`
AllowedGroups []string `form:"allowedgroups"`
AppSource string `form:"appsource"`
AppDir string `form:"appdir"`
Workers int `form:"workers"`
}
Expand All @@ -92,19 +96,24 @@ func (ctl *AppController) UpdateApp() gin.HandlerFunc {
app := models.App{
Name: appInfo.Name,
Path: appInfo.Path,
AppSource: appInfo.AppSource,
AppDir: appInfo.AppDir,
Workers: appInfo.Workers,
IsActive: isActive,
RestrictAccess: appInfo.RestrictAccess,
AllowedGroups: groups,
}
err = ctl.appModel.Save(app, appname)
appSource := appsource.NewAppSource(app, ctl.config, true)
err = appSource.Error()
if err == nil {
ctl.appServer.Update(appname, app)
res, err = ctl.buildAppTemplateData(app, c)
res["successMessage"] = "App updated successfuly."
c.HTML(http.StatusOK, "app.html", res)
return
err = ctl.appModel.Save(app, appname)
if err == nil {
ctl.appServer.Update(appname, app)
res, err = ctl.buildAppTemplateData(app, c)
res["successMessage"] = "App updated successfuly."
c.HTML(http.StatusOK, "app.html", res)
return
}
}
}
res = make(gin.H)
Expand Down
58 changes: 45 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,25 +1,57 @@
module github.com/appservR/appservR

go 1.15
go 1.17

require (
github.com/gin-gonic/gin v1.7.7
github.com/go-playground/validator/v10 v10.9.0 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/subcommands v1.2.0 // indirect
github.com/google/wire v0.5.0
github.com/jinzhu/now v1.1.4 // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/kardianos/service v1.2.0
github.com/kardianos/service v1.2.1
github.com/satori/go.uuid v1.2.0
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.10.0
github.com/ugorji/go v1.2.6 // indirect
golang.org/x/crypto v0.0.0-20211209193657-4570a0811e8b // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/tools v0.1.8 // indirect
github.com/spf13/cobra v1.3.0
github.com/spf13/viper v1.10.1
gorm.io/driver/sqlite v1.2.6
gorm.io/gorm v1.22.4
gorm.io/gorm v1.22.5
)

require (
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/subcommands v1.0.1 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.4 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/magiconair/properties v1.8.5 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.9 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.4 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749 // indirect
github.com/spf13/afero v1.6.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect
golang.org/x/mod v0.5.0 // indirect
golang.org/x/sys v0.0.0-20211210111614-af8b64212486 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/tools v0.1.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading

0 comments on commit 829a78d

Please sign in to comment.