[5 Mins Docker] Create Your Own 80s-90s DOS Gaming Website (1898 Games) - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Sunday, December 10, 2023

[5 Mins Docker] Create Your Own 80s-90s DOS Gaming Website (1898 Games)

There are lots of Chinese DOS games in 1980s - 1990s. The Github page (https://github.com/rwv/chinese-dos-games)  collected them and created a docker image to simplify the steps to bring them up into a website. You even can create your own website with just a couple of simple commands. 

In this post, I am going to go through those steps in 5 minutes and show you how simple it is. 



Github Page: https://github.com/rwv/chinese-dos-games

Demo site: https://dos.lol/

Screenshots


Web Interface:



Game list:




Installation Steps in Docker Playground

PWD https://labs.play-with-docker.com/


$ apk add virt-what
$ virt-what
hyperv
docker

$ sudo apk update
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.16/community/x86_64/APKINDEX.tar.gz
v3.16.2-203-g16a4499ea3 [https://dl-cdn.alpinelinux.org/alpine/v3.16/main]
v3.16.2-202-ge26245aea1 [https://dl-cdn.alpinelinux.org/alpine/v3.16/community]
OK: 17053 distinct packages available
[node1] (local) [email protected] ~
$ sudo apk add git
OK: 395 MiB in 156 packages
[node1] (local) [email protected] ~
$ git --version
git version 2.36.2
[node1] (local) [email protected] ~
$ 
Note: If you are using PWD (Play with docker), the copy shortcut key is ctrl+insert, paste is ctrl+shift+v or ctrl+insert.


###############################################################
#                          WARNING!!!!                        #
# This is a sandbox environment. Using personal credentials   #
# is HIGHLY! discouraged. Any consequences of doing so are    #
# completely the user's responsibilites.                      #
#                                                             #
# The PWD team.                                               #
###############################################################
[node1] (local) [email protected] ~
$ df -m
Filesystem           1M-blocks      Used Available Use% Mounted on
overlay                  10240         0     10240   0% /
tmpfs                       64         0        64   0% /dev

[node1] (local) [email protected] ~

We got 10G to play in this Docker Playground. 


1 Create installation folder:

sudo -i

mkdir -p /root/data/docker_data/games

cd /root/data/docker_data/games

Plain text

vi docker-compose.yml
Plain text




2 Create Own Security Policies

The all games will be about 36G. It will be too big for a docker image. 

So there are two different ways to install it.

Method 1: using default docker image which only has about 40 games. The docker image size is about 600MB. 

The docker compose file is:
version: '3.3'
services:
    dosgame-web-docker:
        container_name: dosgame
        ports:
            - '8090:262'  #8090 can be changed to any other unoccupied port.
#         volumes:
#             - '/root/data/docker_data/games/chinese-dos-games:/app/static/games'
        image: 'oldiy/dosgame-web-docker:latest'
Plain text


Once done, you can type "docker compose up -d" to bring it up. 

Then bring docker up

docker-compose up -d





Here are all games:

游戏列表


Of course, if you don't like docker compose file, you can use following one command to bring this game docker up :

docker run -d --name dosgame -p 8090:262 oldiy/dosgame-web-docker:latest

3 Method 2 : Install all games.

If your spare hard drive size is more than 36G, then you can try to install all 1989 games by downloading them.
The docker compose file will be:
version: '3.3'
services:
    dosgame-web-docker:
        container_name: dosgame
        ports:
            - '8090:262'  #8090 can be changed any other unoccupied port.
        volumes:
            - '/root/data/docker_data/games/chinese-dos-games:/app/static/games'
        image: 'oldiy/dosgame-web-docker:latest'


You will need to manually download the game using following commands:
cd /root/data/docker_data/games/

git clone https://github.com/rwv/chinese-dos-games.git

cd chinese-dos-games/

python3 download_data.py

Then bring docker up

docker-compose up -d


If there is no python or git, you might also need to run following commands to install them:

  • apt update -y
  • apt install git -y && apt install python3 -y


4  Check game files

After completed download, you can check file numbers using this command:
ls -l /root/data/docker_data/games/chinese-dos-games/bin | grep "^-" | wc -l
Plain text

The total number should be 1898
You also can use du command to check:
du -sh /root/data/docker_data/games
Plain text

Check total file size. It should be 36G:
36G /root/data/docker_data/games
Plain text


5  Bring up the game


cd /root/data/docker_data/games

docker-compose up -d
Plain text

or
/root/data/docker_data/games

docker compose up -d


Installation Pre-requirements

Free resources you might need to complete this docker project:


Pre-installed services:

  • Docker, 
    • apt update
    • apt install docker.io
    • apt install docker-compose
    • apt upgrade docker.io
    • mkdir /root/data/docker_data/<docker_name>
  • Docker-Compose (Using Ubuntu OS for the commands)
    • Docker-compose down
    • Optional command : use following command to backup your Docker data. You might need to change your folder name based on your docker configuraiton
      • cp -r /root/data/docker_data/<docker_name> /root/data/docker_data_backup/<docker_name>
    • docker-compose pull
    • docker-compose up -d
    • docker image prune
  • Portainer (Optional)
    • docker volume create portainer_data
    • docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
  • Install some applications: apt install wget curl sudo vim git (Optional)
  • aapanel with Nginx (Optional)
  • Nginx Proxy Manager (Optional)
  • Install screen (Optional)
    • Install screen (Depends on the Linux Distribution if it came pre installed or not) : yum install screen
    • Initiate a Screen : screen or  screen -S <screen name> <command to execute>
    • Detach from the screen : "CTRL+A,D" not "CTRL+A+D"
    • List all the screen currently working : screen -ls
    • Reattach to a screen : screen  -r  <session number> or screen -r <screen name>
    • Kill specific screen: screen -X -S <screen name> quit
    • Kill all screens : pkill screen


Install it from GCP Free VPS

 
1  Create VPS

2  Install Docker & Docker Compose

3  Install required system services and applications

4  Docker Compose file or Docker Run

docker run -d --name dosgame -p 8090:262 oldiy/dosgame-web-docker:latest

5  Download All games (Optional)

docker run -d --name dosgame -p 8090:262 -v /docker_data/dosgame/games:/app/static/games oldiy/dosgame-web-docker:latest

6  Bring docker up 

Docker-compose up -d

Videos

 



References









No comments:

Post a Comment