Skip to content

jrosell/ambhtmx

Repository files navigation

Lifecycle: experimental

THIS IS A WORK IN PROGRESS, DO NOT USE

ambhtmx

Build a Full-stack R App with ambiorix and htmx.

Installation

You can install all the requeriments to run the examples:

if(!"rlang" %in% installed.packages()){
  if(!interactive()) { stop("The package \"rlang\" is required.") }
  cat("The package \"rlang\" is required.\n✖ Would you like to install it?\n\n1: Yes\n2: No\n\nSelection:")  
  if (readLines(n = 1) == "1"){
      install.packages("rlang")
  }  
}
rlang::check_installed("remotes")
remotes::install_github("jrosell/ambhtmx", force = 1)
rlang::check_installed("ambiorix", action = \(pkg, ... ) remotes::install_github("devOpifex/ambiorix"))
rlang::check_installed("scilis", action = \(pkg, ... ) remotes::install_github("devOpifex/scilis"))
rlang::check_installed("signaculum", action = \(pkg, ... ) remotes::install_github("devOpifex/signaculum"))
rlang::check_installed("tidyverse")
rlang::check_installed("zeallot")
rlang::check_installed("glue")
rlang::check_installed("htmltools")
rlang::check_installed("this.path")

Furthermore, you may want to create a .Renviron file with the following variables:

AMBHTMX_USER=<your user>
AMBHTMX_PASSWORD=<your password>
AMBHTMX_SECRET=<a secret key to make cookies safer>
GITHUB_PAT=<an optional token to install github repos safely>
AMBHTMX_PROTOCOL=<default http but you may want to use https>
AMBHTMX_HOST=<to change host default 127.0.0.1>
AMBHTMX_PORT=<to change port default 3000>
R_SHARE_DIR=/usr/share/R/share/ # change it if required

Code examples

example

example

example

example

example

example

example

example

example

example

example

Deployment examples

If you create a Dockerfile you can deploy your ambhtmx app to HuggingFace Spaces, Digital Ocean, Google Cloud, etc.

I deployed some examples:

If you want to deploy yours, when creating your user and space in HuggingFace Spaces for your repo, select a blank Dockerfile:

huggingface-spaces-Dockerfile

Troubleshooting

Known issues:

  • Are you trying to autenticate from 0.0.0.0 host? Cookies don't work from 0.0.0.0 host, try 127.0.0.1 or a domain name instead (/etc/hosts or DNS).
  • Are you trying an app without including all the required packages in the Dockerfile? Please, check the logs and edit the Dockerfile and try again. It could be that Github API have reach the limit. You need to configure the environment variable GITHUB_PAT.

Another issue? Please, let me know.

About

Build a Full-stack R App with ambiorix and htmx.

Resources

License

Stars

Watchers

Forks

Languages