Running Telescope with docker
In this post, I show how to run Telescope in multiple setups.
Telescope is a voting system for News like Reddit and Hacker News.
The setup is the same as for Rocker.chat.
The docker image in this setup is the official telescope image.
Contents
-
On a single machine
-
In docker swarm
-
On a single machine with SSL TLS 1.2
-
In docker swarm with SSL TLS 1.2
1. On a single machine
- Run a mongo container and name it mongo.
- Run a telescope container and link it to mongo with the name db, inside the telescope container, the address http://mongo reaches the mongo container.
- The telescope container is named telescope and is binded to port 3000.
To access telescope, enter the address: http://ip_address_of_the_machine_running_docker:3000/
docker run --name mongo -d mongo --smallfiles
docker run --name telescope --link mongo:db -e ROOT_URL=http://localhost -e MONGO_URL=mongodb://db -p 3000:80 -d telescopeapp/telescope:devel
To stop telescope:
docker stop telescope mongo
To restart telescope:
docker start mongo
# wait a few seconds
docker start telescope
2. In docker swarm
For docker swarm setup see this post.
My docker swarm manager has ip:port=172.16.43.199:3456 and the overlay network is named my-net.
- Run a mongo container connected to my-net and name it mongo, the address http://mongo reaches the mongo container.
- Run a telescope container connected to my-net.
- The telescope container is named telescope and is binded to port 3000.
To access telescope, enter the address: http://ip_address_of_the_machine_running_the_telescope_container:3000/
docker -H tcp://172.16.43.199:3456 run -d --name=mongo --net=my-net mongo --smallfiles
docker -H tcp://172.16.43.199:3456 run --name telescope -e ROOT_URL=http://localhost -e MONGO_URL=mongodb://mongo -p 3000:80 -d --net=my-net telescopeapp/telescope:devel
To get the address of node running telescope, run:
docker -H tcp://172.16.43.199:3456 ps
To stop telescope:
docker -H tcp://172.16.43.199:3456 stop telescope mongo
To restart telescope:
docker -H tcp://172.16.43.199:3456 start mongo
# wait a few seconds
docker -H tcp://172.16.43.199:3456 start telescope
3. On a single machine with SSL TLS 1.2
- Run a mongo container and name it mongo.
- Run a telescope container and link it to mongo with the name db, inside the telescope container, the address http://mongo reaches the mongo container.
- Run a stud container and link it to the telescope with the name app.
The stud docker image used in this setup is remynoulin/stud.
To create a self signed certificate, run this:
mkdir certs
openssl req -x509 -new -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem
cat key.pem cert.pem > certs/ssl.pem
To access telescope, enter the address: https://ip_address_of_the_machine_running_docker:3443/
docker run --name mongo -d mongo --smallfiles
docker run --name telescope --link mongo:db -e ROOT_URL=http://localhost -e MONGO_URL=mongodb://db -p 3000:80 -d telescopeapp/telescope:devel
cd certs
docker run --name stud -p 3443:443 --link telescope:app -v $(pwd):/opt/certs -d remynoulin/stud
To stop telescope:
docker stop stud telescope mongo
To restart telescope:
docker start mongo
# wait a few seconds
docker start telescope
docker start stud
4. In docker swarm with SSL TLS 1.2
For docker swarm setup see this post.
My docker swarm manager has ip:port=172.16.43.199:3456 and the overlay network is named my-net.
- Run a mongo container connected to my-net and name it mongo, the address http://mongo reaches the mongo container.
- Run a telescope container connected to my-net.
- Run a stud container connected to my-net.
The stud docker image used in this setup is remynoulin/stud.
To create a self signed certificate, run this:
mkdir certs
openssl req -x509 -new -newkey rsa:2048 -nodes -keyout key.pem -out cert.pem
cat key.pem cert.pem > certs/ssl.pem
To access telescope, enter the address: https://ip_address_of_the_machine_running_the_telescope_container:3443/
docker -H tcp://172.16.43.199:3456 run -d --name=mongo --net=my-net mongo --smallfiles
docker -H tcp://172.16.43.199:3456 run --name app -e ROOT_URL=http://localhost -e MONGO_URL=mongodb://mongo -d --net=my-net telescopeapp/telescope:devel
docker -H tcp://172.16.43.199:3456 run --name stud -p 3443:443 --net=my-net -d remynoulin/stud
docker -H tcp://172.16.43.199:3456 cp certs/ssl.pem stud:/opt/certs/ssl.pem
By default the backend port is app:3000 in remynoulin/stud, change stud.conf to have backend on port 80 since the telescope container exposes port 80:
docker -H tcp://172.16.43.199:3456 cp stud:/opt/stud/stud.conf .
# EDIT stud.conf, change backend = "[app]:3000" to backend = "[app]:80"
docker -H tcp://172.16.43.199:3456 cp stud.conf stud:/opt/stud/stud.conf
docker -H tcp://172.16.43.199:3456 start stud
To get the address of node running stud, run:
docker -H tcp://172.16.43.199:3456 ps
To stop telescope:
docker -H tcp://172.16.43.199:3456 stop stud telescope mongo
To restart telescope:
docker -H tcp://172.16.43.199:3456 start mongo
# wait a few seconds
docker -H tcp://172.16.43.199:3456 start telescope
docker -H tcp://172.16.43.199:3456 start stud