2.3: adding my app, start refactoring docs

This commit is contained in:
bluxmit 2022-05-22 07:29:05 +00:00
parent 22a31f0451
commit ef8da1149c
79 changed files with 1411 additions and 667 deletions

128
README.md
View file

@ -1,15 +1,20 @@
<!-- <p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/img/Alnoda-white.svg" alt="Alnoda logo" width="150">
</p> -->
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/img/ukraine-flag.png" alt="Ukraine" width="150">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/img/Alnoda-white.svg" alt="Alnoda logo" width="150">
</p>
# Workspaces in docker
Containerized development, admin and professional environments.
Workspace is a single docker image with a number of applications and tools for specific task,
such as Python development or Postgres management.
## Why
1. If you are building cloud development platform
2. If you need to get started fast without building your own toolset
## Workspace
Workspaces consist of
- toolsets selected for specific tasks, such as software development, database administration or data exploration
- browser based aplications that enable cloud development, such as IDE, file manager, job scheduler
<div align="center" style="font-style: italic;">
Demo: Ansible-Terraform workspace
@ -21,115 +26,10 @@ such as Python development or Postgres management.
> If you like this project, please support it by simply putting a Github star and sharing with friends on Twitter.
### Contents
* [List of workspaces](#list-of-workspaces)
* [Why workspace In Docker](#why-workspace-in-docker)
* [Contribution](#contribution)
## List of workspaces
### [`Workspace-in-docker`](./workspaces/workspace-in-docker/README.md)
General-purpose dockerized development environment. Fully isolated inside a docker container.
Includes code editor, terminal, scheduler and filebrowser.
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/workspace-in-docker
```
### [`Codeserver-Workspace`](./workspaces/codeserver-workspace/README.md)
An alternative workspace to the workspace-in-docker but with [Codeserver](https://github.com/cdr/code-server).
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/codeserver-workspace
```
### [`Python-Workspace`](./workspaces/python-workspace/README.md)
General purpose python development environment with a focus on
linting, testing, auto-documentation, performance and profiling.
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/python-workspace
```
### [`Ansible-Terraform-Workspace`](./workspaces/ansible-terraform-workspace/README.md)
Dockerized development environment for [Ansible](https://docs.ansible.com/) and [Terraform](https://www.terraform.io/).
Workspace will help to create and manage infrastructures; visualize planned terraform changes;
display ansible hosts plays; schedule and observe executions.
```
docker run --name space-1 -d -p 8020-8035:8020-8035 -p 9000:9000 alnoda/ansible-terraform-workspace
```
### [`Postgres-Workspace`](./workspaces/postgres-workspace/README.md)
Great number of tools to manage PostgreSQL database, develop and schedule database scripts and applications.
All in a single docker image.
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/postgres-workspace
```
### [`Redis-Workspace`](./workspaces/redis-workspace/README.md)
Docker image with Redis, Redis Commander and other Redis CLI tools. Can be used to manage cloud Redis deployments,
or as Redis docker image with batteries included for local development.
```
docker run --name rwid-1 -d -p 8020-8035:8020-8035 alnoda/redis-workspace
```
### [`Kafka-Workspace`](./workspaces/kafka-workspace/README.md)
Docker image with Kafka, and many tools to manage Kafka clustters in cloud, improve development experience
or get started with Kafka fast.
```
docker run --name rwid-1 -d -p 8020-8035:8020-8035 alnoda/kafka-workspace
```
### [`Elasticsearch-Workspace`](./workspaces/elasticsearch-workspace/README.md)
A tool to manage Elasticsearch/Opensearch clusters. Schedule backups of Elasticsearch indexes,
migrate to other clusters, export and import Elasticsearch data to S3.
```
docker run --name elawid-1 -d -p 8020-8035:8020-8035 alnoda/elasticsearch-workspace
```
### [`MkDocs-MagicSpace`](./workspaces/mkdocs-magicspace/README.md)
MkDocs-MagicSpace is an all-in-one tool, carefully crafted to make the development of gorgeous documentation
websites like [**this one**](https://mkdocs-magicspace.alnoda.org/) as easy as possible.
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/mkdocs-magicspace
```
### [`SQLite-Workspace`](./workspaces/sqlite-workspace/README.md)
Collection of tools to develop SQLite databases. Useful if you need to create an embedded database for your application,
and fill it with data.
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/sqlite-workspace
```
### [`Ubuntu-workspace`](./workspaces/ubuntu-workspace/README.md)
Docker as a "light-weight Virtual Machine". Get an isolated Ubuntu environment for development, testing or experimentation
that requires less resources than VM.
```
docker run --name space-1 -d -p 8020-8030:8020-8030 alnoda/ubuntu-workspace
```
## Why workspace In Docker
When used locally, workspaces help to isolate development environments and easily switch between projects. Workspaces can be moved between laptops, PCs,
backed up and shared with friends.
When launched on remote server, workspaces can be used to schedule scripts and tasks, such as data ingestion.
When deployed on K8S, workspaces can be used to manage databases, create backups.
## Contribution
Simply create a pull request. It will be welcome.
Pull requests welcome.
If you feel you need to discuss first, create an issue.

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.2
## Images used:
ARG BUILD_IMAGE=node:12.18.3
@ -56,7 +56,7 @@ COPY supervisord-infra.conf /etc/supervisord/
# Ara
COPY ara-settings.yaml /home/abc/.ara/server/settings.yaml
ENV ANSIBLE_CALLBACK_PLUGINS="/usr/local/lib/python3.9/dist-packages/ara/plugins/callback" ARA_API_CLIENT="http" ARA_API_SERVER="http://0.0.0.0:8029" ARA_TIME_ZONE="UTC"
ENV ANSIBLE_CALLBACK_PLUGINS="/usr/local/lib/python3.8/dist-packages/ara/plugins/callback" ARA_API_CLIENT="http" ARA_API_SERVER="http://0.0.0.0:8029" ARA_TIME_ZONE="UTC"
# Customize mkdocs
COPY ./mkdocs/mkdocs.yml /home/docs/mkdocs.yml
@ -65,7 +65,8 @@ COPY ./mkdocs/Ara.png /home/docs/docs/assets/home/
COPY ./mkdocs/Blast-radius.png /home/docs/docs/assets/home/
COPY ./mkdocs/Terraform-Rover.png /home/docs/docs/assets/home/
COPY ./mkdocs/helpers.py /home/docs/macros
COPY docs/getting-started.md /home/docs/docs/getting-started.md
COPY docs/ansible.md /home/docs/docs/
COPY docs/terraform.md /home/docs/docs/
RUN apt-get -y update \
&& echo "------------------------------------------------------ ansible ara" \
@ -76,9 +77,9 @@ RUN apt-get -y update \
&& echo "------------------------------------------------------ ansible-lint" \
&& pip3 install "ansible-lint[yamllint]" \
&& echo "------------------------------------------------------ terraform" \
&& cd /tmp && wget https://releases.hashicorp.com/terraform/0.14.6/terraform_0.14.6_linux_amd64.zip \
&& unzip terraform_0.14.6_linux_amd64.zip -d /usr/local/bin \
&& rm /tmp/terraform_0.14.6_linux_amd64.zip \
&& cd /tmp && wget https://releases.hashicorp.com/terraform/1.2.0/terraform_1.2.0_linux_amd64.zip \
&& unzip terraform_1.2.0_linux_amd64.zip -d /usr/local/bin \
&& rm /tmp/terraform_1.2.0_linux_amd64.zip \
&& echo "------------------------------------------------------ blast-radius" \
&& apt-get install -y graphviz \
&& echo "------------------------------------------------------ terraform-docs" \
@ -109,16 +110,15 @@ RUN apt-get -y update \
&& chmod +x inframap-linux-amd64 \
&& mv inframap-linux-amd64 /usr/bin/inframap \
&& echo "------------------------------------------------------ terraform rover" \
&& cd /tmp && curl -Lo ./terraform-rover.zip https://github.com/im2nguyen/rover/releases/download/v0.1.6/rover_0.1.6_linux_amd64.zip \
&& unzip /tmp/terraform-rover.zip -d /tmp/rover && rm terraform-rover.zip \
&& mv /tmp/rover/rover_v0.1.6 /tmp/rover/rover \
&& cd /tmp && curl -Lo ./terraform-rover.zip https://github.com/im2nguyen/rover/releases/download/v0.3.2/rover_0.3.2_linux_amd64.zip \
&& unzip /tmp/terraform-rover.zip -d /tmp/rover && rm /tmp/terraform-rover.zip \
&& mv /tmp/rover/rover_v0.3.2 /tmp/rover/rover \
&& chmod +x /tmp/rover/rover \
&& mv /tmp/rover/rover /usr/bin/rover \
&& rm -rf /tmp/rover \
&& echo "------------------------------------------------------ utils" \
&& rm -rf /home/abc/utils || true \
&& git clone https://github.com/bluxmit/alnoda-workspaces /tmp/alnoda-workspaces \
&& mv /tmp/alnoda-workspaces/utils /home/abc/ \
&& mv -f /tmp/alnoda-workspaces/utils/* /home/abc/utils \
&& rm -rf /tmp/alnoda-workspaces \
&& echo "alias ansible-report='/home/abc/utils/ansible-report.sh'" >> /home/abc/.zshrc \
&& chmod +x /home/abc/utils/ansible-report.sh && chown abc /home/abc/utils/ansible-report.sh \
@ -135,7 +135,7 @@ RUN apt-get -y update \
&& find /home -type d | xargs -I{} chown -R abc {} \
&& find /home -type f | xargs -I{} chown abc {}
ENV TERRAFORM_ROVER="http://localhost:9000"
ENV TERRAFORM_ROVER="http://localhost:9000"
USER abc

View file

@ -19,7 +19,7 @@ visualize planned terraform changes; display ansible hosts plays; schedule and o
## Start
```
docker run --name space-1 -d -p 8020-8035:8020-8035 -p 9000:9000 alnoda/ansible-terraform-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 -p 9000:9000 alnoda/ansible-terraform-workspace
```
and open [localhost:8020](http://localhost:8020) in browser.

View file

@ -9,6 +9,7 @@ default:
- ::1
- 0.0.0.0
- localhost
- "*"
BASE_DIR: /home/abc/.ara/server
CORS_ORIGIN_ALLOW_ALL: true
CORS_ORIGIN_REGEX_WHITELIST: []

View file

@ -1,6 +1,5 @@
# Ansible tools
### [Ansible-cmdb](https://github.com/fboender/ansible-cmdb)
Ansible-cmdb takes the output of Ansible's fact gathering and converts

View file

@ -0,0 +1,129 @@
# Ansible
This tutorial is a little demonstration of the included ansible toolset.
Workspace has an example ansible play which installs several installs packages.
We will use this playbook for some of the examples. For other examples, create your own ansible project.
To run an example ansible play, open terminal and execute
```
cd /home/examples/ansible-local
ansible-playbook install-packages.yml
```
## Ansible Ara
[Ansible ARA](https://github.com/ansible-community/ara) Records Ansible and makes it easier to understand and troubleshoot. Ansible Ara is
fully configured in the Ansible-Terraform workspace - it captures any execution (manual or scheduled)
of any ansible playbook.
Ara server is up and running. Open quickstart page and navigate to Ara WEB UI
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/Ansible-Ara.gif" alt="Htop" width="750">
</p>
## Ansible Lint
[Ansible Lint](https://ansible-lint.readthedocs.io/en/latest/installing.html) is a command-line tool for linting playbooks, roles and collections aimed towards any Ansible users. Cd to the folder with
your Ansible project and execute
```
cd /home/examples/ansible-local
ansible-lint --nocolor > /home/static-server/ansible-lint.txt
```
You can view the resulted txt file with static file server, filebrowser.
## Ansible report
Ansible-report is a small utility that generates several reports from your ansible project - visualizes inventory, represents
all plays in a format of graphs, generates interactive static website with information about hosts etc.
Create your own ansible project, cd and execute
```
ansible-report
```
Ansible-report is a shell script that simply executes several ansible tools in one shot:
- ansible-lint
- ansible-cmdb
- ansible-inventory-grapher
- ansible-playbook-grapher (for all ansible plays in the folder)
You can also use any of the ansible tools separately.
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/ansible-report.gif" alt="Htop" width="900">
</p>
## Ansible-cmdb
[Ansible-cmdb](https://github.com/fboender/ansible-cmdb) takes the output of Ansible's fact gathering and converts
it into a static HTML overview page (and other things) containing system configuration information.
Cd to the folder with your Ansible project and execute
```
ansible -m setup --tree out/ all
ansible-cmdb out/ > overview.html
```
## Ansible inventory grapher
[Ansible inventory grapher](https://github.com/willthames/ansible-inventory-grapher) creates a dot file suitable for use by graphviz. Cd to the folder with
your Ansible project and execute
```
ansible-inventory-grapher all | dot -Tpng > /home/static-server/my.png
```
## Ansible Playbook Grapher
[Ansible Playbook Grapher](https://github.com/haidaraM/ansible-playbook-grapher) - is a command line tool
that creates a graph representing your Ansible playbook plays, tasks and roles.
The aim of this project is to have an overview of your playbook. Cd to the folder with
your Ansible project and execute
```
ansible-playbook-grapher --include-role-tasks example.yml -o /home/static-server/example
```
## Ansible Doctor
[Ansible Doctor](https://ansible-doctor.geekdocs.de/) is a simple annotation like documentation generator based on Jinja2 templates.
while ansible-doctor comes with a default template called readme, it is also possible to write your own templates.
The first step is to identify if the given folder is an Ansible role. This check is very simple,
if the folder contains a sub-directory called tasks is MUST be an Ansible role! :)
After the successful check, ansible-doctor will try to read some static files into a dictionary:
- defaults/main.yml
- meta/main.yml
Cd to the folder with your Ansible project and execute
```
ansible-doctor -o /home/static-server/ roles/example_production
```
## Schedule Ansible playbook executions
Ansible-Terraform workspace has 2 tools (Cronicle and ARA) that make it simple and convenient to use Ansible for periodic tasks and jobs. For example,
maintenance jobs for your cloud infrastructure. This is especially handy if you run this workspace on a remote server.
- [**Cronicle**] - allows to schedule tasks and jobs, and lets you observe executions using a nice UI
- [**Ansible Ara**] - tracks all executions of ansible playbooks (manual or scheduled), and has nice UI that provides informationn about every step
of every playbook execution
You can try scheduling an example ansible playbook with Cronicle
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/cronicle-ansible.gif" alt="Htop" width="900">
</p>
**NOTE:** Scheduling Ansible playbooks is especially useful if you [launch Workspace on a remote server](#run-on-remote-server) rather than
on your local laptop.

View file

@ -1,309 +0,0 @@
# Getting started
### Quicklaunch
From the quicklaunch page you can open workspace tools, such as code editor or terminal
<div align="center" style="font-style: italic;">
Demo: Quicklaunch
</div>
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/Workspace%20UI.png" alt="Htop" width="750">
</p>
### Code Editor
Code editor of this workspace is [**Eclipse Theia**](https://theia-ide.org/docs/) - an open-source version of popular Visual Studio Code IDE.
despite Eclipse Theia is a browser-based code editor, it is fast, responsive, and full-featured. It features code highlighting, autocompletion,
rendering of notebooks has a tree-based file browser, and a great number of pre-installed color themes.
<div align="center" style="font-style: italic;">
Demo: Eclipse Theia
</div>
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/theia.gif" alt="Theia demo" width="900">
</p>
You can install any extension from [open-vsx.org](https://open-vsx.org/) that has hundreeds of extensions for VS Code compatible editors.
The IDE is already configured to make code highlighting for a great number of programming languages and file types. It also has many
popular extensions installed
### Terminal
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>
Use workspace workspace terminal to install new applications.
Install with ```sudo apt install```. The default *abc* user is allowed to install packages.
For example, in order to install [Emacs text editor](https://www.gnu.org/software/emacs/) open workspace terminal, and execute
```
sudo apt-get update
sudo apt install emacs
```
## Ansible
Workspace includes example ansible playbook - a simple play that installs packages in localhosts
> `cd /home/examples/ansible-local && ansible-playbook install-packages.yml`
### [Ansible Ara](https://github.com/ansible-community/ara)
ARA Records Ansible and makes it easier to understand and troubleshoot. Ansible Ara is
fully configured in the Ansible-Terraform workspace - it captures any execution (manual or scheduled)
of any ansible playbook.
Ara server is up and running in the workspace, and available on the internal port 8029. If you mapped standard ports to your Ansible-Terraform
workspcae, then Ansible Ara WEB UI is on [localhost:8029](http://localhost:8029)
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/Ansible-Ara.gif" alt="Htop" width="750">
</p>
### Ansible report
Ansible-report is a small utility that generates several reports from your ansible project - visualizes inventory, represents
all plays in a format of graphs, generates interactive static website with information about hosts etc.
> `cd /home/examples/ansible-local && ansible-report`
Ansible-report is a shell script that simply executes several ansible tools in one shot:
- ansible-lint
- ansible-cmdb
- ansible-inventory-grapher
- ansible-playbook-grapher (for all ansible plays in the folder)
You can also use any of the ansible tools separately.
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/ansible-report.gif" alt="Htop" width="900">
</p>
### [Ansible Lint](https://ansible-lint.readthedocs.io/en/latest/installing.html)
Ansible Lint is a command-line tool for linting playbooks, roles and collections aimed towards any Ansible users. Cd to the folder with
your Ansible project and execute
```
ansible-lint --nocolor > /home/static-server/ansible-lint.txt
```
### [Ansible-cmdb](https://github.com/fboender/ansible-cmdb)
Ansible-cmdb takes the output of Ansible's fact gathering and converts
it into a static HTML overview page (and other things) containing system configuration information. Cd to the folder with
your Ansible project and execute
```
ansible -m setup --tree out/ all
ansible-cmdb out/ > overview.html
```
### [Ansible inventory grapher](https://github.com/willthames/ansible-inventory-grapher)
Ansible-inventory-grapher creates a dot file suitable for use by graphviz. Cd to the folder with
your Ansible project and execute
```
ansible-inventory-grapher all | dot -Tpng > /home/static-server/my.png
```
### [Ansible Playbook Grapher](https://github.com/haidaraM/ansible-playbook-grapher)
Command line tool to create a graph representing your Ansible playbook plays, tasks and roles.
The aim of this project is to have an overview of your playbook. Cd to the folder with
your Ansible project and execute
```
ansible-playbook-grapher --include-role-tasks example.yml -o /home/static-server/example
```
### [Ansible Doctor](https://ansible-doctor.geekdocs.de/)
Ansible-doctor is a simple annotation like documentation generator based on Jinja2 templates.
while ansible-doctor comes with a default template called readme, it is also possible to write your own templates.
The first step is to identify if the given folder is an Ansible role. This check is very simple,
if the folder contains a sub-directory called tasks is MUST be an Ansible role! :)
After the successful check, ansible-doctor will try to read some static files into a dictionary:
- defaults/main.yml
- meta/main.yml
Cd to the folder with your Ansible project and execute
```
ansible-doctor -o /home/static-server/ roles/example_production
```
### Schedule Ansible playbook executions
Ansible-Terraform workspace has 2 tools (Cronicle and ARA) that make it simple and convenient to use Ansible for periodic tasks and jobs. For example,
maintenance jobs for your cloud infrastructure. This is especially handy if you run this workspace on a remote server.
- [**Cronicle**] - allows to schedule tasks and jobs, and lets you observe executions using a nice UI
- [**Ansible Ara**] - tracks all executions of ansible playbooks (manual or scheduled), and has nice UI that provides informationn about every step
of every playbook execution
You can try scheduling an example ansible playbook with Cronicle
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/cronicle-ansible.gif" alt="Htop" width="900">
</p>
**NOTE:** Scheduling Ansible playbooks is especially useful if you [launch Workspace on a remote server](#run-on-remote-server) rather than
on your local laptop.
## Terraform
[Terraform](https://www.terraform.io/) is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files.
Ansible-Terraform workspace contains a small example Terraform project that creates a server on the Scaleway cloud
> `cd /home/examples/terraform-scaleway/ && terraform init`
Set Scaleway credentials as environment variable in your workspace.
Add the following lines to /home/abc/.zshrc:
```
export SCW_DEFAULT_PROJECT_ID=<YOUR_PROJECT_ID>
export SCW_ACCESS_KEY=<YOUR_ACCESS_KEY>
export SCW_SECRET_KEY=<YOUR_SECRET_KEY>
```
Restart terminal, and execute
> `cd /home/examples/terraform-scaleway/ && terraform plan`
Create infrastructure with
> `cd /home/examples/terraform-scaleway/ && terraform apply`
### Terraform report
A small tool that produces several outputs from a terraform project and visualizes terraform plan as an interactive HTML page.
Terraform report can be generated from the small example terraform project, included in the Workspace
> `cd /home/examples/terraform-scaleway/ && terraform-report`
Terraform-report outputs artefacts to the folder `/home/static-server/terraform-reports/`. This folder is served by the Static File Server that you
can use to view the artifacts, that include interactive HTML pages
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/terraform-report-scaleway.gif" alt="Htop" width="750">
</p>
**Example with AWS**
If you want to try Terraform report with your own AWS account, open workspace and configure AWS profile -
create [file with AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
> `mkdir -p ~/.aws`
> `nano ~/.aws/credentials`
The file `~/.aws/credentials` would look like this
```
[terraform]
aws_access_key_id = <YOUR_AWS_KEY>
aws_secret_access_key = <YOUR_AWS_SECRET>
```
Clone your terraform project to the workspace, or if you don't have any, you can use this terraform example repository:
> `git clone https://github.com/pvarentsov/terraform-aws-free-tier /home/project/aws-example`
Open file `/home/project/aws-example/src/free-tier/main.tf` and comment out the part that configures S3 backend
```
terraform {
backend "s3" {}
}
```
Initialize a working Terraform directory
> `cd /home/project/aws-example/src/free-tier && terraform init`
Paste public ssh key (for the sake of example you can type anything)
> `nano ./provision/access/free-tier-ec2-key.pub`
Now you can generate terraform report
> `terraform-report`
Use Static File Server to review the report
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/terraform-report.gif" alt="Htop" width="900">
</p>
### Terraform Rover
[Rover](https://github.com/im2nguyen/rover) - is an awesome Terraform visualizer with browser-based UI. Rover helps to better understand
Terraform state and planned changes. To see how Rover works, you can use a basic Terraform example in folder */home/examples/terraform-scaleway/*.
Initialize Terraform project first
> `cd /home/examples/terraform-scaleway/ && terraform init`
and start Rover to visualize terraform state
> `rover --workingDir /home/examples/terraform-scaleway/`
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/rover-scaleway.gif" alt="rover-scaleway" width="900">
</p>
If you have followed hands-on the tutorial from the previous section (terraform report from the terraform-aws-free-tier repo), you
can visualize it with Rover:
> `rover --workingDir /home/project/aws-example/src/free-tier`
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/rover-aws.gif" alt="rover-aws" width="900">
</p>
### Blast Radius
[Blast Radius](https://github.com/28mm/blast-radius) is a tool for reasoning about Terraform dependency graphs with interactive visualizations.
You can try Blast Radius - launch workspace and visualize an example Terraform project.
> `cd /home/examples/terraform-scaleway && terraform init`
> `blast-radius --serve --port 8030`
open [localhost:8030](http://localhost:8030) in browser
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/blast-radius.gif" alt="Htop" width="900">
</p>
***NOTE:** Blast Radius is a great project, but there is lack of updates to the project recently, and it might not work
with some Terraform providers.*
### [Terraform pre-commit hook](https://github.com/antonbabenko/pre-commit-terraform)
Pre-commit git hooks to take care of Terraform configurations. Workspace has all dependencies installed.
### [Terraform Inframap](https://github.com/cycloidio/inframap)
- Visualize terraform state
```
inframap generate terraform.tfstate | dot -Tpng > graph.png
```

View file

@ -0,0 +1,165 @@
# Terraform
[Terraform](https://www.terraform.io/) is an open-source infrastructure as code software tool that provides a consistent CLI workflow to manage hundreds of cloud services. Terraform codifies cloud APIs into declarative configuration files.
Ansible-Terraform workspace contains a small example Terraform project that creates a server on the Scaleway cloud
```
cd /home/examples/terraform-scaleway/ && terraform init
```
If you want to try, set your Scaleway credentials as environment variable in your workspace.
Add the following lines to /home/abc/.zshrc:
```
export SCW_DEFAULT_PROJECT_ID=<YOUR_PROJECT_ID>
export SCW_ACCESS_KEY=<YOUR_ACCESS_KEY>
export SCW_SECRET_KEY=<YOUR_SECRET_KEY>
```
Restart terminal, and execute
```
cd /home/examples/terraform-scaleway/ && terraform plan
```
Create Scaleway infrastructure with
```
cd /home/examples/terraform-scaleway/ && terraform apply
```
## Terraform report
A small tool that produces several outputs from a terraform project and visualizes terraform plan as an interactive HTML page.
Terraform report can be generated from the small example terraform project, included in the Workspace
```
cd /home/examples/terraform-scaleway/
terraform-report
```
Terraform-report outputs artefacts to the folder `/home/static-server/terraform-reports/`. This folder is served by the Static File Server that you
can use to view the artifacts, that include interactive HTML pages
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/terraform-report-scaleway.gif" alt="Htop" width="750">
</p>
**Example with AWS**
If you want to try Terraform report with your own AWS account, open workspace and configure AWS profile -
create [file with AWS credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html)
```
mkdir -p ~/.aws
nano ~/.aws/credentials
```
The file `~/.aws/credentials` would look like this
```
[terraform]
aws_access_key_id = <YOUR_AWS_KEY>
aws_secret_access_key = <YOUR_AWS_SECRET>
```
Clone your terraform project to the workspace, or if you don't have any, you can use this terraform example repository:
```
git clone https://github.com/pvarentsov/terraform-aws-free-tier /home/project/aws-example
```
Open file `/home/project/aws-example/src/free-tier/main.tf` and comment out the part that configures S3 backend
```
terraform {
backend "s3" {}
}
```
Initialize a working Terraform directory
```
cd /home/project/aws-example/src/free-tier && terraform init
```
Paste public ssh key (for the sake of example you can type anything)
```
nano ./provision/access/free-tier-ec2-key.pub
```
Now you can generate terraform report
```
terraform-report
```
Use Static File Server to review the report
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/terraform-report.gif" alt="Htop" width="900">
</p>
## Terraform Rover
[Rover](https://github.com/im2nguyen/rover) - is an awesome Terraform visualizer with browser-based UI. Rover helps to better understand
Terraform state and planned changes. To see how Rover works, you can use a basic Terraform example in folder */home/examples/terraform-scaleway/*.
Initialize Terraform project first
```
cd /home/examples/terraform-scaleway/ && terraform init
```
and start Rover to visualize terraform state
```
rover --workingDir /home/examples/terraform-scaleway/
```
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/rover-scaleway.gif" alt="rover-scaleway" width="900">
</p>
If you have followed hands-on the tutorial from the previous section (terraform report from the terraform-aws-free-tier repo), you
can visualize it with Rover:
```
rover --workingDir /home/project/aws-example/src/free-tier
```
Go to the quickstart page, and open Rover WEB UI
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/rover-aws.gif" alt="rover-aws" width="900">
</p>
## Blast Radius
[Blast Radius](https://github.com/28mm/blast-radius) is a tool for reasoning about Terraform dependency graphs with interactive visualizations.
You can try Blast Radius - launch workspace and visualize an example Terraform project.
```
cd /home/examples/terraform-scaleway && terraform init
blast-radius --serve --port 8030
```
Go to the quickstart page, and open Blast Radius WEB UI
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ansible-terraform-workspace/img/blast-radius.gif" alt="Htop" width="900">
</p>
***NOTE:** Blast Radius is a great project, but there is lack of updates to the project recently, and it might not work
with some Terraform providers.*
### [Terraform Inframap](https://github.com/cycloidio/inframap)
- Visualize terraform state
```
inframap generate terraform.tfstate | dot -Tpng > graph.png
```

View file

@ -1,21 +1,19 @@
## Ansible tools
ansible==4.4.0
cffi==1.14.6
ansible==5.8.0
cffi==1.15.0
# https://github.com/fboender/ansible-cmdb
ansible-cmdb==1.31
# https://github.com/ansible-community/ara
ara==1.5.7
ara==1.5.8
# https://github.com/willthames/ansible-inventory-grapher
ansible-inventory-grapher==2.5.0
# https://github.com/haidaraM/ansible-playbook-grapher
ansible-playbook-grapher==0.11.1
ansible-playbook-grapher==1.1.1
# https://ansible-doctor.geekdocs.de/
ansible-doctor==0.3.1
ansible-doctor==1.3.3
## Terraform tools
# https://github.com/28mm/blast-radius
blastradius==0.1.23
# https://github.com/bridgecrewio/checkov
checkov==2.0.359
# https://github.com/antonbabenko/pre-commit-terraform
pre-commit==2.14.0
pre-commit==2.19.0

View file

@ -15,7 +15,10 @@ port_increments = {
"MC_URL": 7,
"HTOP_URL": 8,
"ANSIBLE_ARA": 9,
"BLAST_RADIUS": 10
"BLAST_RADIUS": 10,
"PORT_8038": 18,
"PORT_8039": 19,
"PORT_8040": 20
}
# this function name should not be changed

View file

@ -4,7 +4,11 @@
nav:
- Home: README.md
- Get started: getting-started.md
- My apps: pages/my-apps.md
- Tutorials:
- Get started: getting-started.md
- Ansible: ansible.md
- Terraform: terraform.md
# ===========================================================

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=20.04-2.0
ARG image_tag=20.04-2.2
FROM ${docker_registry}/ubuntu-workspace:${image_tag}
@ -21,25 +21,28 @@ COPY filebrowser.json /opt/filebrowser/.filebrowser.json
COPY mkdocs /home/docs
COPY docs/getting-started.md /home/docs/docs/getting-started.md
COPY docs/schedule-script.md /home/docs/docs/schedule-script.md
COPY mkdocs-requirements.txt /home/abc/installed-python-packages/mkdocs-requirements.txt
RUN echo "------------------------------------------------------ filebrowser, ungit, static server" \
&& apt-get -y update \
&& mkdir -p -m 777 /opt/filebrowser \
&& curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash \
RUN apt-get -y update \
&& echo "------------------------------------------------------ filebrowser" \
&& cd /tmp && wget https://github.com/filebrowser/filebrowser/releases/download/v2.21.1/linux-amd64-filebrowser.tar.gz \
&& mkdir /tmp/filebrowser \
&& tar xvf /tmp/linux-amd64-filebrowser.tar.gz -C /tmp/filebrowser \
&& chmod +x /tmp/filebrowser/filebrowser \
&& mv /tmp/filebrowser/filebrowser /opt/filebrowser/ \
&& rm -rf /tmp/filebrowser/filebrowser \
&& echo "------------------------------------------------------ ungit" \
&& apt-get install -y ssh net-tools --no-install-recommends \
&& mkdir -p /opt/ungit \
&& cd /opt/ungit && nodeenv --node=12.18.3 --npm=6.0.0 env \
&& cd /opt/ungit && . env/bin/activate && npm install -g ungit@1.5.9 \
&& echo "------------------------------------------------------ static file server" \
&& mkdir -p /opt/serve \
&& cd /opt/serve && nodeenv --node=12.18.3 --npm=6.0.0 env \
&& cd /opt/serve && . env/bin/activate && npm install -g serve \
&& echo "------------------------------------------------------ mkdocs" \
&& pip install -r /home/abc/installed-python-packages/mkdocs-requirements.txt \
&& echo "------------------------------------------------------ utils" \
&& git clone https://github.com/bluxmit/alnoda-workspaces /tmp/alnoda-workspaces \
&& mv /tmp/alnoda-workspaces/utils /home/abc/ || true \
&& rm -rf /tmp/alnoda-workspaces \
&& echo "------------------------------------------------------ user" \
&& mkdir -p /home/static-server \
&& chown -R abc /opt/cronicle \

View file

@ -9,7 +9,7 @@ You can host on your favourite Rasberry Pi.
## Start
```
docker run --name space-1 --user=root -d -p 8020-8030:8020-8030 alnoda/base-workspace
docker run --name space-1 --user=root -d -p 8020-8040:8020-8040 alnoda/base-workspace
```
and open [localhost:8020](http://localhost:8020) in browser.
@ -38,7 +38,7 @@ and open [localhost:8020](http://localhost:8020) in browser.
## Why this image
If you need to schedule scripts and jobs, monitor executions, upload and download files.
1. If you need to schedule scripts and jobs, monitor executions, upload and download files.
## Docs
See our guides on [**getting started**](docs/getting-started.md) and [**advanced features**](../ubuntu-workspace/docs/workspaces.md).

View file

@ -1,55 +1,91 @@
# Get started
# Getting started
This tutorial shows how to scrap Google news on schedule with Base Workspace.
## About
Workspace has full-size browser-base terminal, file manager, and task scheduler.
This workspace has browser-based full-screen terminal, file manager, and task scheduler.
You can upload and dowload files and schedule periodic executios of scripts and jobs.
Workspace is based on the Ubuntu 20 docker image, with common CLI applications, such as Git, Vim, Nano and curl installed.
## Quicklaunch
From the quicklaunch page you can open workspace tools, such as filebrowser or terminal
## Terminal
Workspace has full-size browser-base terminal
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/workspaces/base-workspace/img/base-workspace-terminal.gif?raw=true" alt="Terminal" width="500">
</p>
<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>
Install Python package GNews, execute in terminal
## Scheduler
```
pip install gnews
```
Create python script file, and start editing
```
nano scraper.py
```
Paste the following code snippet. This is scrapper, that will output results to a file
```py
from gnews import GNews
import json
google_news = GNews()
usa_news = google_news.get_news('USA')
with open('usa_news.json', 'w') as f:
json.dump(usa_news, f)
```
Save the file with `Ctrl+s` and return to the terminal with `Ctrl+x`.
Execute the script
```
python3 scraper.py
```
Navigate to Quickstart and Open file browser. View and download the output file
Cronicle can execute on schedule scripts, jobs and tasks. It has nice UI to monitor executions and failures
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/workspaces/base-workspace/img/filebrowser-demo.gif?raw=true" alt="Filebrowser" width="500">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/cronicle.gif" alt="Cronicle" width="750">
</p>
Schedule daily executions with Cronicle
## Install applications
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/workspaces/base-workspace/img/cronicle-demo.gif?raw=true" alt="Filebrowser" width="500">
</p>
Open workspace terminal to install new applications.
Simply execute `apt install` with `sudo`.
For example, install emacs
```sh
sudo apt-get install emacs
```
If you want to install PHP, execute
```sh
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php8.1
```
## Python
Python and Pip are installed. Execute `python3` in terminal.
To install python packages use PIP
```
pip install pandas
```
## Node.js
Use Nodeenv to create Node.js environments.
For example, open workspace terminal, create folder npmgui, and activate environment with node v.12.18.3 and npm v.6.0.0
```
cd /home
mkdir npmgui; cd npmgui
nodeenv --node=12.18.3 --npm=6.0.0 env
```
Let's install package and start node application, explicitly on port 8040
```
. env/bin/activate && npm i -g npm-gui
npm-gui 0.0.0.0:8040
```
In the Quicklaunch go to the tab 'My apps' and open app on the port 8040.
> **NOTE:** If you close terminal, the application will stop. If you want application to keep running after workspace terminal is closed
start it with **"&!"** at the end.
## Keep services runnning
Any application started in the terminal will run as long as your terminal session is alive.
If you want any application or service runing after terminal session is closed, start service with **"&!"** at the end of
the command.
For example, to start *npm-gui* and keep it running after terminal is closed, run
```
npm-gui 0.0.0.0:8040 &!
```

View file

@ -0,0 +1,49 @@
# Get started
This tutorial shows how to scrap Google news on schedule. We use Python for the demonstration purpose.
To start, open workspace terminal and install Python package GNews
```
pip install gnews
```
Create python script
```
nano scraper.py
```
Paste the following code snippet. This is scrapper, that will output results to a file
```py
from gnews import GNews
import json
google_news = GNews()
usa_news = google_news.get_news('USA')
with open('usa_news.json', 'w') as f:
json.dump(usa_news, f)
```
Save the file with `Ctrl+s` and return to the terminal with `Ctrl+x`.
Execute the script
```
python3 scraper.py
```
Navigate to Quickstart and Open file browser. View and download the output file
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/workspaces/base-workspace/img/filebrowser-demo.gif?raw=true" alt="Filebrowser" width="750">
</p>
Schedule daily executions with Cronicle
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/workspaces/base-workspace/img/cronicle-demo.gif?raw=true" alt="Filebrowser" width="750">
</p>

View file

@ -1,5 +1,4 @@
mkdocs==1.3.0
# https://squidfunk.github.io/mkdocs-material/getting-started/#installation
mkdocs-material==8.2.13
# https://github.com/fralau/mkdocs_macros_plugin
mkdocs-macros-plugin==0.7.0
mkdocs-material==8.2.14
mkdocs-material-extensions==1.0.3
mkdocs-macros-plugin==0.7.0
mkdocs-multirepo-plugin==0.3.5

View file

@ -0,0 +1,100 @@
<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": "PORT_8038",
"name": "Port 8038",
"image": "port-8038.png",
"description": "My app running on port 8038"
},
{
"env": "PORT_8039",
"name": "Port 8039",
"image": "port-8039.png",
"description": "My app running on port 8039"
},
{
"env": "PORT_8040",
"name": "Port 8040",
"image": "port-8040.png",
"description": "My app running on port 8040"
}
]
%}
<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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

View file

@ -12,7 +12,10 @@ port_increments = {
"UNGIT_URL": 4,
"TERMINAL_URL": 6,
"MC_URL": 7,
"HTOP_URL": 8
"HTOP_URL": 8,
"PORT_8038": 18,
"PORT_8039": 19,
"PORT_8040": 20
}

View file

@ -4,7 +4,10 @@
nav:
- Home: README.md
- Get started: getting-started.md
- My apps: pages/my-apps.md
- Tutorials:
- Get started: getting-started.md
- Schedule script: schedule-script.md
# ===========================================================

View file

@ -7,7 +7,7 @@ logfile_maxbytes = 1024
[program:filebrowser]
directory=/opt/filebrowser
command=/bin/sh -c " filebrowser "
command=/bin/sh -c " /opt/filebrowser/filebrowser "
stderr_logfile = /var/log/filebrowser/filebrowser-stderr.log
stdout_logfile = /var/log/filebrowser/filebrowser-stdout.log
logfile_maxbytes = 1024

View file

@ -1,11 +1,12 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.2
FROM ${docker_registry}/base-workspace:${image_tag}
USER root
COPY supervisord-codeserver.conf /etc/supervisord/
COPY ./mkdocs/helpers.py /home/docs/macros
COPY docs/getting-started.md /home/docs/docs/getting-started.md
COPY ./mkdocs/IDE.jpg /home/docs/docs/assets/home/

View file

@ -18,7 +18,7 @@ Includes code editor, terminal, scheduler and filebrowser.
## Start
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/codeserver-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 alnoda/codeserver-workspace
```
and open [localhost:8020](http://localhost:8020) in browser.

View file

@ -1,8 +1,11 @@
# Getting started
## Intro
## About
Workspace has browser-based VS-Code version with full-screen terminal, file manager, and task scheduler.
This workspace has browser-based VS-Code version, full-screen terminal, file manager, and task scheduler.
You can code, upload and dowload files and schedule periodic executios of scripts and jobs.
Workspace is based on the Ubuntu 20 docker image, with common CLI applications, such as Git, Vim, Nano and curl installed.
## Quicklaunch
@ -16,83 +19,91 @@ From the quicklaunch page you can open workspace tools, such as code editor or t
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/wid-ui.png" alt="wid-ui.png" width="750">
</p>
You can install any extension from [open-vsx.org](https://open-vsx.org/) that has hundreeds of extensions for VS Code compatible editors.
## Code Editor
<div align="center" style="font-style: italic;">
Demo: Code-server
</div>
Code editor is a browser-based open-source Visual Studio Code. It is fast, responsive, and full-featured. It features code highlighting,
autocompletion, a great number of pre-installed color themes. You can install any extension
from [open-vsx.org](https://open-vsx.org/) that has hundreeds of extensions for VS Code compatible editors.
<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>
## Terminal
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>
## Scheduler
Cronicle can execute on schedule scripts, jobs and tasks. It has nice UI to monitor executions and failures
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/cronicle.gif" alt="Cronicle" width="750">
</p>
## Install applications
Use workspace workspace terminal to install new applications.
Install with ```sudo apt install```. The default *abc* user is allowed to install packages.
Open workspace terminal to install new applications.
Simply execute `apt install` with `sudo`.
For example, in order to install PHP open workspace terminal, and execute
For example, install emacs
```sh
sudo apt-get install emacs
```
If you want to install PHP, execute
```sh
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php8.1
```
## Python
Python and Pip are installed. To use python console, open workspace terminal and execute
Python and Pip are installed. Execute `python3` in terminal.
> `python3`
To install python packages use PIP
install python package with pip, for
> `pip install pandas`
If you are planning to work with python, we recommend to install IPython, that provides a rich toolkit to help
you make the most of using Python interactively. Install and start ipython
> ```pip install ipython```
> `ipython`
```
pip install pandas
```
## Node.js
We recommend to use nodeenv to create different node environments.
Use Nodeenv to create Node.js environments.
For example, open workspace terminal, create folder npmgui, and activate environment with node v. 12.18.3 and npm v.6.0.0
For example, open workspace terminal, create folder npmgui, and activate environment with node v.12.18.3 and npm v.6.0.0
> `cd /home`
> `mkdir npmgui; cd npmgui`
> `nodeenv --node=12.18.3 --npm=6.0.0 env`
```
cd /home
mkdir npmgui; cd npmgui
nodeenv --node=12.18.3 --npm=6.0.0 env
```
Let's install package and start node application
Let's install package and start node application, explicitly on port 8040
> `. env/bin/activate && npm i -g npm-gui`
> `npm-gui 0.0.0.0:8030`
```
. env/bin/activate && npm i -g npm-gui
npm-gui 0.0.0.0:8040
```
Open your browser on http://localhost:8030/
In the Quicklaunch go to the tab 'My apps' and open app on the port 8040.
**NOTE:** If you close terminal, the application will stop. See how to [start applications that reamin live after closing a workspace terminal](#run-applications-and-services-inside-the-workspace)
> **NOTE:** If you close terminal, the application will stop. If you want application to keep running after workspace terminal is closed
start it with **"&!"** at the end.
### Run applications and services inside the workspace
## Keep services runnning
If you want application to keep running after workspace terminal is closed start it with **"&!"** at the end.
Any application started in the terminal will run as long as your terminal session is alive.
If you want any application or service runing after terminal session is closed, start service with **"&!"** at the end of
the command.
For example, in the last section we started *npm-gui* tool with command `npm-gui 0.0.0.0:8030`. If you close the workspace terminal,
this application witll stop running. To keep it running after terminal is closed, execute
For example, to start *npm-gui* and keep it running after terminal is closed, run
> `npm-gui 0.0.0.0:8030 &!`
Now, if you disconnect from the workspace and close terminal, the application will continue running in the workspace, untill [workspace is stopped](#start-and-stop-workspaces).
## Scheduler
Cronicle allows scheduling scripts, jobs and tasks and it has nice UI
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/cronicle.gif" alt="Cronicle" width="750">
</p>
```
npm-gui 0.0.0.0:8040 &!
```

View file

@ -13,7 +13,10 @@ port_increments = {
"IDE_URL": 5,
"TERMINAL_URL": 6,
"MC_URL": 7,
"HTOP_URL": 8
"HTOP_URL": 8,
"PORT_8038": 18,
"PORT_8039": 19,
"PORT_8040": 20
}
# this function name should not be changed

View file

@ -1,12 +1,12 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/ide-workspace:${image_tag}
USER root
COPY settings.json /home/abc/.theia/settings.json
COPY docs/getting-started.md /home/docs/docs/getting-started.md
COPY docs/tutorial.md /home/docs/docs/tutorial.md
RUN apt-get -y update \
# && echo "------------------------------------------------------ utils" \

View file

@ -1,6 +1,4 @@
# Getting started
## Intro
# Elasticsearch workspace
This tutorial demonstrates how to use Elasticsearch workspace to explore cluster and export index to S3.

View file

@ -0,0 +1,73 @@
# ===========================================================
# NAVIGATION
# ===========================================================
nav:
- Home: README.md
- My apps: pages/my-apps.md
- Tutorials:
- Get started: getting-started.md
- Ansible: ansible.md
- Terraform: terraform.md
# ===========================================================
# CONFIGURATION
# ===========================================================
site_name: Infra Workspace
repo_url: https://github.com/bluxmit/alnoda-workspaces
site_url: https://alnoda.org
edit_uri: ""
# ===========================================================
# APPEARANCE
# ===========================================================
theme:
name: 'material'
favicon: 'assets/favicon.ico'
logo: 'assets/Alnoda-logo.svg'
custom_dir: overrides
icon:
repo: fontawesome/brands/git-alt
features:
- navigation.instant
palette:
- scheme: default
toggle:
icon: material/toggle-switch-off-outline
name: Switch to light mode
primary: red
accent: orange
- scheme: slate
toggle:
icon: material/toggle-switch
name: Switch to dark mode
primary: red
accent: orange
extra:
# Link to open when your logo is clicked
homepage: https://alnoda.org
host_url: http://localhost
plugins:
- search
# Enable Macros and jinja2 templates
- macros:
module_name: macros/helpers
extra_javascript:
- javascripts/config.js
- https://polyfill.io/v3/polyfill.min.js?features=es6

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
ARG ruby_global_version=3.1.2
FROM ${docker_registry}/codeserver-workspace:${image_tag}

View file

@ -1,7 +1,6 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.2
## Images used:
ARG BUILD_IMAGE=node:12.18.3
@ -48,15 +47,16 @@ USER root
RUN mkdir -p -m 777 /opt/theia \
&& cd /opt/theia && nodeenv --node=12.18.3 env && . env/bin/activate \
&& mkdir -p -m 777 /home/project \
&& apt-get install -y libsecret-1-dev \
&& rm -rf /home/docs
&& apt-get install -y libsecret-1-dev
COPY --from=0 /opt/theia /opt/theia
COPY settings.json /home/abc/.theia/settings.json
COPY supervisord-theia.conf /etc/supervisord/
COPY mkdocs /home/docs
COPY ./mkdocs/helpers.py /home/docs/macros
COPY docs/getting-started.md /home/docs/docs/getting-started.md
COPY ./mkdocs/IDE.jpg /home/docs/docs/assets/home/
COPY ./mkdocs/README.md /home/docs/docs/README.md
ENV SHELL=/bin/bash \
THEIA_DEFAULT_PLUGINS=local-dir:/opt/theia/plugins \

View file

@ -18,7 +18,7 @@ Includes code editor, terminal, scheduler and filebrowser.
## Start
```
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/ide-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 alnoda/ide-workspace
```
and open [localhost:8020](http://localhost:8020) in browser.

View file

@ -1,10 +1,11 @@
# Getting started
## Intro
## About
The main feature of the workspace is IDE, a browser-based VS-Code version. Often IDE alone is not enough for convenient software development.
In addition, workspace includes full-screen terminal, file manager, and task scheduler. This workspace is based on the Ubuntu 20 docker image,
with typical terminal applications, such as Git installed.
This workspace has browser-based VS-Code version, full-screen terminal, file manager, and task scheduler.
You can code, upload and dowload files and schedule periodic executios of scripts and jobs.
Workspace is based on the Ubuntu 20 docker image, with common CLI applications, such as Git, Vim, Nano and curl installed.
## Quicklaunch
@ -20,24 +21,18 @@ From the quicklaunch page you can open workspace tools, such as code editor or t
## Code Editor
Code editor of this workspace is [**Eclipse Theia**](https://theia-ide.org/docs/) - an open-source version of popular Visual Studio Code IDE.
despite Eclipse Theia is a browser-based code editor, it is fast, responsive, and full-featured. It features code highlighting, autocompletion,
rendering of notebooks has a tree-based file browser, and a great number of pre-installed color themes.
Code editor is a browser-based open-source Visual Studio Code. It is fast, responsive, and full-featured. It features code highlighting,
autocompletion, rendering of notebooks has a tree-based file browser, and a great number of pre-installed color themes.
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/theia-themes.png" alt="theia-themes.png" width="900">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/theia-themes.png" alt="theia-themes.png" width="750">
</p>
You can install any extension from [open-vsx.org](https://open-vsx.org/) that has hundreeds of extensions for VS Code compatible editors.
The IDE is already configured to make code highlighting for a great number of programming languages and file types. It also has many
popular extensions installed
<div align="center" style="font-style: italic;">
Demo: Eclipse Theia
</div>
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/theia.gif" alt="Theia demo" width="900">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/theia.gif" alt="Theia demo" width="750">
</p>
## Terminal
@ -48,67 +43,73 @@ Workspace has full-size browser-base terminal
<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>
## Scheduler
Cronicle can execute on schedule scripts, jobs and tasks. It has nice UI to monitor executions and failures
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/cronicle.gif" alt="Cronicle" width="750">
</p>
## Install applications
Use workspace workspace terminal to install new applications.
Install with ```sudo apt install```. The default *abc* user is allowed to install packages.
Open workspace terminal to install new applications.
Simply execute `apt install` with `sudo`.
For example, in order to install PHP open workspace terminal, and execute
For example, install emacs
```sh
sudo apt-get install emacs
```
If you want to install PHP, execute
```sh
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php8.1
```
## Python
Python and Pip are installed. To use python console, open workspace terminal and execute
Python and Pip are installed. Execute `python3` in terminal.
> `python3`
To install python packages use PIP
install python package with pip, for
> `pip install pandas`
If you are planning to work with python, we recommend to install IPython, that provides a rich toolkit to help
you make the most of using Python interactively. Install and start ipython
> ```pip install ipython```
> `ipython`
```
pip install pandas
```
## Node.js
We recommend to use nodeenv to create different node environments.
Use Nodeenv to create Node.js environments.
For example, open workspace terminal, create folder npmgui, and activate environment with node v. 12.18.3 and npm v.6.0.0
For example, open workspace terminal, create folder npmgui, and activate environment with node v.12.18.3 and npm v.6.0.0
> `cd /home`
> `mkdir npmgui; cd npmgui`
> `nodeenv --node=12.18.3 --npm=6.0.0 env`
```
cd /home
mkdir npmgui; cd npmgui
nodeenv --node=12.18.3 --npm=6.0.0 env
```
Let's install package and start node application
Let's install package and start node application, explicitly on port 8040
> `. env/bin/activate && npm i -g npm-gui`
> `npm-gui 0.0.0.0:8030`
```
. env/bin/activate && npm i -g npm-gui
npm-gui 0.0.0.0:8040
```
Open your browser on http://localhost:8030/
In the Quicklaunch go to the tab 'My apps' and open app on the port 8040.
**NOTE:** If you close terminal, the application will stop. See how to [start applications that reamin live after closing a workspace terminal](#run-applications-and-services-inside-the-workspace)
> **NOTE:** If you close terminal, the application will stop. If you want application to keep running after workspace terminal is closed
start it with **"&!"** at the end.
### Run applications and services inside the workspace
## Keep services runnning
If you want application to keep running after workspace terminal is closed start it with **"&!"** at the end.
Any application started in the terminal will run as long as your terminal session is alive.
If you want any application or service runing after terminal session is closed, start service with **"&!"** at the end of
the command.
For example, in the last section we started *npm-gui* tool with command `npm-gui 0.0.0.0:8030`. If you close the workspace terminal,
this application witll stop running. To keep it running after terminal is closed, execute
For example, to start *npm-gui* and keep it running after terminal is closed, run
> `npm-gui 0.0.0.0:8030 &!`
Now, if you disconnect from the workspace and close terminal, the application will continue running in the workspace, untill [workspace is stopped](#start-and-stop-workspaces).
## Scheduler
Cronicle allows scheduling scripts, jobs and tasks and it has nice UI
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/ide-workspace/img/cronicle.gif" alt="Cronicle" width="750">
</p>
```
npm-gui 0.0.0.0:8040 &!
```

View file

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

View file

@ -0,0 +1,60 @@
"""
Basic example of a Mkdocs-macros module.
Include this {{ macros_info() }} in any page to get complete macro info
"""
import os
port_increments = {
"DOCS_URL": 0,
"FILEBROWSER_URL": 1,
"STATICFS_URL": 2,
"CRONICLE_URL": 3,
"UNGIT_URL": 4,
"IDE_URL": 5,
"TERMINAL_URL": 6,
"MC_URL": 7,
"HTOP_URL": 8,
"PORT_8038": 18,
"PORT_8039": 19,
"PORT_8040": 20
}
# this function name should not be changed
def define_env(env):
"""
This is the hook for defining variables, macros and filters
- variables: the dictionary that contains the environment variables
- macro: a decorator function, to declare a macro.
- filter: a function with one of more arguments,
used to perform a transformation
"""
@env.macro
def get_tool_url(env):
try:
return os.environ[env]
except:
# Get host
host = "localhost"
try:
host = os.environ["WRK_HOST"]
except:
pass
proto = "http"
try:
proto = os.environ["WRK_PROTO"]
except:
pass
# Entry port - port relative to which other ports will be calculated
entry_port = 8020
try:
entry_port = int(os.environ["ENTRY_PORT"])
except:
pass
# Assign port
try:
port = port_increments[env] + entry_port
except:
port = 80
return f"{proto}://{host}:{port}"

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/codeserver-workspace:${image_tag}
USER root
@ -8,7 +8,7 @@ COPY examples/example /home/abc/example
COPY docs/getting-started.md /home/docs/docs/getting-started.md
RUN apt-get -y update \
&& echo "------------------------------------------------------ java 8" \
&& echo "------------------------------------------------------ java 17" \
&& sudo apt-get install -y openjdk-17-jre \
&& apt-get install -y openjdk-17-jdk \
&& echo "------------------------------------------------------ maven" \

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/codeserver-workspace:${image_tag}
USER root

View file

@ -1,7 +1,6 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
## Images used:
ARG BUILD_IMAGE=node:12.18.3

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/ide-workspace:${image_tag}

View file

@ -1,6 +1,6 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/codeserver-workspace:${image_tag}
USER root

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/codeserver-workspace:${image_tag}
USER root

View file

@ -1,7 +1,7 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
## Images used:
ARG BUILD_IMAGE=node:12.18.3

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/ide-workspace:${image_tag}

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/base-workspace:${image_tag}
USER root

View file

@ -27,12 +27,10 @@ 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.
- **RStudio server** - open source version of popular R IDE, browser-based.
- [**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.

View file

@ -1,7 +1,6 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
## Images used:
ARG BUILD_IMAGE=node:12.18.3

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/codeserver-workspace:${image_tag}
USER root

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0
ARG image_tag=2.1
FROM ${docker_registry}/codeserver-workspace:${image_tag}
USER root

View file

@ -1,5 +1,5 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.0-17
ARG image_tag=2.1-17
FROM ${docker_registry}/java-workspace:${image_tag}
USER root

View file

@ -0,0 +1,25 @@
ARG docker_registry=docker.io/alnoda
ARG image_tag=2.1-3.8
FROM ${docker_registry}/python-workspace:${image_tag}
USER root
COPY mkdocs /home/docs
COPY docs/getting-started.md /home/docs/docs/getting-started.md
COPY streamlit /home/abc/.streamlit
RUN echo "------------------------------------------------------ streamlit" \
&& pip install streamlit==1.9.0 \
&& echo "------------------------------------------------------ user" \
&& rm -rf /home/examples \
&& find /home -type d | xargs -I{} chown -R abc {} \
&& find /home -type f | xargs -I{} chown abc {}
COPY examples /home/examples
USER abc

View file

@ -0,0 +1,77 @@
<p align="center">
<img src="https://github.com/bluxmit/alnoda-workspaces/blob/main/img/Alnoda-white.svg" alt="Alnoda logo" width="150">
</p>
# Streamlit workspace
Docker image for building Streamlit applications.
<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 environment for Streamlit app development.
2. If you want to be one command away from coding Streamlit apps.
## Start
```
docker run --name space-1 -d -p 8020-8040:8020-8040 alnoda/streamlit-workspace
```
and open [localhost:8020](http://localhost:8020) in browser.
## Features
- [Streamlit](https://docs.streamlit.io/)
**Python tools:**
- [IPython and Notebooks](https://ipython.readthedocs.io/en/stable/)
- [Pdoc3](https://github.com/pdoc3/pdoc)
- [Pytest-html-reporter](https://github.com/prashanth-sams/pytest-html-reporter)
- [SnakeViz](https://jiffyclub.github.io/snakeviz/)
- [Vprof](https://github.com/nvdv/vprof)
- [Pyinstrument](https://pypi.org/project/pyinstrument/3.0.0b3/)
- [Flameprof](https://github.com/baverman/flameprof/)
- [Pylint-json2html](https://github.com/Exirel/pylint-json2html)
- [Pre-commit](https://pre-commit.com/)
- [Flake8](https://flake8.pycqa.org/en/latest/)
- [Poetry](https://python-poetry.org/)
- [Black](https://github.com/psf/black)
**Dev tools:**
- [**Eclipse Theia**](https://theia-ide.org/docs/) - open source version of popular Visual Studio Code IDE. Theia is trully open-source, has
VS-Code extensions and works in browser. This means it can run inside a docker container on local machine or in cloud. A lot of beautiful color themes and many common plugins are already installed to save time.
- [**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).

View file

@ -0,0 +1,46 @@
# Getting started
## Intro
From the quicklaunch Home 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>
## Streamlit
Open terminal, and launch example streamlit application
```
streamlit run /home/examples/uber.py
```
Open running Streamlit app from the quickstart page
<p align="center">
<img src="https://raw.githubusercontent.com/bluxmit/alnoda-workspaces/main/workspaces/streamlit-workspace/img/streamlit-launch.gif" alt="Start Steamlit" width="750">
</p>
You can luanch any Streamlit app, annd use quickstart page to quickly ope the app.

View file

@ -0,0 +1,49 @@
import streamlit as st
import pandas as pd
import numpy as np
# Using object notation
add_selectbox = st.sidebar.selectbox(
"How would you like to be contacted?",
("Email", "Home phone", "Mobile phone")
)
# Using "with" notation
with st.sidebar:
add_radio = st.radio(
"Choose a shipping method",
("Standard (5-15 days)", "Express (2-5 days)")
)
st.title('Uber pickups in NYC')
DATE_COLUMN = 'date/time'
DATA_URL = ('https://s3-us-west-2.amazonaws.com/'
'streamlit-demo-data/uber-raw-data-sep14.csv.gz')
@st.cache
def load_data(nrows):
data = pd.read_csv(DATA_URL, nrows=nrows)
lowercase = lambda x: str(x).lower()
data.rename(lowercase, axis='columns', inplace=True)
data[DATE_COLUMN] = pd.to_datetime(data[DATE_COLUMN])
return data
data_load_state = st.text('Loading data...')
data = load_data(10000)
data_load_state.text("Done! (using st.cache)")
if st.checkbox('Show raw data'):
st.subheader('Raw data')
st.write(data)
st.subheader('Number of pickups by hour')
hist_values = np.histogram(data[DATE_COLUMN].dt.hour, bins=24, range=(0,24))[0]
st.bar_chart(hist_values)
# Some number in the range 0-23
hour_to_filter = st.slider('hour', 0, 23, 17)
filtered_data = data[data[DATE_COLUMN].dt.hour == hour_to_filter]
st.subheader('Map of all pickups at %s:00' % hour_to_filter)
st.map(filtered_data)

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 KiB

View file

@ -0,0 +1,136 @@
<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": "IDE",
"image": "assets/home/IDE.jpg",
"description": "Browser-based version of Visual Studio Code. Develop in any language, install hundreeds of extensions"
},
{
"env": "TERMINAL_URL",
"name": "Terminal",
"image": "assets/home/Terminal.png",
"description": "Full-fledged browser-based terminal with Z-shell"
},
{
"env": "STREAMLIT_URL",
"name": "Streamlit",
"image": "assets/home/Streamlit.png",
"description": "Not started! Start serving your streamlit app, i.e. <b>streamlit run /home/examples/uber.py </b>"
},
{
"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": "Process 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>

View file

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View file

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View file

Before

Width:  |  Height:  |  Size: 250 KiB

After

Width:  |  Height:  |  Size: 250 KiB

View file

Before

Width:  |  Height:  |  Size: 124 KiB

After

Width:  |  Height:  |  Size: 124 KiB

View file

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

View file

Before

Width:  |  Height:  |  Size: 108 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View file

Before

Width:  |  Height:  |  Size: 652 KiB

After

Width:  |  Height:  |  Size: 652 KiB

View file

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 KiB

View file

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 155 KiB

View file

@ -13,7 +13,8 @@ port_increments = {
"IDE_URL": 5,
"TERMINAL_URL": 6,
"MC_URL": 7,
"HTOP_URL": 8
"HTOP_URL": 8,
"STREAMLIT_URL": 9
}
# this function name should not be changed

View file

@ -11,7 +11,7 @@ nav:
# CONFIGURATION
# ===========================================================
site_name: My Workspace
site_name: Streamlit Workspace
repo_url: https://github.com/bluxmit/alnoda-workspaces
site_url: https://alnoda.org
edit_uri: ""
@ -34,14 +34,14 @@ theme:
toggle:
icon: material/toggle-switch-off-outline
name: Switch to light mode
primary: brown
accent: deep orange
primary: blue grey
accent: amber
- scheme: slate
toggle:
icon: material/toggle-switch
name: Switch to dark mode
primary: orange
accent: red
primary: grey
accent: amber
extra:
# Link to open when your logo is clicked

View file

@ -0,0 +1,183 @@
# Streamlit version: 1.9.0
[global]
# By default, Streamlit checks if the Python watchdog module is available and, if not, prints a warning asking for you to install it. The watchdog module is not required, but highly recommended. It improves Streamlit's ability to detect changes to files in your filesystem.
# If you'd like to turn off this warning, set this to True.
# Default: false
disableWatchdogWarning = false
# If True, will show a warning when you run a Streamlit-enabled script via "python my_script.py".
# Default: true
showWarningOnDirectExecution = true
# DataFrame serialization.
# Acceptable values: - 'legacy': Serialize DataFrames using Streamlit's custom format. Slow but battle-tested. - 'arrow': Serialize DataFrames using Apache Arrow. Much faster and versatile.
# Default: "arrow"
dataFrameSerialization = "arrow"
[logger]
# Level of logging: 'error', 'warning', 'info', or 'debug'.
# Default: 'info'
level = "info"
# String format for logging messages. If logger.datetimeFormat is set, logger messages will default to `%(asctime)s.%(msecs)03d %(message)s`. See [Python's documentation](https://docs.python.org/2.6/library/logging.html#formatter-objects) for available attributes.
# Default: "%(asctime)s %(message)s"
messageFormat = "%(asctime)s %(message)s"
[client]
# Whether to enable st.cache.
# Default: true
caching = true
# If false, makes your Streamlit script not draw to a Streamlit app.
# Default: true
displayEnabled = true
# Controls whether uncaught app exceptions are displayed in the browser. By default, this is set to True and Streamlit displays app exceptions and associated tracebacks in the browser.
# If set to False, an exception will result in a generic message being shown in the browser, and exceptions and tracebacks will be printed to the console only.
# Default: true
showErrorDetails = true
[runner]
# Allows you to type a variable or string by itself in a single line of Python code to write it to the app.
# Default: true
magicEnabled = true
# Install a Python tracer to allow you to stop or pause your script at any point and introspect it. As a side-effect, this slows down your script's execution.
# Default: false
installTracer = false
# Sets the MPLBACKEND environment variable to Agg inside Streamlit to prevent Python crashing.
# Default: true
fixMatplotlib = true
# Run the Python Garbage Collector after each script execution. This can help avoid excess memory use in Streamlit apps, but could introduce delay in rerunning the app script for high-memory-use applications.
# Default: true
postScriptGC = true
# Handle script rerun requests immediately, rather than waiting for script execution to reach a yield point. Enabling this will make Streamlit much more responsive to user interaction, but it can lead to race conditions in apps that mutate session_state data outside of explicit session_state assignment statements.
# Default: false
fastReruns = false
[server]
# List of folders that should not be watched for changes. This impacts both "Run on Save" and @st.cache.
# Relative paths will be taken as relative to the current working directory.
# Example: ['/home/user1/env', 'relative/path/to/folder']
# Default: []
folderWatchBlacklist = []
# Change the type of file watcher used by Streamlit, or turn it off completely.
# Allowed values: * "auto" : Streamlit will attempt to use the watchdog module, and falls back to polling if watchdog is not available. * "watchdog" : Force Streamlit to use the watchdog module. * "poll" : Force Streamlit to always use polling. * "none" : Streamlit will not watch files.
# Default: "auto"
fileWatcherType = "auto"
# Symmetric key used to produce signed cookies. If deploying on multiple replicas, this should be set to the same value across all replicas to ensure they all share the same secret.
# Default: randomly generated secret key.
# cookieSecret =
# If false, will attempt to open a browser window on start.
# Default: false unless (1) we are on a Linux box where DISPLAY is unset, or (2) we are running in the Streamlit Atom plugin.
headless = false
# Automatically rerun script when the file is modified on disk.
# Default: false
runOnSave = false
# The address where the server will listen for client and browser connections. Use this if you want to bind the server to a specific address. If set, the server will only be accessible from this address, and not from any aliases (like localhost).
# Default: (unset)
# address =
# The port where the server will listen for browser connections.
# Default: 8501
port = 8029
# The base path for the URL where Streamlit should be served from.
# Default: ""
baseUrlPath = ""
# Enables support for Cross-Origin Request Sharing (CORS) protection, for added security.
# Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is on and `server.enableCORS` is off at the same time, we will prioritize `server.enableXsrfProtection`.
# Default: true
enableCORS = false
# Enables support for Cross-Site Request Forgery (XSRF) protection, for added security.
# Due to conflicts between CORS and XSRF, if `server.enableXsrfProtection` is on and `server.enableCORS` is off at the same time, we will prioritize `server.enableXsrfProtection`.
# Default: true
enableXsrfProtection = false
# Max size, in megabytes, for files uploaded with the file_uploader.
# Default: 200
maxUploadSize = 200
# Max size, in megabytes, of messages that can be sent via the WebSocket connection.
# Default: 200
maxMessageSize = 200
# Enables support for websocket compression.
# Default: false
enableWebsocketCompression = false
[browser]
# Internet address where users should point their browsers in order to connect to the app. Can be IP address or DNS name and path.
# This is used to: - Set the correct URL for CORS and XSRF protection purposes. - Show the URL on the terminal - Open the browser
# Default: 'localhost'
serverAddress = "0.0.0.0"
# Whether to send usage statistics to Streamlit.
# Default: true
gatherUsageStats = true
# Port where users should point their browsers in order to connect to the app.
# This is used to: - Set the correct URL for CORS and XSRF protection purposes. - Show the URL on the terminal - Open the browser
# Default: whatever value is set in server.port.
serverPort = 8029
[mapbox]
# Configure Streamlit to use a custom Mapbox token for elements like st.pydeck_chart and st.map. To get a token for yourself, create an account at https://mapbox.com. It's free (for moderate usage levels)!
# Default: ""
token = ""
[deprecation]
# Set to false to disable the deprecation warning for the file uploader encoding.
# Default: true
showfileUploaderEncoding = true
# Set to false to disable the deprecation warning for using the global pyplot instance.
# Default: true
showPyplotGlobalUse = true
[theme]
# The preset Streamlit theme that your custom theme inherits from. One of "light" or "dark".
# base =
# Primary accent color for interactive elements.
# primaryColor =
# Background color for the main content area.
# backgroundColor =
# Background color used for the sidebar and most interactive widgets.
# secondaryBackgroundColor =
# Color used for almost all text.
# textColor =
# Font family for all text in the app, except code blocks. One of "sans serif", "serif", or "monospace".
# font =

View file

@ -1,4 +1,4 @@
FROM alnoda/ubuntu-workspace:20.04-2.0
FROM alnoda/ubuntu-workspace:20.04-2.1
USER root

View file

@ -123,8 +123,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
&& curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose \
&& chmod +x /usr/local/bin/docker-compose \
&& echo "------------------------------------------------------ Web-based terminal" \
&& cd /tmp && wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.aarch64 \
&& mv ttyd.aarch64 /usr/bin/ttyd \
&& cd /tmp && wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.x86_64 \
&& mv ttyd.x86_64 /usr/bin/ttyd \
&& chmod +x /usr/bin/ttyd \
&& echo "------------------------------------------------------ utils" \
&& git clone https://github.com/bluxmit/alnoda-workspaces /tmp/alnoda-workspaces \

View file

@ -6,11 +6,13 @@ COPY zsh-in-docker.sh /tmp/zsh-in-docker.sh
# Systemctl within Docker and Python 3.9
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update \
&& apt-get install -y wget \
&& wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl.py -O /usr/local/bin/systemctl \
&& chmod 0777 /usr/local/bin/systemctl \
&& echo "------------------------------------------------------ Common stuff" \
&& apt-get install -y sudo curl wget telnet jq \
&& apt-get install -y software-properties-common \
&& apt-get install -y zip gzip tar \
&& echo "------------------------------------------------------ docker systemctl replacement" \
&& wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -O /usr/local/bin/systemctl \
&& chmod 0777 /usr/local/bin/systemctl \
&& echo "------------------------------------------------------ User" \
&& useradd -u 8877 abc \
&& chmod -R 777 /home \
@ -24,8 +26,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y update \
&& pip install --upgrade setuptools \
&& pip install --upgrade distlib \
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 \
&& echo "------------------------------------------------------ Common stuff" \
&& apt-get install -y sudo curl wget telnet jq \
&& echo "------------------------------------------------------ Allow users some priviledged actions" \
&& echo "# Allow non-admin users to install packages" >> /etc/sudoers \
&& echo "abc ALL = NOPASSWD : /usr/bin/apt, /usr/bin/apt-get, /usr/bin/aptitude, /usr/bin/add-apt-repository, /usr/local/bin/pip, /usr/local/bin/systemctl, /usr/bin/dpkg, /usr/sbin/dpkg-reconfigure" >> /etc/sudoers \
@ -126,8 +126,8 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get -y update \
&& pip install glances==3.2.5 \
&& pip install vizex==2.1.0 \
&& echo "------------------------------------------------------ Web-based terminal" \
&& cd /tmp && wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.aarch64 \
&& mv ttyd.aarch64 /usr/bin/ttyd \
&& cd /tmp && wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.x86_64 \
&& mv ttyd.x86_64 /usr/bin/ttyd \
&& chmod +x /usr/bin/ttyd \
&& echo "------------------------------------------------------ utils" \
&& git clone https://github.com/bluxmit/alnoda-workspaces /tmp/alnoda-workspaces \
@ -165,6 +165,7 @@ ENV PATH="/home/abc/.local/bin:${PATH}"
# note! this will have consequences only when started as root (docker run ... --user root ...)
# systemctl start systemd-journald
# I remove this from entrypoint, as it is not used significantly, but slows down the start
# this entrypoint should be the same for all images that are built on top of this one
ENTRYPOINT /etc/init.d/cron start; systemctl start systemd-journald; supervisord -c "/etc/supervisord/unified-supervisord.conf"
ENTRYPOINT /etc/init.d/cron start; supervisord -c "/etc/supervisord/unified-supervisord.conf"

View file

@ -158,7 +158,7 @@ command to execute outside of the workspace
To start a workspace simply execute in terminal
```sh
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/ide-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 alnoda/ide-workspace
```
*(It is recommended to run workspace in the daemon mode)*
@ -201,7 +201,7 @@ You can work in Ubuntu terminal now. Execute the followinng command to know your
## Multiple workspaces
Every workspace requires range of ports. If one workspace is up and running, the ports 8020-8035 are taken.
Every workspace requires range of ports. If one workspace is up and running, the ports 8020-8040 are taken.
ide-workspace itself uses 9 ports (8020-8028), but it is recommended to map several extra ports just in case. Having extra ports,
you can always launch new applications on these ports, and they will be immediately exposed outside of the workspace.
@ -213,14 +213,14 @@ If you are planning to run more than one workspace at the same time, you can run
the different port range, for example
```sh
docker run --name space-2 -d -p 8040-8055:8020-8035 -e ENTRY_PORT=8040 alnoda/ide-workspace
docker run --name space-2 -d -p 8050-8070:8020-8040 -e ENTRY_PORT=8050 alnoda/ide-workspace
```
Notice that in addition we need to set environmental variable ENTRY_PORT, which should be equal to the first port in the new range.
Workspace UI usues this variable to know the new port range, and redirects to the proper addresses of the workspace applications' UIs.
## Understanding ports
Usually workspace was started with a port range mapping ***-p 8020-8035***.
Usually workspace was started with a port range mapping ***-p 8020-8040***.
This is because workspace contains a set of applications with browser-based UI
| Port | Application |
@ -252,13 +252,13 @@ If you are planning to expose more applications
from inside of a container, add additional port mapping, for example
```sh
docker run --name space-1 -d -p 8020-8035:8020-8035 -p 8080:8080 alnoda/ide-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 -p 8080:8080 alnoda/ide-workspace
```
You can add multiple port mappings:
```sh
docker run --name space-1 -d -p 8020-8035:8020-8035 -p 8080:8080 -p 443:443 alnoda/ide-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 -p 8080:8080 -p 443:443 alnoda/ide-workspace
```
**NOTE:** It is not a problem if you don't expose any ports, but later on realise you need them -
@ -366,7 +366,7 @@ There are two concepts to keep in mind: **images** and **containers**. Images ar
is an image. When you execute this command
```sh
docker run --name space-1 -d -p 8020-8035:8020-8035 alnoda/ide-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 alnoda/ide-workspace
```
you create container called **space-1** from the image **alnoda/ide-workspace**. You can create any number of containers, but you need to
@ -526,7 +526,7 @@ The simplest deployment of the workspace requires only 3 steps:
- ssh to the remote server and start workspace
```
docker run --name space-1 -d -p 8020-8035:8020-8035 -e WRK_HOST="<ip-of-your-remote-server>" alnoda/ide-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 -e WRK_HOST="<ip-of-your-remote-server>" alnoda/ide-workspace
```
**NOTE:** When running workspace on the remote server, add envronmental variable `-e WRK_HOST="<ip-of-your-remote-server>"`.
@ -537,7 +537,7 @@ Open in your browser `<ip-of-your-remote-server>:8020`
If docker-in-docker is required, then
```
docker run --name space-1 -d -p 8020-8035:8020-8035 -e WRK_HOST="<ip-of-your-remote-server>" -v /var/run/docker.sock:/var/run/docker.sock alnoda/ide-workspace
docker run --name space-1 -d -p 8020-8040:8020-8040 -e WRK_HOST="<ip-of-your-remote-server>" -v /var/run/docker.sock:/var/run/docker.sock alnoda/ide-workspace
```
This way launches workspace in cloud, but such workspace is not secure, everyone who knows IP of your server will be able to use it.