A Simple static file server to use as an external download server for CS:Source
- Docker CE (Community Edition) Runtime, which can be found here. You can use Docker on most operating systems.
- NodeJS (tested on v6.10.0, but should work on any version 6.x)
Note: All instructions are written for Linux systems, including filepaths. You will need to adjust accordingly for Windows Machines.
These steps assume you will pull the pre-built docker image.
- In the terminal, run
docker pull tugayac/cs-source-file-server
. This will get the latest Docker image from Docker Hub. You can see the available versions, if you don't want the latest version. - Go to "Shared Steps".
These steps assume you will build the docker image on your machine. Note, it requires NodeJS and NPM to be installed.
- Clone this Repository.
- In the terminal, run
npm run dockerize
. This will create the docker image. - Go to "Shared Steps".
- Go to a folder where you would like to create a folder called
public
. Inside this folder, create another folder, calledcstrike
. - Use the
run.sh
file provided in this repository to start the docker container. You can either execute the contents directly or download and run that bash script. - Let's break down what that run script is doing:
docker run -d -p 8089:8089 -v `pwd`/public:/usr/src/app/public tugayac/cs-source-file-server
The -d
means it will run in detached mode, i.e. in the background.
-p 8089:8089
means that the host (your computer) will be able to access port 8089 on the container, at port 8089. The mapping takes this format: -p <host-computer-port>:<container-port>
. So you can change <host-computer-port>
to any free port on your computer.
In -v `pwd`/public:/usr/src/app/public
, the pwd
command returns the current directory this command is being executed in. So if you're running the command from the /Users/username/Documents/server
directory, the computer interprets this part as -v /Users/username/Documents/server/public:/usr/src/app/public
. You can replace pwd
with any path you want or run the script from the directory where your public
folder is located. This part with the -v
essentially links the directory named public to the directory INSIDE the container, at /usr/src/app/public
. So whatever you place in the /Users/username/Documents/server/public
directory will be picked up by the static file server.
The last part of the command tugayac/cs-source-file-server
signifies that a new container should be created from this image.
- Once you've figured out which pathway to expose to your container, run the command above to start the docker container. Mine looks like this:
docker run -d -p 8089:8089 -v /Users/username/Documents/server/public:/usr/src/app/public tugayac/cs-source-file-server
- In the terminal, run
docker ps
. You should see something like this. If you do, your container is running successfully!
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c6b4b94bb5c0 tugayac/cs-source-file-server "node bundle.js" 11 minutes ago Up 11 minutes 0.0.0.0:8089->8089/tcp pedantic_babbage
- Place All the maps, assets, nav files, etc in the
public/cstrike
directory you created. The folder structure must be the same as it is in the CS:S installation directory. So for example, the maps go into the folderpublic/cstrike/maps
, and so on. - To test that it's working, go to http://localhost:8089/cstrike/maps/your-map-filename.bsp. If a file is downloading successfully, all is good!
You may access the logs to see who has made a request to your file server. To do that, first run docker ps
. That should give you an output like the following:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c6b4b94bb5c0 tugayac/cs-source-file-server "node bundle.js" 11 minutes ago Up 11 minutes 0.0.0.0:8089->8089/tcp pedantic_babbage
Copy the "ID" under the column "Container ID". Again in the terminal, run docker logs -f c6b4b94bb5c0
. This will display the logs as requests come to your server. Make a request to your server and see more output! In fact, it'll look like this:
Listening on port 8089
::ffff:172.17.0.1 - - [07/Mar/2017:04:31:04 +0000] "GET /public/cstrike HTTP/1.1" - - "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
::ffff:172.17.0.1 - - [07/Mar/2017:04:31:05 +0000] "GET /favicon.ico HTTP/1.1" - - "http://localhost:8089/public/cstrike" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36"
TODO