Compare commits

...

13 Commits
main ... dev

26 changed files with 203 additions and 53 deletions

7
.gitattributes vendored
View File

@ -5,10 +5,15 @@
*.sh text eol=lf *.sh text eol=lf
*.py text eol=lf *.py text eol=lf
*.bat text eol=crlf *.bat text eol=crlf
<<<<<<< HEAD
*.desktop text eol=lf
scripts/* text eol=lf
=======
desktopinit text eol=lf desktopinit text eol=lf
klayout text eol=lf klayout text eol=lf
.bashrc text eol=lf .bashrc text eol=lf
setwallpaper text eol=lf setwallpaper text eol=lf
startserver text eol=lf startserver text eol=lf
*.desktop text eol=lf *.desktop text eol=lf
xschemrc text eol=lf xschemrc text eol=lf
>>>>>>> 9337a522bfce850a6848722c6ba4973ce31ea63b

View File

@ -29,7 +29,7 @@ include_toc: true
- **digital-heavy**: Workflow with all the digital tools - **digital-heavy**: Workflow with all the digital tools
- **heavy**: Workflow with all the previous tools - **heavy**: Workflow with all the previous tools
> Flavors: web / desktop > Flavors: Web / Desktop | [Docker image list](https://git.1159.cl/Mario1159/osic-stacks/packages)
## Usage ## Usage
@ -55,7 +55,7 @@ Execute the next script in powershell and follow the container initialization pr
This script will run the container inside WSL and bind the enviroments variables for [WSLg](https://github.com/microsoft/wslg/blob/main/samples/container/Containers.md). Also, it will download itself so it will exists locally. This script will run the container inside WSL and bind the enviroments variables for [WSLg](https://github.com/microsoft/wslg/blob/main/samples/container/Containers.md). Also, it will download itself so it will exists locally.
##### Linux ##### Linux
Execute the next script in your terminal replacing `<container_name>` by any name and `<stack>` by an stack from the previous [stack list](#stacks). Execute the next docker command in your terminal replacing `<container_name>` by any name and `<stack>` by an stack from the previous [stack list](#stacks).
```sh ```sh
docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --name <container_name> git.1159.cl/mario1159/<stack>-desktop docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --name <container_name> git.1159.cl/mario1159/<stack>-desktop
``` ```
@ -69,8 +69,9 @@ Install `Xquartz` and run the linux previous command.
#### 1b. Starting a container with a **Web** VNC client #### 1b. Starting a container with a **Web** VNC client
If you prefer running the container in your web browser instead of in your integrated terminal, you can select the web flavor of any stack. In this case, it is not necessary to bind extra environment variables for enabling native graphics output. If you prefer running the container in your web browser instead of in your integrated terminal, you can select the web flavor of any stack. In this case, it is not necessary to bind extra environment variables for enabling native graphics output.
```sh ```sh
docker run -it -p 8444:8444 --name <container_name> git.1159.cl/mario1159/<stack>-web docker run -d --security-opt seccomp=unconfined -p 8444:8444 --name <container_name> git.1159.cl/mario1159/<stack>-web
``` ```
This can also be deployed from a docker compose file, an example is provided [here](https://git.1159.cl/Mario1159/osic-stacks/src/branch/main/compose/docker-compose.yml).
### 2. Connecting to the container ### 2. Connecting to the container
@ -86,9 +87,11 @@ docker exec -it <container_name> bash
Access from the web to the VNC client at `https://localhost:8444`. Access from the web to the VNC client at `https://localhost:8444`.
The default username is `designer` and the password is `password`.
### 3. Configure Volare ### 3. Configure Volare
List the available PDKs and choose one to install. Choose a PDK variant from the following list to install.
| PDK Technology | PDK Variant | | PDK Technology | PDK Variant |
|----------------|-------------| |----------------|-------------|
@ -98,9 +101,16 @@ List the available PDKs and choose one to install.
| | gf180mcuB | | | gf180mcuB |
| | gf180mcuC | | | gf180mcuC |
Replace `<pdk_variant>` and `<pdk_tech>` correspondingly by one of the PDKs listed above.
To automatically download and configure the latest version of the PDK to this date, run `volare_set_latest` replacing `<pdk_variant>` for a PDK variant from the list.
```sh ```sh
echo 'export PDK=<pdk_variant>' >> ~/.bashrc volare_set_latest <pdk_variant>
```
To manually set any version of the PDK, set the `PDK` environment variable, list the available PDKs and choose one to install replacing `<pdk_variant>` and `<pdk_tech>` correspondingly by one of the PDKs listed above.
```sh
echo 'export PDK=<pdk_variant>' >> ~/.bashrc
source ~/.bashrc
volare ls-remote --pdk <pdk_tech> volare ls-remote --pdk <pdk_tech>
volare enable --pdk <pdk_tech> <version_id> volare enable --pdk <pdk_tech> <version_id>
``` ```
@ -117,6 +127,20 @@ or you can also install packages from the [AUR](https://aur.archlinux.org/) usin
```paru <package_name>``` ```paru <package_name>```
## Updating the image
To update to the latest image version, first make sure you have all your important data linked by a volume or backed up in an external storage, **all your files outside any linked volume will be lost**.
After you backed your data, stop the container, delete it, pull the latest image and finally start the container again as the first step of the usage section.
```
docker stop <container_name>
docker rm <container_name>
docker pull <image>
docker run -d --security-opt seccomp=unconfined -p 8444:8444 -v <path_to_volume>:/home/designer/shared --name <container_name> <image-web>
```
> Container names can be seen with `docker ps -a`
## Custom Images ## Custom Images
For creating an image with your own pre-installed set of packages for your team you can create your own docker image extending the stacks, just as the stacks extend the base image. For reference check the stacks dockerfiles in the `stack` folder. For creating an image with your own pre-installed set of packages for your team you can create your own docker image extending the stacks, just as the stacks extend the base image. For reference check the stacks dockerfiles in the `stack` folder.

View File

@ -6,7 +6,21 @@ FROM greyltc/archlinux-aur:paru as osicstacks-base-desktop
RUN pacman -Syuq --noconfirm RUN pacman -Syuq --noconfirm
# Install packages # Install packages
RUN aur-install sudo git git-lfs python python-pip python-pipx xz gnu-free-fonts vim ngspice gedit jupyter-notebook xterm RUN aur-install \
sudo \
git \
git-lfs \
python \
python-pip \
python-pipx \
xz \
gnu-free-fonts \
gvim \
ngspice \
gedit \
jupyter-notebook \
xterm
ENV TERM=xterm EDITOR=gedit ENV TERM=xterm EDITOR=gedit
# Clean cache # Clean cache
@ -31,5 +45,17 @@ RUN mkdir -p .scripts
COPY --chown=designer:designer --chmod=755 scripts/* /home/designer/.scripts COPY --chown=designer:designer --chmod=755 scripts/* /home/designer/.scripts
ENV PATH="/home/designer/.scripts:${PATH}" ENV PATH="/home/designer/.scripts:${PATH}"
# Add motd
RUN echo "custom_motd" >> "/home/designer/.bashrc"
# Add media includes
RUN mkdir -p /home/designer/.media
COPY --chown=designer:designer include/media/* /home/designer/.media
# Setup Docker in Docker (DiD)
RUN aur-install docker
RUN sudo groupadd docker
RUN sudo usermod -aG docker $USER
# Initialize the enviroment keeping container alive # Initialize the enviroment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]

View File

@ -27,12 +27,14 @@ RUN sudo usermod -aG root designer
# Install XFCE # Install XFCE
RUN sudo pacman -S --noconfirm xorg xfce4 RUN sudo pacman -S --noconfirm xorg xfce4
# Copy includes # Copy autostart include
RUN mkdir -p /home/designer/.media
COPY --chown=designer:designer include/media/* /home/designer/.media
RUN mkdir -p /home/designer/.config/autostart RUN mkdir -p /home/designer/.config/autostart
COPY --chown=designer:designer include/desktopinit.desktop /home/designer/.config/autostart COPY --chown=designer:designer include/desktop_init.desktop /home/designer/.config/autostart
# Set login user
ENV LOGIN_USER designer
ENV LOGIN_PASSWORD password
# Start VNC & desktop environment # Start VNC & desktop environment
WORKDIR /home/designer WORKDIR /home/designer
ENTRYPOINT ["startserver"] ENTRYPOINT ["start_server"]

View File

@ -0,0 +1,13 @@
# Example deploy from docker compose
services:
osicstacks-heavy-web:
# Image from https://git.1159.cl/Mario1159/osic-stacks/packages
image: git.1159.cl/mario1159/heavy-web
port:
- 8444:8444
environment:
- LOGIN_USER: designer
- LOGIN_PASSWORD: password
- PDK: sky130A
volumes:
- ./data:/home/designer/shared

View File

@ -1,4 +1,4 @@
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=OSICStacks-DesktopInit Name=OSICStacks-DesktopInit
Exec=sh -c "sleep 1 && desktopinit" Exec=sh -c "sleep 1 && desktop_init"

View File

@ -0,0 +1,8 @@
__ __
__ /\ \__ /\ \
___ ____/\_\ ___ ____\ \ ,_\ __ ___\ \ \/'\ ____
/ __`\ /',__\/\ \ /'___\ /',__\\ \ \/ /'__`\ /'___\ \ , < /',__\
/\ \L\ \/\__, `\ \ \/\ \__/ /\__, `\\ \ \_/\ \L\.\_/\ \__/\ \ \\`\ /\__, `\
\ \____/\/\____/\ \_\ \____\ \/\____/ \ \__\ \__/.\_\ \____\\ \_\ \_\/\____/
\/___/ \/___/ \/_/\/____/ \/___/ \/__/\/__/\/_/\/____/ \/_/\/_/\/___/

16
scripts/custom_motd Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
cat $HOME/.media/ascii_art.txt
if [[ ! -z "${PDK_TECH}" ]]; then
if [[ ! -z "${PDK_VERSION}" ]]; then
volare_set_latest
fi
else
echo "
There is not an active PDK, Use:
volare_set_latest <pdk_variant>
to automatically download and configure the latest version of a PDK.
You can also manually configure a PDK using volare and setting the PDK_TECH environment variable
"
fi

18
scripts/desktop_init Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set_wallpaper $HOME/.media/default_wallpaper.png
xfce4-terminal
# Add application launcher
mkdir -p $HOME/.config/xfce4/panel/launcher-18
ln /usr/share/applications/klayoutEditor.desktop $HOME/.config/xfce4/panel/launcher-18
xfconf-query -c xfce4-panel -p /plugins/plugin-18 -t string -s "launcher" --create
xfconf-query -c xfce4-panel -p /plugins/plugin-18/items -t string -s "klayoutEditor.desktop" -a --create
# Delete plugin id array
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -rR
# Recreate id array with new values
xfconf-query -c xfce4-panel -p /panels/panel-2/plugin-ids -t int -s 18
# Restart panel
xfce4-panel -r

View File

@ -1,2 +0,0 @@
#!/bin/bash
setwallpaper /home/designer/.media/defaultwallpaper.png

2
scripts/magic Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
/bin/magic -rcfile $PDK_ROOT/$PDK/libs.tech/magic/$PDK.magicrc $@

3
scripts/start_desktop Normal file
View File

@ -0,0 +1,3 @@
#!/bin/bash
volare_set_latest
sleep infinity

34
scripts/start_server Normal file
View File

@ -0,0 +1,34 @@
#!/bin/bash
cd $HOME
# Run VNC server
echo 'Running VNC Server'
mkdir -p $HOME/.vnc
touch "$HOME/.Xauthority"
touch "$HOME/.vnc/passwd"
echo -e "$LOGIN_PASSWORD\n$LOGIN_PASSWORD\n" | vncpasswd -u $LOGIN_USER -w -r
kasm_vnc_options="
-httpd /usr/share/kasmvnc/www \
-SecurityTypes None \
-disableBasicAuth \
-KasmPasswordFile $HOME/.kasmpasswd \
-MaxVideoResolution 1920x1080 \
-interface 0.0.0.0 \
-websocketPort 8444 \
-cert /etc/ssl/certs/ssl-cert-snakeoil.pem \
-key /etc/ssl/private/ssl-cert-snakeoil.key \
-auth $HOME/.Xauthority \
-sslOnly 0 \
-desktop osicstacks \
-rfbauth $HOME/.vnc/passwd"
vncserver -select-de xfce -fg -xstartup $HOME/.scripts/xstartup $kasm_vnc_options &
#if ! docker info > /dev/null 2>&1; then
sudo dockerd &
#fi
# Keep container alive
sleep infinity

View File

@ -1,22 +0,0 @@
#!/bin/bash
cd /home/designer
# Run VNC server
eval $(vncserver -dry-run) &
echo -e "password\npassword\n" | vncpasswd -u designer -w -r
# Wait for VNC server to start
sleep 2
while ! xset q &>/dev/null;
do
echo "XServer not responsive, retrying..."
sleep 2
done
echo "XServer has been found, running desktop environment"
# Run desktop environment (XFCE)
xfce4-session --display=$DISPLAY
# Keep container alive
sleep infinity

View File

@ -0,0 +1,7 @@
#!/bin/bash
if [[ ! -z "$1" ]]; then PDK_TECH=$1; fi
if [[ ! -z "${PDK_TECH}" ]]; then
echo "Installing $PDK_TECH ($PDK_VERSION)"
PDK_VERSION=$(volare ls-remote --pdk $PDK_TECH | sed -n '1 p')
volare enable --pdk $PDK_TECH $PDK_VERSION
fi

2
scripts/xschem Normal file
View File

@ -0,0 +1,2 @@
#!/bin/bash
/bin/xschem --rcfile $PDK_ROOT/$PDK/libs.tech/xschem/xschemrc $@

14
scripts/xstartup Normal file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Wait for VNC server to start
sleep 2
while ! xdpyinfo -display $DISPLAY &> /dev/null;
do
echo "XServer not responsive, retrying..."
sleep 2
done
echo "XServer has been found, running desktop environment"
# Run desktop environment (XFCE)
dbus-launch xfce4-session --display=$DISPLAY

View File

@ -21,10 +21,10 @@ RUN sudo pacman -Scc
FROM analog-heavy as analog-heavy-desktop FROM analog-heavy as analog-heavy-desktop
# Initialize the environment keeping container alive # Initialize the environment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]
# - Web build # - Web build
FROM analog-heavy as analog-heavy-web FROM analog-heavy as analog-heavy-web
# Run VNC server & desktop environment # Run VNC server & desktop environment
CMD ["startserver"] ENTRYPOINT ["start_server"]

View File

@ -19,10 +19,10 @@ RUN sudo pacman -Scc
FROM analog-xk as analog-xk-desktop FROM analog-xk as analog-xk-desktop
# Initialize the environment keeping container alive # Initialize the environment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]
# - Web build # - Web build
FROM analog-xk as analog-xk-web FROM analog-xk as analog-xk-web
# Run VNC server & desktop environment # Run VNC server & desktop environment
CMD ["startserver"] ENTRYPOINT ["start_server"]

View File

@ -20,10 +20,10 @@ RUN sudo pacman -Scc
FROM analog-xm as analog-xm-desktop FROM analog-xm as analog-xm-desktop
# Initialize the environment keeping container alive # Initialize the environment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]
# - Web build # - Web build
FROM analog-xm as analog-xm-web FROM analog-xm as analog-xm-web
# Run VNC server & desktop environment # Run VNC server & desktop environment
CMD ["startserver"] ENTRYPOINT ["start_server"]

View File

@ -20,10 +20,10 @@ RUN sudo pacman -Scc
FROM digital-ator as digital-ator-desktop FROM digital-ator as digital-ator-desktop
# Initialize the environment keeping container alive # Initialize the environment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]
# - Web build # - Web build
FROM digital-ator as digital-ator-web FROM digital-ator as digital-ator-web
# Run VNC server & desktop environment # Run VNC server & desktop environment
CMD ["startserver"] ENTRYPOINT ["start_server"]

View File

@ -21,10 +21,10 @@ RUN sudo pacman -Scc
FROM digital-heavy as digital-heavy-desktop FROM digital-heavy as digital-heavy-desktop
# Initialize the environment keeping container alive # Initialize the environment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]
# - Web build # - Web build
FROM digital-heavy as digital-heavy-web FROM digital-heavy as digital-heavy-web
# Run VNC server & desktop environment # Run VNC server & desktop environment
CMD ["startserver"] ENTRYPOINT ["start_server"]

View File

@ -20,10 +20,10 @@ RUN sudo pacman -Scc
FROM digital-icarus as digital-icarus-desktop FROM digital-icarus as digital-icarus-desktop
# Initialize the environment keeping container alive # Initialize the environment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]
# - Web build # - Web build
FROM digital-icarus as digital-icarus-web FROM digital-icarus as digital-icarus-web
# Run VNC server & desktop environment # Run VNC server & desktop environment
CMD ["startserver"] ENTRYPOINT ["start_server"]

View File

@ -26,10 +26,10 @@ RUN sudo pacman -Scc
FROM heavy as heavy-desktop FROM heavy as heavy-desktop
# Initialize the environment keeping container alive # Initialize the environment keeping container alive
CMD ["sleep", "infinity"] ENTRYPOINT ["start_desktop"]
# - Web build # - Web build
FROM heavy as heavy-web FROM heavy as heavy-web
# Run VNC server & desktop environment # Run VNC server & desktop environment
CMD ["startserver"] ENTRYPOINT ["start_server"]