Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
749d3ff1
Commit
749d3ff1
authored
Sep 21, 2021
by
Tammo Jan Dijkema
Browse files
Merge branch 'michel' into 'jeroen'
Michel See merge request
!12
parents
0bfe8b10
bc74cc00
Changes
3
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
749d3ff1
...
...
@@ -8,52 +8,40 @@
# This Dockerfile is hardcoded to run the websockets server at
# port 8000.
# Start the docker container with
# docker run -it -p 8081:80 -p 8000:8000 -p 11031:11031 -p 11030:11030 -p 11040:11040 -p 11041:11041 -p 11042:11042 -p 11011:11011 consoledemo
# Then visit the consoledemo from the host machine at http://localhost:8081 (NOT at port 8000, which will show a non-working HTML page)
FROM
ubuntu:16.04
# docker run -it -p 8000:8000 -p 11031:11031 -p 11030:11030 -p 11040:11040 -p 11041:11041 -p 11042:11042 -p 11011:11011 consoledemo
# The ports in the 11000 range are for accessing the console with scripts,
# e.g. with the python Telescope class.
# Then visit the consoledemo from the host machine at http://localhost:8000
FROM
debian:buster AS builder
RUN
apt-get
-y
update
RUN
apt-get
-y
install
vim autoconf make gcc libtool-bin libglib2.0-dev libbison-dev flex git cmake build-essential libssl-dev screen telnet libmagic-dev wget
RUN
apt-get
-y
install
vim autoconf make gcc libtool-bin libglib2.0-dev libbison-dev flex git cmake build-essential libssl-dev libmagic-dev wget libwebsockets-dev
RUN
mkdir
-p
/var/www/console/htdocs/tle
&&
cd
/var/www/console/htdocs/tle
&&
wget
"http://celestrak.com/NORAD/elements/amateur.txt"
-v
-O
amateur.txt
&&
wget
"http://celestrak.com/NORAD/elements/tle-new.txt"
-v
-O
tle-new.txt
&&
wget
"http://celestrak.com/NORAD/elements/gps-ops.txt"
-v
-O
gps-ops.txt
&&
cd
-
RUN
cd
/root
&&
git clone git://git.code.sf.net/p/libnova/libnova libnova-libnova
RUN
cd
/root/libnova-libnova
&&
git checkout 655bcd1
&&
libtoolize
&&
autoreconf
-i
&&
./configure
&&
make
install
RUN
cd
/root
&&
git clone https://github.com/warmcat/libwebsockets.git
RUN
cd
/root/libwebsockets
&&
git checkout v2.4.2
&&
mkdir
build
&&
cd
build
&&
cmake ..
&&
make
&&
make
install
RUN
cd
/root
&&
git clone https://gitlab.camras.nl/dijkema/dt_ctrl
RUN
cd
/root/dt_ctrl
&&
autoconf
&&
./configure
--with-libwebsockets
=
/usr
/local
&&
make
RUN
cd
/root/dt_ctrl
&&
autoconf
&&
./configure
--with-libwebsockets
=
/usr
&&
make
RUN
cd
/root/dt_ctrl
&&
make console/console/console_httpd
RUN
mkdir
-p
/var/log/dt/traces
RUN
ldconfig
# Create BUILDER container
RUN
chmod
a+rwx /root
RUN
mkdir
-p
/var/www/
RUN
mkdir
-p
/var/www/console/htdocs/tle
&&
cd
/var/www/console/htdocs/tle
&&
wget
"http://celestrak.com/NORAD/elements/amateur.txt"
-v
-O
amateur.txt
&&
wget
"http://celestrak.com/NORAD/elements/tle-new.txt"
-v
-O
tle-new.txt
&&
wget
"http://celestrak.com/NORAD/elements/gps-ops.txt"
-v
-O
gps-ops.txt
&&
cd
-
FROM
debian:buster AS runner
RUN
apt
-y
update
&&
apt
-y
install
screen libwebsockets8 libglib2.0-0 libmagic-dev wget
RUN
apt-get update
&&
apt-get
-y
install
apache2 net-tools
RUN
chmod
a+rwx /root
RUN
mkdir
-p
/var/www/console/
&&
cp
-r
/root/dt_ctrl/console/htdocs /var/www/console
&&
cp
-r
/root/dt_ctrl/console/js /var/www/console
RUN
mkdir
-p
/var/www/console
COPY
--from=builder /root/dt_ctrl/console/htdocs /var/www/console/htdocs
COPY
--from=builder /root/dt_ctrl/console/js /var/www/console/js
COPY
--from=builder /root/dt_ctrl /root/dt_ctrl
COPY
--from=builder /var/www/console/htdocs/tle /var/www/console/htdocs/tle
COPY
--from=builder /usr/local/lib /usr/local/lib
# Configure apache to serve the console htdocs
RUN
echo
'
\
<VirtualHost *:80>\n
\
\t
ServerAdmin webmaster@localhost\n
\
\t
DocumentRoot /var/www/console/htdocs\n
\
\t
<Directory "/var/www/console/htdocs">\n
\
\t\t
Order allow,deny\n
\
\t\t
Allow from all\n
\
\t\t
AllowOverride None\n
\
\t\t
AddHandler cgi-script .cgi\n
\
\t\t
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch\n
\
\t
</Directory>\n
\
\n\
ErrorLog ${APACHE_LOG_DIR}/error.log\n
\
CustomLog ${APACHE_LOG_DIR}/access.log combined\n
\
</VirtualHost>\n
\
'
>
/etc/apache2/sites-enabled/000-default.conf
RUN
ldconfig
# Configure ports for the console and controller
RUN
mkdir
/etc/dt
&&
echo
'
\
...
...
@@ -68,10 +56,12 @@ path=/var/www/console/htdocs\n\
port=8000\n
\
'
>
/etc/dt/dt_host.ini
# Patch the console software to point the websockets port
RUN
sed
-i
-e
's/window.location.host/window.location.hostname+":8000"/'
/var/www/console/htdocs/index.html
&&
\
sed
-i
-e
's/window.location.host/window.location.hostname+":8000"/'
/var/www/console/htdocs/mech.html
RUN
groupadd
-g
80000 consoledemo
&&
useradd
-g
consoledemo
-M
-u
80000 consoledemo
RUN
mkdir
-p
/var/log/dt/traces
&&
chown
consoledemo.consoledemo /var/log/dt/traces
RUN
chown
-R
consoledemo.consoledemo /var/www/console/htdocs/tle
USER
consoledemo:consoledemo
CMD
screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c
'
cd /root/dt_ctrl/console/console && ./start_console.sh
' && /bin/bash -c 'service apache2 start'
&& bash
CMD
ulimit -n 1024 &&
screen -d -m /root/dt_ctrl/controller/dt_ctrl /root/dt_ctrl/controller/dt_ctrl.ctrl && screen -d -m bash -c
"
cd /root/dt_ctrl/console/console && ./start_console.sh
"
&& bash
EXPOSE
80
EXPOSE
80
00
console/htdocs/index.html
View file @
749d3ff1
...
...
@@ -169,7 +169,12 @@ eval(load("js/dt_websocket.js"));
eval
(
load
(
"
js/log.js
"
));
eval
(
load
(
"
js/dt_status.js
"
));
new
dt_websocket
(
"
ws://
"
+
window
.
location
.
host
+
"
/dt
"
);
if
(
window
.
location
.
protocol
==
"
https:
"
)
{
websocketprotocol
=
"
wss://
"
}
else
{
websocketprotocol
=
"
ws://
"
}
new
dt_websocket
(
websocketprotocol
+
window
.
location
.
host
+
"
/
"
+
window
.
location
.
pathname
+
"
/dt
"
);
/*
'constants'
...
...
console/htdocs/mech.html
View file @
749d3ff1
...
...
@@ -83,7 +83,12 @@ eval(load("js/trace.js"));
eval
(
load
(
"
js/utils.js
"
));
eval
(
load
(
"
js/status.js
"
));
new
dt_websocket
(
"
ws://
"
+
window
.
location
.
host
+
"
/dt
"
);
if
(
window
.
location
.
protocol
==
"
https:
"
)
{
websocketprotocol
=
"
wss://
"
}
else
{
websocketprotocol
=
"
ws://
"
}
new
dt_websocket
(
websocketprotocol
+
window
.
location
.
host
+
"
/
"
+
window
.
location
.
pathname
+
"
/dt
"
);
function
one
(
val
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment