Skip to content

Commit

Permalink
Backport: Cherry-pick from merge commit 6fd7b88
Browse files Browse the repository at this point in the history
Merge pull request #93 from startersclan/docs/examples-add-missing-step-to-restart-bf2-server-after-setting-up-the-db-the-first-time

Docs (examples): Add missing step to restart BF2 server after setting up the DB the first time
  • Loading branch information
leojonathanoh committed Jan 21, 2023
1 parent 46c1de3 commit 2359c3e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
12 changes: 9 additions & 3 deletions docs/bf2hub-bf2stats-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The stack is now running:
- `bf2sclone` available at https://bf2sclone.example.com on your external IP address.
- `phpmyadmin` available at https://phpmyadmin.example.com on your external IP address.

> If you are behind NAT, you will need to forward all of the above TCP and UDP ports to your external IP address, in order for clients to reach your gameserver and webserver over the internet.
> If you are behind NAT, you will need to forward all of the above TCP and UDP ports to your external IP address, in order for clients to reach your BF2 server and webserver over the internet.
### 4. Setup the stats DB

Expand All @@ -62,11 +62,17 @@ Visit https://asp.example.com/ASP and login using `$admin_user` and `$admin_pass
Click on `System > Install Database` and install the DB using `$db_host`,`$db_port`,`$db_name`,`$db_user`,`$db_pass` you defined in [`config.php`](./config/ASP/config.php). Click `System > Test System` and `Run System Tests` and all tests should be green, except for the `BF2Statistics Processing` test and the four `.aspx` tests, because we still don't have a Fully Qualified Domain Name (FQDN) with a public DNS record.

Then, restart the BF2 server so that it begins recording stats:

```sh
docker-compose restart bf2
```

### 5. Play

Install BF2 1.5, download and install the [BF2Hub client](https://www.bf2hub.com/home/downloads.php), checking all the boxes during the installation. Laucnh the `BF2Hub Client`, and `Register Account` to sign up if you don't yet have an account. Now, to ensure our private ranking system is used, click each of the two `Basic Settings > Ranking to be used for your ingame BFHQ ...` buttons and select `Custom` and enter `asp.example.com` (or your FQDN) in the box. Then click `PLAY BATTLEFIELD2` to start the game.
Install BF2 1.5, download and install the [BF2Hub client](https://www.bf2hub.com/home/downloads.php), checking all the boxes during the installation. Laucnh the `BF2Hub Client`, and `Register Account` to sign up if you don't yet have an account. Now, to ensure our private ranking system is used, click each of the two `Basic Settings > Ranking to be used for your ingame BFHQ ...` buttons and select `Custom` and enter `asp.example.com` (or your FQDN) in the box. Then click `PLAY BATTLEFIELD2` to start the game.

Login to your account, and click `MULTIPLAYER > JOIN INTERNET` and in the server list, you should see your server listed by the BF2Hub master server. Join your server.
Login to your account, and click `MULTIPLAYER > JOIN INTERNET` and in the server list, you should see your server listed by the BF2Hub master server. Join your server.

At the end of the first game, you should see your stats updated at https://bf2sclone.example.com.

Expand Down
16 changes: 8 additions & 8 deletions docs/bf2hub-bf2stats-example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ services:
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=ovh"
# - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=postmaster@example.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
- --certificatesresolvers.myresolver.acme.dnschallenge=true
- --certificatesresolvers.myresolver.acme.dnschallenge.provider=ovh
# - --certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.myresolver.acme.email=postmaster@example.com
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json

# The init container that sets up permissions for the asp and db volumes
init-container:
Expand Down Expand Up @@ -134,9 +134,9 @@ services:
bf2-network:
aliases:
- asp.example.com
- bf2web.gamespy.com # Important! Spoof Gamespy DNS for the gameserver to reach our ASP server IP
- gamestats.gamespy.com # Spoof Gamespy DNS for the gameserver to reach our ASP server IP. Doesn't seem to be used by the gameserver, but spoof anyway.
- eapusher.dice.se # Spoof Gamespy DNS for the gameserver to reach our ASP server IP. Doesn't seem to be used by the gameserver, but spoof anyway.
- bf2web.gamespy.com # Important! Spoof Gamespy DNS for the BF2 server to reach our ASP server IP
- gamestats.gamespy.com # Spoof Gamespy DNS for the BF2 server to reach our ASP server IP. Doesn't seem to be used by the BF2 server, but spoof anyway.
- eapusher.dice.se # Spoof Gamespy DNS for the BF2 server to reach our ASP server IP. Doesn't seem to be used by the BF2 server, but spoof anyway.
depends_on:
- init-container
- asp-php
Expand Down
6 changes: 6 additions & 0 deletions docs/full-bf2-stack-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ Visit https://asp.example.com/ASP and login using `$admin_user` and `$admin_pass

Click on `System > Install Database` and install the DB using `$db_host`,`$db_port`,`$db_name`,`$db_user`,`$db_pass` you defined in [`config.php`](./config/ASP/config.php). Click `System > Test System` and `Run System Tests` and all tests should be green, except for the `BF2Statistics Processing` test and the four `.aspx` tests, because we still don't have a Fully Qualified Domain Name (FQDN) with a public DNS record.

Then, restart the BF2 server so that it begins recording stats:

```sh
docker-compose restart bf2
```

### 5. Setup DNS server

Configure `coredns` to spoof all gamespy DNS in [config/coredns/hosts](config/coredns/hosts), replacing the IP addresses with your machine's external IP address which you specified in Step `2.`. Assuming your external IP is `192.168.1.100`, it should look like:
Expand Down
4 changes: 2 additions & 2 deletions docs/full-bf2-stack-example/config/coredns/hosts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Replace these gamespy's DNS records with your machine's external IP addresses
192.168.1.100 eapusher.dice.se
192.168.1.100 battlefield2.available.gamespy.com
192.168.1.100 battlefield2.master.gamespy.com
192.168.1.100 battlefield2.ms14.gamespy.com
192.168.1.100 gamestats.gamespy.com
192.168.1.100 master.gamespy.com
192.168.1.100 motd.gamespy.com
192.168.1.100 gpsp.gamespy.com
192.168.1.100 gpcm.gamespy.com
192.168.1.100 gamespy.com
192.168.1.100 bf2web.gamespy.com
192.168.1.100 gamestats.gamespy.com
192.168.1.100 eapusher.dice.se
18 changes: 9 additions & 9 deletions docs/full-bf2-stack-example/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ services:
- 27900:27900/udp # Master server
- 29910:29910/udp # CD key server
networks:
# Spoof all gamespy DNS for the gameserver connected to this network
# Spoof all gamespy DNS for the BF2 server connected to this network
gamespy-network:
aliases:
- eapusher.dice.se
- battlefield2.available.gamespy.com
- battlefield2.master.gamespy.com
- battlefield2.ms14.gamespy.com
- gamestats.gamespy.com
- master.gamespy.com
- motd.gamespy.com
- gpsp.gamespy.com
- gpcm.gamespy.com
- gamespy.com
- bf2web.gamespy.com
- gamestats.gamespy.com
- eapusher.dice.se
restart: unless-stopped

# A DNS server to spoof gamespy's DNS records for BF2 clients or servers
Expand All @@ -60,7 +60,7 @@ services:
# ports:
# - 192.168.1.100:53:53/udp
# Test DNS records to ensure coredns responds with your machine's external IP address. For example:
# nslookup bf2web.gamespy.com 192.168.1.100
# nslookup bf2web.gamespy.com 192.168.1.100
# Response should be:
# Server: 192.168.1.100
# Address: 192.168.1.100#53
Expand Down Expand Up @@ -104,11 +104,11 @@ services:
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- "--certificatesresolvers.myresolver.acme.dnschallenge=true"
- "--certificatesresolvers.myresolver.acme.dnschallenge.provider=ovh"
# - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=postmaster@example.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
- --certificatesresolvers.myresolver.acme.dnschallenge=true
- --certificatesresolvers.myresolver.acme.dnschallenge.provider=ovh
# - --certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory
- --certificatesresolvers.myresolver.acme.email=postmaster@example.com
- --certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json

# The init container that sets up permissions for the asp and db volumes
init-container:
Expand Down

0 comments on commit 2359c3e

Please sign in to comment.