Skip to content

Commit 979e7ab

Browse files
committed
init
0 parents  commit 979e7ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+4071
-0
lines changed

.idea/.gitignore

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/openroberta-docker.iml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+362
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM arm32v7/debian:buster
2+
3+
RUN apt-get update && \
4+
apt-get install -y \
5+
wget unzip curl jq \
6+
libusb-0.1-4 \
7+
gcc-avr binutils-avr gdb-avr avr-libc avrdude \
8+
nbc \
9+
gcc-arm-none-eabi srecord libssl-dev \
10+
python-pip && \
11+
apt-get autoremove
12+
RUN pip install uflash
13+
14+
# Install Java JDK
15+
RUN wget https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u222-b10/OpenJDK8U-jdk_arm_linux_hotspot_8u222b10.tar.gz && \
16+
tar xzvf OpenJDK8U-jdk_arm_linux_hotspot_8u222b10.tar.gz && \
17+
rm OpenJDK8U-jdk_arm_linux_hotspot_8u222b10.tar.gz && \
18+
mv jdk8u222-b10 /opt/jdk8
19+
ENV PATH="/opt/jdk8/bin:${PATH}"
20+
21+
# c4ev3 cross compiler for arm
22+
# TODO: Replace with public URL
23+
# COPY C4EV3.Toolchain-2019.08.0-rpi.tar.gz C4EV3.Toolchain-2019.08.0-rpi.tar.gz
24+
# RUN tar -zxvf C4EV3.Toolchain-2019.08.0-rpi.tar.gz && \
25+
# rm C4EV3.Toolchain-2019.08.0-rpi.tar.gz && \
26+
# mv C4EV3.Toolchain-2019.08.0 /opt/C4EV3.Toolchain-2019.08.0 && \
27+
# ln -s /opt/C4EV3.Toolchain-2019.08.0/arm-c4ev3-linux-uclibceabi/gcc-8.2.1-uclibc-ng-1.0.31-binutils-2.31.1-kernel-2.6.33-rc4-sanitized/bin/arm-c4ev3-linux-uclibceabi-g++ /usr/bin/arm-c4ev3-linux-uclibceabi-g++
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ARG CCBIN_VERSION
2+
FROM openroberta/ccbin-arm32v7:${CCBIN_VERSION}
3+
4+
WORKDIR /opt/ora-cc-rsc/
5+
COPY ./ ./
6+
ENV robot_crosscompiler_resourcebase=/opt/ora-cc-rsc/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM ubuntu:22.04 as builder
2+
3+
RUN apt-get update && \
4+
apt-get install --no-install-recommends -y curl wget lbzip2 python3 python3-pip && \
5+
apt-get clean && \
6+
rm -rf /var/lib/apt/lists/*
7+
8+
WORKDIR /tmp
9+
RUN wget http://downloads.arduino.cc/tools/avr-gcc-7.3.0-atmel3.6.1-arduino5-x86_64-pc-linux-gnu.tar.bz2 && \
10+
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2019q4/RC2.1/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 && \
11+
wget https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz
12+
WORKDIR /opt/compiler
13+
RUN tar -xf /tmp/avr-gcc-7.3.0-atmel3.6.1-arduino5-x86_64-pc-linux-gnu.tar.bz2 && \
14+
tar -xf /tmp/gcc-arm-none-eabi-9-2019-q4-major-x86_64-linux.tar.bz2 && \
15+
tar -xzf /tmp/xtensa-esp32-elf-linux64-1.22.0-61-gab8375a-5.2.0.tar.gz && \
16+
rm -rf /tmp/*
17+
18+
WORKDIR /tmp
19+
RUN wget http://ftp.debian.org/debian/pool/main/n/newlib/libnewlib-dev_3.1.0.20181231-1_all.deb && \
20+
wget http://ftp.debian.org/debian/pool/main/n/newlib/libnewlib-arm-none-eabi_3.1.0.20181231-1_all.deb
21+
22+
FROM ubuntu:22.04
23+
24+
ENV LANG de_DE.UTF-8
25+
ENV LANGUAGE de_DE:de
26+
ENV LC_ALL de_DE.UTF-8
27+
28+
RUN apt-get update && \
29+
apt-get install --no-install-recommends -y locales tzdata curl wget lbzip2 openjdk-8-jdk python3 python3-pip maven && \
30+
ln -s /usr/bin/python3 /usr/bin/python && \
31+
pip3 install esptool && \
32+
locale-gen de_DE.UTF-8 && \
33+
ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && \
34+
export DEBIAN_FRONTEND=noninteractive && \
35+
dpkg-reconfigure --frontend noninteractive tzdata && \
36+
apt-get install --no-install-recommends -y nbc libusb-0.1-4 srecord libssl-dev g++-arm-linux-gnueabi && \
37+
apt-get clean && \
38+
rm -rf /var/lib/apt/lists/*
39+
40+
WORKDIR /tmp
41+
COPY --from=builder /tmp ./
42+
RUN dpkg -i libnewlib-dev_3.1.0.20181231-1_all.deb libnewlib-arm-none-eabi_3.1.0.20181231-1_all.deb && \
43+
rm libnewlib-dev_3.1.0.20181231-1_all.deb libnewlib-arm-none-eabi_3.1.0.20181231-1_all.deb
44+
45+
WORKDIR /opt/compiler
46+
COPY --from=builder /opt/compiler ./
47+
ENV PATH="${PATH}:/opt/compiler/avr/bin:/opt/compiler/gcc-arm-none-eabi-9-2019-q4-major/bin:/opt/compiler/xtensa-esp32-elf/bin"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ARG CCBIN_VERSION
2+
FROM openroberta/ccbin-x64:${CCBIN_VERSION}
3+
4+
WORKDIR /opt/ora-cc-rsc/
5+
# the ora--cc-rsc git repo has a .dockerignore to exclude unwanted resources
6+
COPY ./ ./
7+
ENV robot_crosscompiler_resourcebase=/opt/ora-cc-rsc/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ubuntu:22.04
2+
3+
ENV LANG de_DE.UTF-8
4+
ENV LANGUAGE de_DE:de
5+
ENV LC_ALL de_DE.UTF-8
6+
7+
WORKDIR /opt/openRoberta
8+
VOLUME /opt/db /opt/dbAdmin
9+
EXPOSE 9001
10+
11+
COPY ["startDbServer.sh","./"]
12+
13+
RUN apt-get update && \
14+
apt-get install --no-install-recommends -y openjdk-8-jdk && \
15+
mkdir --parent /opt/openRoberta/lib && \
16+
chmod +x ./startDbServer.sh
17+
18+
COPY ./*.jar ./lib/
19+
20+
ENTRYPOINT ["/opt/openRoberta/startDbServer.sh"]
21+
CMD []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
# start of the openroberta database server in a docker container.
3+
# needs the list of databases as runtime arguments
4+
5+
function log {
6+
echo $1
7+
echo $1 >>$DB_LOGFILE
8+
}
9+
10+
case "$1" in
11+
-Xmx*) DATABASEXMX=$1; shift ;;
12+
*) log 'first parameter must declare the maximum heap size (e.g. -Xmx4G). Exit 12'
13+
exit 12 ;;
14+
esac
15+
16+
case "$1" in
17+
'') log 'at least one parameter declaring a database is required. Exit 12'
18+
exit 12 ;;
19+
*) : ;;
20+
esac
21+
22+
DB_BASEDIR=/opt/db
23+
DB_ADMIN=/opt/dbAdmin
24+
DB_LOGFILE="$DB_ADMIN/ora-db.log"
25+
26+
HSQL_DB_DECLS=''
27+
I=0
28+
29+
for DB_NAME do
30+
case "$DB_NAME" in
31+
master) : ;;
32+
test|dev) : ;;
33+
dev[1-9]) : ;;
34+
*) log "invalid name. Parameter must be 'test','dev','dev1'..'dev9', but is '$DB_NAME'. Exit 12"
35+
exit 12 ;;
36+
esac
37+
HSQL_DB_DECLS="$HSQL_DB_DECLS --database.$I file:$DB_BASEDIR/$DB_NAME/openroberta-db --dbname.$I openroberta-db-$DB_NAME"
38+
let "I = $I + 1"
39+
done
40+
41+
log 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
42+
log "the db server starting at $(date) will serve the databases $*"
43+
log "db admin dir $DB_ADMIN stores logs and backups"
44+
log 'mount db admin dir with -v on container start (often /data/openroberta/dbAdmin)'
45+
log 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
46+
47+
function trapSignals {
48+
log "signal caught. The database server will SHUTDOWN"
49+
kill -INT $child
50+
}
51+
trap trapSignals TERM INT
52+
eval "java $DATABASEXMX -cp lib/\* org.hsqldb.Server $HSQL_DB_DECLS | tee -a $DB_LOGFILE &"
53+
child="$!"
54+
log "waiting for child with pid $child to terminate"
55+
wait "$child"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ARG BASEVERSION
2+
ARG ARCH
3+
4+
FROM openroberta/base-${ARCH}:${BASE_VERSION}
5+
6+
RUN mkdir -p /tmp/build && cd /tmp/build; \
7+
apt-get update && \
8+
apt-get install --no-install-recommends -y maven \
9+
10+
WORKDIR /tmp/build
11+
COPY . .
12+
RUN mvn clean install -DskipTests && ./ora.sh export /tmp/build/export gzip
13+
14+
FROM openroberta/base:$BASEVERSION
15+
16+
VOLUME /opt/admin
17+
EXPOSE 1999
18+
19+
RUN mkdir --parent /opt/openroberta-lab/lib /tmp/openrobertaTmp
20+
WORKDIR /opt/openroberta-lab
21+
22+
COPY --from=build /tmp/build/export .
23+
COPY Docker/openroberta/conf/y-docker-for-lab-ci/*.sh .
24+
RUN chmod ugo+rx ./*.sh
25+
26+
ENTRYPOINT ["./start.sh"]
27+
CMD []
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
QUIET='no'
4+
while true
5+
do
6+
case "$1" in
7+
-q) QUIET='yes'
8+
shift ;;
9+
*) break ;;
10+
esac
11+
done
12+
13+
if [ "$QUIET" = 'no' ]
14+
then
15+
echo 'THIS SCRIPT EXECUTES DANGEROUS COMMANDS. MISUSE MAY CRASH THE OPENROBERTA SERVER.'
16+
echo 'admin.sh [-q] <CMD>'
17+
echo '-q quiet mode'
18+
echo ''
19+
echo '<CMD>s are:'
20+
echo ' cleanup-temp-user-dirs temporary directories allocated for crosscompilers are removed, if they are older than 1d'
21+
fi
22+
23+
# get the command
24+
CMD="$1"; shift
25+
26+
RC=0
27+
case "$CMD" in
28+
cleanup-temp-user-dirs) # the rm -rf is scary. Should be really made robust against errors. -mtime +1 is: older than 1 day
29+
AGE='-mtime +1'
30+
TMP_DIR='/tmp/openrobertaTmp'
31+
cd $TMP_DIR
32+
WD=$(pwd)
33+
if [[ "$WD" == $TMP_DIR ]]
34+
then
35+
find . -ignore_readdir_race -maxdepth 1 ! -name '.' ! -name '..' $AGE -exec rm -rf -- {} \;
36+
RC=$?
37+
else
38+
echo "cd $TMP_DIR did not succeed. This is dangerous! Analyse!"
39+
RC=12
40+
fi ;;
41+
# ----------------------------------------------------------------------------------------------------------------------------------------
42+
'') echo "no command. Script terminates"
43+
RC=12 ;;
44+
*) echo "invalid admin command. Ignored: \"$CMD\""
45+
RC=12 ;;
46+
esac
47+
48+
if [[ "$RC" -ne 0 ]]
49+
then
50+
echo '*** the command did NOT succeed (completely). Look into console output and logfiles. $(date) ***'
51+
fi
52+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# dangerous parameters! Use not for production!
4+
REMOTE_DEBUG=''
5+
GC_LOGGING=''
6+
while true
7+
do
8+
case "$1" in
9+
remote.debug) REMOTE_DEBUG='-agentlib:jdwp=transport=dt_socket,address=0.0.0.0:2000,server=y,suspend=y'; shift ;;
10+
gc.logging) GC_LOGGING="-XX:+PrintGC"; shift ;;
11+
*) break ;;
12+
esac
13+
done
14+
15+
# all these -d parameters are independent from the server instance. Server-related -d parameters are added by '$*'
16+
java $REMOTE_DEBUG $GC_LOGGING -cp lib/\* de.fhg.iais.roberta.main.ServerStarter \
17+
-d server.staticresources.dir=./staticResources \
18+
-d plugin.tempdir=/tmp/openrobertaTmp \
19+
-d database.mode=server \
20+
-d robot.crosscompiler.resourcebase=/opt/ora-cc-rsc \
21+
-d server.admin.dir=/opt/admin \
22+
$*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ARG FROM
2+
FROM $FROM
3+
4+
VOLUME /opt/admin /tmp/openrobertaTmp
5+
EXPOSE 1999
6+
7+
RUN mkdir --parent /opt/openroberta-lab/lib
8+
WORKDIR /opt/openroberta-lab
9+
10+
COPY ["./","./"]
11+
RUN chmod ugo+rx ./*.sh
12+
13+
ENTRYPOINT ["./start.sh"]
14+
CMD []
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
3+
QUIET='no'
4+
while true
5+
do
6+
case "$1" in
7+
-q) QUIET='yes'
8+
shift ;;
9+
*) break ;;
10+
esac
11+
done
12+
13+
if [ "$QUIET" = 'no' ]
14+
then
15+
echo 'THIS SCRIPT EXECUTES COMMANDS WITHIN A DOCKER CONTAINER. ERRORS MAY CRASH THE OPENROBERTA SERVER.'
16+
echo 'admin.sh [-q] <CMD>'
17+
echo '-q quiet mode'
18+
echo ''
19+
echo '<CMD>s are:'
20+
echo ' example example script (currently no commands are in use)'
21+
fi
22+
23+
# get the command
24+
CMD="$1"; shift
25+
26+
RC=0
27+
case "$CMD" in
28+
example) echo 'use a bash on the server running our server in a docker container (e.g. server "test")'
29+
echo 'excute in this bash the command ".../run.sh admin test example". Then:'
30+
echo 'the run script will call INSIDE of the docker container of server "test" the script "admin.sh"'
31+
echo 'with the only parameter "example". This in turn will output the echos you are reading :-)'
32+
;;
33+
# ----------------------------------------------------------------------------------------------------------------------------------------
34+
'') echo "no command. Script terminates"
35+
RC=12 ;;
36+
*) echo "invalid admin command. Ignored: \"$CMD\""
37+
RC=12 ;;
38+
esac
39+
40+
if [[ "$RC" -ne 0 ]]
41+
then
42+
echo '*** the command did NOT succeed (completely). Look into console output and logfiles. $(date) ***'
43+
fi
44+
exit 0
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# dangerous parameters! Use not for production!
4+
REMOTE_DEBUG=''
5+
GC_LOGGING=''
6+
while true
7+
do
8+
case "$1" in
9+
remote.debug) REMOTE_DEBUG='-agentlib:jdwp=transport=dt_socket,address=0.0.0.0:2000,server=y,suspend=y'; shift ;;
10+
gc.logging) GC_LOGGING="-XX:+PrintGC"; shift ;;
11+
*) break ;;
12+
esac
13+
done
14+
15+
# all these -d parameters are independent from the server instance. Server-related -d parameters are added by '$*'
16+
java $REMOTE_DEBUG $GC_LOGGING -cp lib/\* de.fhg.iais.roberta.main.ServerStarter \
17+
-d server.staticresources.dir=./staticResources \
18+
-d plugin.tempdir=/tmp/openrobertaTmp \
19+
-d database.mode=server \
20+
-d robot.crosscompiler.resourcebase=/opt/ora-cc-rsc \
21+
-d server.admin.dir=/opt/admin \
22+
$*

0 commit comments

Comments
 (0)