HashiQube - DevOps Lab
Youtube Channel Medium Posts Riaan Nolan Linkedin Riaan Nolan Hashicorp Ambassador

.

T-Rex

The classic Chrome dinosaur runner game - now available in HashiQube

Trex Game

🚀 Introduction

The T-Rex Runner Game is an Easter Egg usually hidden on the "No Internet Connection" error page in Google's Chrome web browser. This version allows you to play the game directly in HashiQube, even with an internet connection!

Press the space bar to start the game and to jump over obstacles. In HashiQube, this serves as a fun demo application for presentations.

Enjoy the game and see how far you can make it!

🛠️ Provision

Choose one of the following methods to set up your environment:

Open in GitHub Codespaces

bash docker/docker.sh
bash trex/trex.sh
vagrant up --provision-with basetools,docker,docsify,trex
docker compose exec hashiqube /bin/bash
bash hashiqube/basetools.sh
bash docker/docker.sh
bash trex/trex.sh

🎮 How to Play

  1. After provisioning, access the game through your web browser
  2. Press the space bar to start the game
  3. Use the space bar to jump over cacti and other obstacles
  4. Use the down arrow to duck
  5. Try to achieve the highest score possible!

⚙️ Provisioning Script

The trex.sh script handles the installation and configuration of the T-Rex game:

[filename](trex.sh ':include :type=code')

📚 Resources

#/bin/bash
# https://docs.docker.com/install/linux/docker-ce/ubuntu/

echo -e '\e[38;5;198m'"++++ "
echo -e '\e[38;5;198m'"++++ Ensure Docker Daemon is running (Dependency)"
echo -e '\e[38;5;198m'"++++ "
if pgrep -x "dockerd" >/dev/null
then
  echo -e '\e[38;5;198m'"++++ Docker is running"
else
  echo -e '\e[38;5;198m'"++++ Ensure Docker is running.."
  sudo bash /vagrant/docker/docker.sh
fi

docker stop trex
docker rm trex
yes | sudo docker system prune -a
yes | sudo docker system prune --volumes

echo -e '\e[38;5;198m'"++++ "
echo -e '\e[38;5;198m'"++++ Docker build -t trex ."
echo -e '\e[38;5;198m'"++++ "
cd /vagrant/trex/trex-nodejs
docker build -t trex .

echo -e '\e[38;5;198m'"++++ "
echo -e '\e[38;5;198m'"++++ Docker images --filter reference=trex"
echo -e '\e[38;5;198m'"++++ "
docker images --filter reference=trex

echo -e '\e[38;5;198m'"++++ "
echo -e '\e[38;5;198m'"++++ Docker run -t -d -i -p 6001:6001 --name trex --rm trex"
echo -e '\e[38;5;198m'"++++ "
docker run -t -d -i -p 6001:6001 --name trex --rm trex

echo -e '\e[38;5;198m'"++++ "
echo -e '\e[38;5;198m'"++++ Docker ps -f name=trex"
echo -e '\e[38;5;198m'"++++ "
docker ps -f name=trex

echo -e '\e[38;5;198m'"++++ Open http://localhost:6001 in your browser"