mirror of
https://github.com/bluxmit/alnoda-workspaces.git
synced 2024-05-16 12:02:19 +12:00
release 2.0: rust-workspace
This commit is contained in:
parent
f7332fc325
commit
0e8baa9697
|
@ -3,7 +3,7 @@
|
|||
</p>
|
||||
|
||||
# Elasticsearch workspace
|
||||
Several Elasticsearch CLI tools in containerized dev/admin workspace.
|
||||
Several Elasticsearch CLI tools in a containerized dev/admin workspace.
|
||||
|
||||
## Why this images
|
||||
|
||||
|
|
31
workspaces/rust-workspace/Dockerfile
Normal file
31
workspaces/rust-workspace/Dockerfile
Normal file
|
@ -0,0 +1,31 @@
|
|||
ARG docker_registry=docker.io/alnoda
|
||||
ARG image_tag=2.0
|
||||
|
||||
FROM ${docker_registry}/codeserver-workspace:${image_tag}
|
||||
USER root
|
||||
|
||||
COPY docs/getting-started.md /home/docs/docs/getting-started.md
|
||||
|
||||
RUN apt-get -y update \
|
||||
&& curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > /tmp/rustup.sh \
|
||||
&& echo "------------------------------------------------------ rust (root) " \
|
||||
&& echo 'CARGO_HOME="/root/.cargo/bin"' >> /root/.zshrc \
|
||||
&& echo 'RUSTUP_HOME="/root/.rustup"' >> /root/.zshrc \
|
||||
&& export PATH="/root/.cargo/bin:/root/.rustup/bin:$PATH" \
|
||||
&& sh /tmp/rustup.sh -y \
|
||||
&& echo "------------------------------------------------------ shell autocompetion (root) " \
|
||||
&& mkdir /root/.zfunc \
|
||||
&& rustup completions zsh > /root/.zfunc/_rustup \
|
||||
&& echo 'fpath+=~/.zfunc' >> /root/.zshrc
|
||||
|
||||
USER abc
|
||||
|
||||
RUN echo "------------------------------------------------------ rust (abc) " \
|
||||
&& echo 'CARGO_HOME="/home/abc/.cargo/bin"' >> /home/abc/.zshrc \
|
||||
&& echo 'RUSTUP_HOME="/home/abc/.rustup"' >> /home/abc/.zshrc \
|
||||
&& export PATH="/home/abc/.cargo/bin:/home/abc/.rustup/bin:$PATH" \
|
||||
&& sh /tmp/rustup.sh -y
|
||||
|
||||
|
||||
|
||||
|
60
workspaces/rust-workspace/README.md
Normal file
60
workspaces/rust-workspace/README.md
Normal file
|
@ -0,0 +1,60 @@
|
|||
<p align="center">
|
||||
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/img/Alnoda-white.svg" alt="Alnoda logo" width="150">
|
||||
</p>
|
||||
|
||||
# Ruby workspace
|
||||
|
||||
Docker image with Ruby and browser-based VS-Code 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 Ruby.
|
||||
|
||||
## Start
|
||||
|
||||
```
|
||||
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/ruby-workspace
|
||||
```
|
||||
|
||||
and open [localhost:8020](http://localhost:8020) in browser.
|
||||
|
||||
## Features
|
||||
|
||||
- [Rust](https://www.rust-lang.org/)
|
||||
- [Rustup](https://rustup.rs/)
|
||||
|
||||
**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).
|
||||
|
126
workspaces/rust-workspace/docs/getting-started.md
Normal file
126
workspaces/rust-workspace/docs/getting-started.md
Normal file
|
@ -0,0 +1,126 @@
|
|||
# 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>
|
||||
|
||||
The main code editor of this workspace is [Code-server](https://github.com/cdr/code-server)
|
||||
|
||||
<div align="center" style="font-style: italic;">
|
||||
Demo: Code-server
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/codeserver-workspace/img/codeserver-demo.gif" alt="Code-server demo" width="900">
|
||||
</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>
|
||||
|
||||
|
||||
## Hello world
|
||||
|
||||
Check Rust version
|
||||
|
||||
```
|
||||
rustc --version
|
||||
```
|
||||
|
||||
Create new project folder
|
||||
|
||||
```
|
||||
cargo new my_example
|
||||
cd my_example
|
||||
```
|
||||
|
||||
The new project is created together, with hello-world app in `src` sub-folder
|
||||
|
||||
```
|
||||
cat src/main.rs
|
||||
```
|
||||
|
||||
Compile it
|
||||
|
||||
```
|
||||
cargo build
|
||||
```
|
||||
|
||||
And then run it
|
||||
|
||||
```
|
||||
./target/debug/my_example
|
||||
```
|
||||
|
||||
We can also compile and then run it, all in one step
|
||||
|
||||
```
|
||||
cargo run
|
||||
```
|
||||
|
||||
|
||||
## Rustup
|
||||
|
||||
A toolchain is a specific version of the collection of programs needed to compile a Rust application. It includes, but is not limited to:
|
||||
- The compiler, rustc
|
||||
- The dependency manager and build tool, cargo
|
||||
- The documentation generator, rustdoc
|
||||
|
||||
Rustup provides ways to install, remove, update, select and otherwise manage these toolchains and their associated pieces.
|
||||
|
||||
Install specific version of Rust toolchain
|
||||
|
||||
```
|
||||
rustup install 1.30.0
|
||||
```
|
||||
|
||||
Show toolchains
|
||||
|
||||
```
|
||||
rustup show
|
||||
```
|
||||
|
||||
Change default toolchain
|
||||
|
||||
```
|
||||
rustup default 1.30.0
|
||||
```
|
||||
|
||||
|
||||
## Project with dependencies
|
||||
|
||||
Cargo is also the Rust package manager. It is a tool that allows Rust packages to declare their various dependencies and ensure that you’ll always get a repeatable build.
|
||||
|
||||
Clone example repo
|
||||
|
||||
```
|
||||
git clone https://github.com/rdesarz/rust-http-server.git
|
||||
cd rust-http-server
|
||||
```
|
||||
|
||||
Build and start the server
|
||||
|
||||
```
|
||||
cd example
|
||||
cargo run --package http-server --bin http-server 0.0.0.0:8030
|
||||
```
|
||||
|
||||
You will see that before cargo builds the package, it installs all the dependencies from the file `Cargo.toml`.
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/rust-workspace/img/cargo-deps.png" alt="cargo dependencies" width="500">
|
||||
</p>
|
||||
|
||||
Open in your browser [0.0.0.0:8030/hello.html](http://0.0.0.0:8030/hello.html) to see a simple page.
|
BIN
workspaces/rust-workspace/img/cargo-deps.png
Normal file
BIN
workspaces/rust-workspace/img/cargo-deps.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 290 KiB |
Loading…
Reference in a new issue