Skip to content

Commit

Permalink
tools: switch to newest docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
phsauter committed Sep 25, 2024
1 parent 409e79d commit bef7095
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 16 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Cell/Module placement | Routing


## Requirements
We are using the excelent docker container maintained by Harald Pretl. If you get stuck with installing the tools, we urge you to check the [Tool Repository](https://github.com/iic-jku/IIC-OSIC-TOOLS) or consult the [Guide](https://kwantaekim.github.io/2024/05/25/OSE-Docker).

### ETHZ systems
An environment setup for bash is provided.
Expand All @@ -90,21 +91,27 @@ source ethz.env
```

### Other systems
**Note: this has currently only been tested on Ubuntu Linux.**
**Note: this has currently only been tested on Ubuntu and RHEL Linux.**

#### Docker (easy)
There are two possible ways, the easiest way is to install docker and work in the docker container, you can follow the install guides on the [Docker Website](https://docs.docker.com/desktop/):
There are two possible ways, the easiest way is to install docker and work in the docker container, you can follow the install guides on the [Docker Website](https://docs.docker.com/desktop/).
**Note:** We may not support the latest version. The currently supported version (tag) is **2024.09**.

It is a good idea to grant non-root (`sudo`) users access to docker, this is decribed in the [Docker Article](https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user).

Finally, you can navigate to this directory, open a terminal and type:
```sh
# Linux/Mac
./docker.sh
# Windows
./start_x.bat
# Linux only (starts and enters docker container in shell)
./start_linux.sh
# Linux/Mac (starts VNC server on localhost:5901)
./start_vnc.sh
# Windows (starts VNC server on localhost:5901)
./start_vnc.bat
```

If you use the VNC option, open a browser and type `localhost` in the address bar.
This should connect you to the VNC server (test by right-clicking somewhere).

Now you should be in a Ubuntu environment with all tools pre-installed for you.
If something does not work, refer to the upstream [IIC-OSIC-Tools](https://github.com/iic-jku/IIC-OSIC-TOOLS/tree/main)

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version: '3'

services:
pulp-docker:
image: hpretl/iic-osic-tools:pulp
image: hpretl/iic-osic-tools:2024.09
environment:
- UID=${UID}
- GID=${GID}
Expand Down
2 changes: 1 addition & 1 deletion docker.sh → start_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Authors:
# - Philippe Sauter <[email protected]>

IMG=hpretl/iic-osic-tools:pulp
IMG=hpretl/iic-osic-tools:2024.09

docker pull $IMG

Expand Down
49 changes: 41 additions & 8 deletions start_x.bat → start_vnc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ REM ========================================================================

SETLOCAL

SET DESIGNS=%CD%
SET DESIGNS=%~dp0

SET DEFAULT_DESIGNS=%USERPROFILE%\eda\designs

IF DEFINED DRY_RUN (
Expand All @@ -30,24 +31,57 @@ IF DEFINED DRY_RUN (
IF "%DESIGNS%"=="" (
SET DESIGNS=%DEFAULT_DESIGNS%
)

echo Using/creating designs directory: %DESIGNS%
if not exist "%DESIGNS%" %ECHO_IF_DRY_RUN% mkdir "%DESIGNS%"

IF "%DOCKER_USER%"=="" SET DOCKER_USER=hpretl
IF "%DOCKER_IMAGE%"=="" SET DOCKER_IMAGE=iic-osic-tools
IF "%DOCKER_TAG%"=="" SET DOCKER_TAG=pulp
IF "%DOCKER_TAG%"=="" SET DOCKER_TAG=2024.09

IF "%CONTAINER_USER%"=="" SET CONTAINER_USER=1000
IF "%CONTAINER_GROUP%"=="" SET CONTAINER_GROUP=1000

IF "%CONTAINER_NAME%"=="" SET CONTAINER_NAME=iic-osic-tools_xserver
IF "%CONTAINER_NAME%"=="" SET CONTAINER_NAME=iic-osic-tools_xvnc

IF "%DISP%"=="" SET DISP=host.docker.internal:0
IF "%WEBSERVER_PORT%"=="" (
SET /a WEBSERVER_PORT=80
) ELSE (
SET /a WEBSERVER_PORT=%WEBSERVER_PORT%
)
echo Webserver port set to %WEBSERVER_PORT%

IF "%VNC_PORT%"=="" (
SET /a VNC_PORT=5901
) ELSE (
SET /a VNC_PORT=%VNC_PORT%
)
echo VNC port set to %VNC_PORT%


IF %CONTAINER_USER% NEQ 0 if %CONTAINER_USER% LSS 1000 echo WARNING: Selected User ID %CONTAINER_USER% is below 1000. This ID might interfere with User-IDs inside the container and cause undefined behaviour!
IF %CONTAINER_GROUP% NEQ 0 if %CONTAINER_GROUP% LSS 1000 echo WARNING: Selected Group ID %CONTAINER_GROUP% is below 1000. This ID might interfere with Group-IDs inside the container and cause undefined behaviour!

SET PARAMS=

IF %WEBSERVER_PORT% GTR 0 (
SET PARAMS=%PARAMS% -p %WEBSERVER_PORT%:80
)

IF %VNC_PORT% GTR 0 (
SET PARAMS=%PARAMS% -p %VNC_PORT%:5901
)

IF DEFINED VNC_PW (
SET PARAMS=%PARAMS% -e VNC_PW=%VNC_PW%
)

IF DEFINED DOCKER_EXTRA_PARAMS (
SET PARAMS=%PARAMS% %DOCKER_EXTRA_PARAMS%
)

IF "%DISP%"=="" SET DISP=host.docker.internal:0

where /q xhost
IF ERRORLEVEL 1 (
ECHO xhost is not detected / not in PATH. Please verify X-server access control!
Expand All @@ -64,8 +98,7 @@ IF NOT ERRORLEVEL 1 (
IF NOT ERRORLEVEL 1 (
echo Container %CONTAINER_NAME% exists. Restart with \"docker start %CONTAINER_NAME%\" or remove with \"docker rm %CONTAINER_NAME%\" if required.
) ELSE (
echo Container does not exist, pulling %DOCKER_USER%/%DOCKER_IMAGE%:%DOCKER_TAG and creating %CONTAINER_NAME% ...
%ECHO_IF_DRY_RUN% docker pull %DOCKER_USER%/%DOCKER_IMAGE%:%DOCKER_TAG
%ECHO_IF_DRY_RUN% docker run -d --user %CONTAINER_USER%:%CONTAINER_GROUP% -e DISPLAY=%DISP% -e LIBGL_ALWAYS_INDIRECT=1 %DOCKER_EXTRA_PARAMS% -v "%DESIGNS%":/foss/designs --name %CONTAINER_NAME% %DOCKER_USER%/%DOCKER_IMAGE%:%DOCKER_TAG%
echo Container does not exist, creating %CONTAINER_NAME% ...
%ECHO_IF_DRY_RUN% docker run -d --user %CONTAINER_USER%:%CONTAINER_GROUP% %PARAMS% -v "%DESIGNS%":/foss/designs --name %CONTAINER_NAME% %DOCKER_USER%/%DOCKER_IMAGE%:%DOCKER_TAG%
)
)
)
150 changes: 150 additions & 0 deletions start_vnc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#!/bin/bash
# ========================================================================
# Start script for IIC docker images (VNC)
#
# SPDX-FileCopyrightText: 2022-2023 Harald Pretl and Georg Zachl
# Johannes Kepler University, Institute for Integrated Circuits
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# SPDX-License-Identifier: Apache-2.0
# ========================================================================

if [ -n "${DRY_RUN}" ]; then
echo "[INFO] This is a dry run, all commands will be printed to the shell (Commands printed but not executed are marked with $)!"
ECHO_IF_DRY_RUN="echo $"
fi

# SET YOUR DESIGN PATH RIGHT!
DESIGNS="$(realpath $(dirname "${BASH_SOURCE[0]}"))"

if [ -z ${DESIGNS+z} ]; then
DESIGNS=$HOME/eda/designs
if [ ! -d "$DESIGNS" ]; then
${ECHO_IF_DRY_RUN} mkdir -p "$DESIGNS"
fi
echo "[INFO] Design directory auto-set to $DESIGNS."
fi

# Set the host ports, and disable them with 0. Only used if not set as shell variables!
if [ -z ${WEBSERVER_PORT+z} ]; then
WEBSERVER_PORT=80
fi
if [ -z ${VNC_PORT+z} ]; then
VNC_PORT=5901
fi

if [ -z ${DOCKER_USER+z} ]; then
DOCKER_USER="hpretl"
fi

if [ -z ${DOCKER_IMAGE+z} ]; then
DOCKER_IMAGE="iic-osic-tools"
fi

if [ -z ${DOCKER_TAG+z} ]; then
DOCKER_TAG="2024.09"
fi

if [ -z ${CONTAINER_NAME+z} ]; then
CONTAINER_NAME="iic-osic-tools_xvnc_uid_"$(id -u)
fi

if [[ "$OSTYPE" == "linux"* ]]; then
if [ -z ${CONTAINER_USER+z} ]; then
CONTAINER_USER=$(id -u)
fi

if [ -z ${CONTAINER_GROUP+z} ]; then
CONTAINER_GROUP=$(id -g)
fi
else
if [ -z ${CONTAINER_USER+z} ]; then
CONTAINER_USER=1000
fi

if [ -z ${CONTAINER_GROUP+z} ]; then
CONTAINER_GROUP=1000
fi
fi

# Check for UIDs and GIDs below 1000, except 0 (root)
if [[ ${CONTAINER_USER} -ne 0 ]] && [[ ${CONTAINER_USER} -lt 1000 ]]; then
prt_str="# [WARNING] Selected User ID ${CONTAINER_USER} is below 1000. This ID might interfere with User-IDs inside the container and cause undefined behavior! #"
printf -- '#%.0s' $(seq 1 ${#prt_str})
echo
echo "${prt_str}"
printf -- '#%.0s' $(seq 1 ${#prt_str})
echo
fi

if [[ ${CONTAINER_GROUP} -ne 0 ]] && [[ ${CONTAINER_GROUP} -lt 1000 ]]; then
prt_str="# [WARNING] Selected Group ID ${CONTAINER_GROUP} is below 1000. This ID might interfere with Group-IDs inside the container and cause undefined behavior! #"
printf -- '#%.0s' $(seq 1 ${#prt_str})
echo
echo "${prt_str}"
printf -- '#%.0s' $(seq 1 ${#prt_str})
echo
fi

# Processing ports and other parameters
PARAMS=""
if [ "$WEBSERVER_PORT" -gt 0 ]; then
PARAMS="$PARAMS -p $WEBSERVER_PORT:80"
fi
if [ "$VNC_PORT" -gt 0 ]; then
PARAMS="$PARAMS -p $VNC_PORT:5901"
fi

if [ -n "${VNC_PW}" ]; then
PARAMS="${PARAMS} -e VNC_PW=${VNC_PW}"
fi

if [ -n "${DOCKER_EXTRA_PARAMS}" ]; then
PARAMS="${PARAMS} ${DOCKER_EXTRA_PARAMS}"
fi

# Check if the container exists and if it is running.
if [ "$(docker ps -q -f name="${CONTAINER_NAME}")" ]; then
echo "[WARNING] Container is running!"
echo "[HINT] It can also be stopped with \"docker stop ${CONTAINER_NAME}\" and removed with \"docker rm ${CONTAINER_NAME}\" if required."
echo
echo -n "Press \"s\" to stop, and \"r\" to stop & remove: "
read -r -n 1 k <&1
echo
if [[ $k = s ]] ; then
${ECHO_IF_DRY_RUN} docker stop "${CONTAINER_NAME}"
elif [[ $k = r ]] ; then
${ECHO_IF_DRY_RUN} docker stop "${CONTAINER_NAME}"
${ECHO_IF_DRY_RUN} docker rm "${CONTAINER_NAME}"
fi
# If the container exists but is exited, it is restarted.
elif [ "$(docker ps -aq -f name="${CONTAINER_NAME}")" ]; then
echo "[WARNING] Container ${CONTAINER_NAME} exists."
echo "[HINT] It can also be restarted with \"docker start ${CONTAINER_NAME}\" or removed with \"docker rm ${CONTAINER_NAME}\" if required."
echo
echo -n "Press \"s\" to start, and \"r\" to remove: "
read -r -n 1 k <&1
echo
if [[ $k = s ]] ; then
${ECHO_IF_DRY_RUN} docker start "${CONTAINER_NAME}"
elif [[ $k = r ]] ; then
${ECHO_IF_DRY_RUN} docker rm "${CONTAINER_NAME}"
fi
else
echo "[INFO] Container does not exist, creating ${CONTAINER_NAME} ..."
# Finally, run the container, and sets DISPLAY to the local display number
#${ECHO_IF_DRY_RUN} docker pull "${DOCKER_USER}/${DOCKER_IMAGE}:${DOCKER_TAG}"
# Disable SC2086, $PARAMS must be globbed and splitted.
# shellcheck disable=SC2086
${ECHO_IF_DRY_RUN} docker run -d --user "${CONTAINER_USER}:${CONTAINER_GROUP}" $PARAMS -v "$DESIGNS:/foss/designs:rw" --name "${CONTAINER_NAME}" "${DOCKER_USER}/${DOCKER_IMAGE}:${DOCKER_TAG}"
fi

0 comments on commit bef7095

Please sign in to comment.