Skip to content

Commit 14f2766

Browse files
Add base lab & update to ubuntu 22.04
1 parent 7e6fcd5 commit 14f2766

File tree

8 files changed

+169
-28
lines changed

8 files changed

+169
-28
lines changed

README.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ It is based on [pyxterm.js](https://github.com/cs01/pyxtermjs) by Chad Smith.
55

66
![screenshot](./pyxtermjs.gif)
77

8-
## Usage
8+
## Usage
99

1010
To use this URL to add the module to your class:
1111

@@ -35,6 +35,7 @@ You may optionally specify any of the following station-only settings:
3535
, "enable": {
3636
"teacher": true,
3737
"student": true
38+
}
3839
}
3940
```
4041

@@ -71,24 +72,8 @@ optional arguments:
7172

7273
To enable an even more secure usage, you can also start and or modify the included Dockerfile.
7374

74-
Build it via:
75+
Build and run it via:
7576

7677
``` bash
77-
$ docker build . -t arduino
78+
$ docker-compose up
7879
```
79-
80-
And run it via:
81-
82-
``` bash
83-
docker run -it -p 5000:5000 arduino
84-
```
85-
86-
If you want to let the user flash or work with Arduinos, as we want, you can use the following option:
87-
88-
```
89-
chmod a+rw /dev/ttyACM0
90-
docker run -it -p 5000:5000 --device=/dev/ttyACM0 arduino
91-
92-
```
93-
94-
We have defined a user with reduced root access, that is why we have to allow others to read and write on `/dev/ttyACM0` before the internal user can flash the device.

docker-compose.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ services:
33
pyxtermjs:
44
build: .
55
image: crosslab/edrys_pyxtermjs:latest
6+
container_name: edrys_pyxtermjs
67
ports:
78
- "5000:5000"
89
environment:

docker/arduino/Dockerfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
FROM crosslab/edrys_pyxtermjs:latest
2+
#FROM pyxtermjs
3+
4+
#ensure we are root for software install
5+
USER root
6+
7+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \
8+
curl \
9+
make
10+
11+
# prepare arduino-cli for container (install as root)
12+
RUN cd / && curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
13+
14+
ARG user=appuser
15+
16+
# add ${user} to dailout group for Arduino device access
17+
RUN usermod -a -G dialout ${user}
18+
19+
# Switch to ${user} for arduino-cli setup
20+
USER ${user}
21+
22+
RUN arduino-cli upgrade && arduino-cli core update-index
23+
24+
# install arduino-cli libraries
25+
RUN arduino-cli lib install \
26+
"Adafruit Circuit Playground" \
27+
"Adafruit NeoPixel" \
28+
"Adafruit Unified Sensor" \
29+
"Adafruit ZeroTimer Library" \
30+
"ArduinoJson" \
31+
"DHT sensor library" \
32+
"FastLED" \
33+
"Firmata" \
34+
"LiquidCrystal" \
35+
"SD" \
36+
"Servo" \
37+
"Stepper" \
38+
"TFT" \
39+
"WiFi"
40+
41+
# install arduino-cli cores
42+
RUN arduino-cli core install arduino:avr
43+
#RUN arduino-cli core install arduino:esp32
44+
#RUN arduino-cli core install arduino:mbed_edge
45+
#RUN arduino-cli core install arduino:mbed_giga
46+
#RUN arduino-cli core install arduino:mbed_nano
47+
#RUN arduino-cli core install arduino:mbed_nicla
48+
#RUN arduino-cli core install arduino:mbed_opta
49+
#RUN arduino-cli core install arduino:mbed_portenta
50+
#RUN arduino-cli core install arduino:mbed_rp2040
51+
RUN arduino-cli core install arduino:megaavr
52+
#RUN arduino-cli core install arduino:nrf52
53+
#RUN arduino-cli core install arduino:renesas_portenta
54+
#RUN arduino-cli core install arduino:sam
55+
#RUN arduino-cli core install arduino:samd
56+
#RUN arduino-cli core install arduino:renesas_uno
57+
58+
# ensure we are switched to user Switch to user we must not set group to make the configuration done above apply
59+
# !! if ${user} is not setup correctly the next line might result in group being root !!
60+
USER ${user}

docker/arduino/docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: '2.4' # since device_cgroup_rules support was removed in some
2+
# newer versions of docker-compose-yaml depending on the
3+
# version of docker compose and readded later
4+
# see https://github.com/docker/compose/issues/9059
5+
6+
7+
services:
8+
pyxtermjs:
9+
build: .
10+
image: crosslab/edrys_pyxtermjs_arduino:latest
11+
container_name: edrys_pyxtermjs_arduino
12+
ports:
13+
- "5000:5000"
14+
environment:
15+
- PYXTERM_CMD=zsh
16+
devices:
17+
- /dev/ttyACM0
18+
device_cgroup_rules:
19+
- "c 166:* rmv"
20+
- "c 189:* rmv"

docker/devserver/Dockerfile renamed to docker/development/Dockerfile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@ FROM crosslab/edrys_pyxtermjs:latest
33
# change the user, so that the packages can be installed on top of edrys_pyxtermjs
44
USER root
55

6-
RUN apt-get update && apt-get install -y apt-transport-https
6+
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y apt-transport-https
77

88
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mono-complete mono-mcs
99

10-
RUN apt-get install -y golang-go
10+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y g++ make
1111

12-
RUN apt-get install -y rustc
12+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y golang-go
1313

14-
RUN apt-get install -y default-jdk
14+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y rustc
15+
16+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y default-jdk
1517

1618
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y r-base r-base-dev r-recommended \
1719
r-cran-car \
@@ -38,15 +40,15 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y r-base r-base-dev r-recomm
3840
r-cran-xts \
3941
r-cran-zoo
4042

41-
RUN apt-get install -y julia
43+
# RUN DEBIAN_FRONTEND=noninteractive apt-get install -y julia
4244

43-
RUN apt-get install -y ghc
45+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y ghc
4446

45-
RUN apt-get install -y clojure
47+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y clojure
4648

47-
RUN apt-get install -y lua5.3
49+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y lua5.3
4850

49-
RUN apt-get install nodejs
51+
RUN DEBIAN_FRONTEND=noninteractive apt-get install nodejs
5052

5153
# get back to the default appuser
5254
USER appuser

docker/development/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Edrys-Development-Environment
2+
3+
This folder contains a Linux development environment based on the base `crosslab/edrys_pyxtermjs:latest` image.
4+
You can modify the `Dockerfile` to add additional packages or change the configuration.
5+
Start and build it via:
6+
7+
``` bash
8+
$ docker-compose up --build
9+
```
10+
11+
or directly load our prebuild image from dockerhub:
12+
13+
``` bash
14+
$ docker run -it -p 5000:5000 crosslab/edrys_pyxtermjs_development:latest
15+
```
16+

docker/development/docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: '3'
2+
services:
3+
pyxtermjs:
4+
build: .
5+
image: crosslab/edrys_pyxtermjs_development:latest
6+
container_name: edrys_pyxtermjs_development
7+
ports:
8+
- "5000:5000"
9+
environment:
10+
- PYXTERM_CMD=zsh

laboratory.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
id: 79sFHo6ONB1S25cTN7emXmOibQ2HNWb2G9X3Xn2x
2+
createdBy: Mj92OSQdrbcE
3+
dateCreated: 1704715062608
4+
name: PyTermJS - Ubuntu Terminal
5+
meta:
6+
logo: >-
7+
https://repository-images.githubusercontent.com/487803615/83e1b148-5e81-4733-8ffc-e9ac5340547e
8+
description: >-
9+
This classroom provides base implementation for running a terminal-server on
10+
Ubuntu 22.04. Make sure that one participant shares a pytermjs session
11+
directly or from a docker file as described <a
12+
href="https://github.com/Cross-Lab-Project/edrys_module-pyxtermjs">here</a>
13+
or run:
14+
15+
<br><br>
16+
17+
<code style="margin-bottom: 5px">docker run -it -p 5000:5000
18+
crosslab/edrys_pyxtermjs</code>
19+
20+
<hr>
21+
22+
<code>docker run -it -p 5000:5000
23+
crosslab/edrys_pyxtermjs_development</code>
24+
25+
<hr>
26+
27+
<code>docker run -itd -p 5000:5000 crosslab/edrys_pyxtermjs_arduino
28+
--device=/dev/ttyACM0:/dev/ttyACM0 --device-cgroup-rule='c 166:* rmv'
29+
--device-cgroup-rule='c 189:* rmv'</code>
30+
selfAssign: true
31+
defaultNumberOfRooms: 0
32+
members:
33+
teacher: []
34+
student: []
35+
modules:
36+
- url: https://cross-lab-project.github.io/edrys_module-pyxtermjs/index.html
37+
config: ''
38+
studentConfig: ''
39+
teacherConfig: ''
40+
stationConfig:
41+
server: http://localhost:5000/pty
42+
enable:
43+
teacher: true
44+
student: true
45+
showInCustom: station
46+
width: full
47+
height: medium

0 commit comments

Comments
 (0)