Skip to content

Commit

Permalink
release 2.0: scala, R
Browse files Browse the repository at this point in the history
  • Loading branch information
bluxmit committed May 16, 2022
1 parent 966680a commit 22a31f0
Show file tree
Hide file tree
Showing 34 changed files with 1,206 additions and 0 deletions.
50 changes: 50 additions & 0 deletions workspaces/r-workspace/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0

FROM ${docker_registry}/base-workspace:${image_tag}
USER root

COPY mkdocs /home/docs
COPY docs/getting-started.md /home/docs/docs/getting-started.md
COPY supervisord-rstudio.conf /etc/supervisord/

### R
ENV R_VERSION=4.2.0 \
R_HOME=/usr/local/lib/R \
TZ=Etc/UTC \
CRAN=https://packagemanager.rstudio.com/cran/__linux__/focal/latest \
LANG=en_US.UTF-8 \
S6_VERSION=v2.1.0.2 \
RSTUDIO_VERSION=2022.02.2+485 \
DEFAULT_USER=abc \
PANDOC_VERSION=default \
RSTUDIO_SERVER_HOST=0.0.0.0

ENV PATH=/usr/local/bin/:$PATH
ENV PATH=/usr/lib/rstudio-server/bin:$PATH

RUN cd /tmp && git clone https://github.com/rocker-org/rocker-versioned2.git \
&& mv /tmp/rocker-versioned2/scripts /rocker_scripts \
&& bash /rocker_scripts/install_R_source.sh \
&& bash /rocker_scripts/setup_R.sh \
&& mkdir /var/log/rstudio \
&& bash /rocker_scripts/install_rstudio.sh \
&& rstudio-server stop || true \
&& echo "------------------------------------------------------ user" \
&& chown -R abc /etc/rstudio \
&& chown -R abc /usr/lib/rstudio-server \
&& chown -R abc /var/lib/rstudio-server \
&& chown -R abc /var/log/rstudio \
&& chown -R abc /usr/local/lib/R \
&& mkdir /home/abc/.rserver && chown -R abc /home/abc/.rserver \
&& find /home -type d | xargs -I{} chown -R abc {} \
&& find /home -type f | xargs -I{} chown abc {}

USER abc

COPY rstudio/database.conf /home/abc/.rserver
ENV USER=abc

RUN echo "------------------------------------------------------ some cleaning because Rstudio workdir is /home/abc/" \
&& rm -rf /home/abc/installed-python-packages \
&& rm -rf /home/abc/utils
61 changes: 61 additions & 0 deletions workspaces/r-workspace/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/img/Alnoda-white.svg" alt="Alnoda logo" width="150">
</p>

# R workspace

Docker image with R and browser-based RStudio version.

<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/codeserver-workspace/img/codeserver-collage-sm.jpg" alt="Collage" width="750">
</p>

## Why this images

1. If you need self-hosted remote development environment.
2. If you want to be one terminal command away from coding in R.
3. if you need isolated environment where you can work with R without polluting main environment.

## Start

```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/r-workspace
```

and open [localhost:8020](http://localhost:8020) in browser.

## Features

- [R](https://www.r-project.org/)
- RStudio server

**Dev tools:**

- [**Code-server**](https://github.com/cdr/code-server) - open source version of popular Visual Studio Code IDE. Codeserver has
VS-Code extensions and works in browser.
- [**Terminal**](https://github.com/tsl0922/ttyd) - secure browser-based terminal.
- [**FileBrowser**](https://github.com/filebrowser/filebrowser) - manage files and folders inside the workspace, and exchange data between local environment and the workspace
- [**Cronicle**](https://github.com/jhuckaby/Cronicle) - task scheduler and runner, with a web based front-end UI. It handles both scheduled, repeating and on-demand jobs, targeting any number of worker servers, with real-time stats and live log viewer.
- [**Static File Server**](https://github.com/vercel/serve) - view any static html sites as easy as if you do it on your local machine. Serve static websites easily.
- [**Ungit**](https://github.com/FredrikNoren/ungit) - rings user friendliness to git without sacrificing the versatility of it.
- [**MkDocs**](https://squidfunk.github.io/mkdocs-material/) - create awesome documentation for your project with only markdown.
- [**Midnight Commander**](https://midnight-commander.org/) - Feature rich visual file manager with internal text viewer and editor.
- [**Process Monitor**](https://htop.dev/) - Monitor running process and resource utilization.
- Quicklaunch UI with getting started tutorial

Image is built from **Ubuntu 20.4** with the additional CLI apps

- [Zsh](https://www.zsh.org/), [Oh my Zsh](https://ohmyz.sh/)
- Python 3, Pip
- Node/nodeenv
- curl, wget, telnet, jq
- **Git:** git, git-flow, lazygit
- **File browsers:** mc, xplr
- **Text editors:** nano, vim, mcedit
- **System monitors:** ncdu, htop, glances, vizex
- **Process Control:** supervisord
- **Job scheduler:** cron

## Docs
See our guides on [**getting started**](docs/getting-started.md) and [**advanced features**](../ubuntu-workspace/docs/workspaces.md).

69 changes: 69 additions & 0 deletions workspaces/r-workspace/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Getting started

## Intro

To start, open Quickstart page [localhost:8020](http://localhost:8020/) for quick access to all the tools

From the quicklaunch page you can open workspace tools, such as code editor or terminal

<div align="center" style="font-style: italic;">
Demo: Workspace UI
</div>

<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/wid-ui.png" alt="wid-ui.png" width="750">
</p>

This workspace includes RStudio Server, a browser-based IDE for R.

<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/r-workspace/img/RStudio.png" alt="RStudio" width="750">
</p>

Workspace has full-size browser-base terminal

<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/base-workspace/img/base-workspace-terminal.gif" alt="Base-Workspace terminal" width="750">
</p>


## R

Open terminal, and check R version

```
R --version
```

<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/r-workspace/img/r-version.png" alt="RStudio" width="500">
</p>

To start R shell, simply execute `R` in the terminal

<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/r-workspace/img/r-shell.png" alt="RStudio" width="500">
</p>

If you want to install packages from the terminal, execute

```
Rscript -e 'install.packages("drat", repos="https://cloud.r-project.org")'
```


## Examples

CUse terminal to clone example repository

```
cd /home/abc
git clone https://github.com/dmarcelinobr/r-code-examples.git
```

Open Rstudio, and try some examples, i.e. `2d-density-plot.r`. Evaluate code, agree to install dependencies

<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/r-workspace/img/2d-density-plot.png" alt="RStudio" width="750">
</p>

Binary file added workspaces/r-workspace/img/2d-density-plot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added workspaces/r-workspace/img/RStudio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added workspaces/r-workspace/img/r-shell.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added workspaces/r-workspace/img/r-version.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
68 changes: 68 additions & 0 deletions workspaces/r-workspace/mkdocs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo

# Scrapy stuff:
.scrapy

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# virtualenv
venv/
ENV/

# MkDocs documentation
site/
130 changes: 130 additions & 0 deletions workspaces/r-workspace/mkdocs/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<style>
/* These styles apply only to this page! */
.md-content__button {
display: none;
}
.md-sidebar--secondary{
display: none !important;
}
.md-typeset h1 {
line-height: 0;
margin: 0;
margin-left: -9999px;
}
.quickstart-wrapper {
min-width: 300px;
display: flex;
flex-wrap: wrap;
justify-content: center;
padding-left: -50px;
column-gap: 50px;
row-gap: 50px;
}
.quickstart-wrapper > div {
flex: 300px;
max-width: 300px;
}
.tool-img{
box-shadow: rgba(0, 0, 0, 0.24) 0px 5px 5px;
border-radius: 5px;
min-width: 300px;
max-width: 300px;
max-height: 170px;
min-height: 170px;
}
.tool-caption{
font-family: Roboto, Helvetica, sans-serif;
text-align: center;
margin-top: 10px;
font-size: 1.2rem;
font-weight: bold;

/* font-size: 1.25em;
font-weight: 400; */
letter-spacing: -.02em;
line-height: 1.5;
}
.tool-description{
font-family: Helvetica, sans-serif;
text-align: center;
margin-top: 10px;
font-size: 0.7rem;
font-style: oblique;
/* font-weight: bold; */
}
</style>


{%
set tools = [
{
"env": "IDE_URL",
"name": "RStudio",
"image": "assets/home/RStudio.png",
"description": "Best integrated development environment for R"
},
{
"env": "TERMINAL_URL",
"name": "Terminal",
"image": "assets/home/Terminal.png",
"description": "Full-fledged WEB-based Command Line Interface"
},
{
"env": "FILEBROWSER_URL",
"name": "File Browser",
"image": "assets/home/Filebrowser.png",
"description": "Browse, upload and download files and folders to and from the Workspace"
},
{
"env": "CRONICLE_URL",
"name": "Cronicle",
"image": "assets/home/Cronicle.jpg",
"description": "Schedule jobs, manage schedules, observe and monitor executions (user/pass - admin/admin)"
},
{
"env": "UNGIT_URL",
"name": "Ungit",
"image": "assets/home/Ungit.jpg",
"description": "Manage Git repositories and work flow using beautiful UI"
},
{
"env": "STATICFS_URL",
"name": "Static File Server",
"image": "assets/home/Static-server.png",
"description": "Serve any static websites like a breeze"
},
{
"env": "MC_URL",
"name": "M.Commander",
"image": "assets/home/MC.jpg",
"description": "Feature rich visual file manager with internal text viewer and editor"
},
{
"env": "HTOP_URL",
"name": "Resource monitor",
"image": "assets/home/Htop.jpg",
"description": "Monitor running process and resource utilization"
}
]
%}


<div class="quickstart-wrapper">
{% for tool in tools %}
{% set tool_url = get_tool_url(tool.env) %}
<div>
<a href="{{ tool_url }}" target="_blank" rel="noopener noreferrer">
<img src="{{ tool.image }}" class="tool-img"/>
</a>
<a href="{{ tool_url }}">
<div class="tool-caption">{{ tool.name }}</div>
</a>
<div class="tool-description">{{ tool.description }}</div>
</div>
{% endfor %}
</div>





Loading

0 comments on commit 22a31f0

Please sign in to comment.