Connecting outside of localhost
dmikalova opened this issue · 4 comments
I'm trying to set this up on DigitalOcean on Ubuntu 20.04 and I can't seem to get the screeps port to connect to the internet. If I try another container the port is exposed fine with netcat. But with the screeps port I can't ever connect to it outside of localhost. Am I missing something?
config.yml
# steamKey: <YourSteamKey>
# env:
# shared:
# MONGO_HOST: localhost
# REDIS_HOST: localhost
version: latest
mods:
- screepsmod-admin-utils
- screepsmod-auth
- screepsmod-mongo
# bots:
# simplebot: "screepsbot-zeswarm"
# overmind: "./bots/overmind/dist" # On windows path needs to be .\\bots\\overmind\\dist
# extraPackages:
# morgan: "*"
localMods: ./mods
# backup:
# dirs:
# - tests
# - bots/overmind
# files:
# - .screepsrc # You probably don't need this, jsut an example
serverConfig:
welcomeText: |
<style>.screepsplus h1{ text-align: center; }</style>
<div class="screepsplus">
<h1>ScreepsPlus</h1>
Wecome to the ScreepsPlus private server.<br>
Mods include screepsmod-auth and several custom mods to enable email notifications, control tickrate, power banks, portals, and other internal improvements.<br><br>
<div style="text-align: center">
This server is funded by backers on Patreon. <br>
<a target="_blank" href="https://www.patreon.com/bePatron?u=6867142" ><img src="https://c5.patreon.com/external/logo/become_a_patron_button.png"></a>
</div>
constants:
TEST_CONSTANT: 123
tickRate: 1000
docker-compose.yml - I would expect this to publish the screeps port to 8080, I haven't found any variation on this that works.
version: '3.2'
services:
screeps:
image: screepers/screeps-launcher
volumes:
- ./config.yml:/screeps/config.yml
- screeps-data:/screeps
ports:
# - 21025:21025/tcp
- target: 21025
published: 8080
protocol: tcp
mode: host
environment:
MONGO_HOST: mongo
REDIS_HOST: redis
STEAM_KEY: $STEAM_KEY
restart: unless-stopped
mongo:
image: mongo
ports:
- 27017:27017/tcp
volumes:
- mongo-data:/data/db
restart: unless-stopped
redis:
image: redis
ports:
- 6379:6379/tcp
volumes:
- redis-data:/data
restart: unless-stopped
volumes:
redis-data:
mongo-data:
screeps-data:
commands:
docker-compose up -d
# netstat shows the port open
netstat -plant | grep 80
# nc can connect to the port from the machine but not from home. This works with a simple server.
nc -zvv 0.0.0.0 8080
# simple server example to validate no firewall issues
docker run --rm -p 8080:80 yeasy/simple-web:latest
Usually just having - 21025:21025
in the ports section is enough (or in your case, - 8080:21025
)
Also, you want to avoid having the ports exposed on the redis and mongo containers unless you have firewall setup to restrict them.
Thanks, that's what I would expect too so I'm still not sure why its not working. I'm just going to close this and keep trying other things.
@dmikalova What is the solution?
@geocine it's been a while since I set this up, but this is the config I have that's been working solid:
version: "3"
services:
mongodb:
image: mongo
volumes:
- ./mongo:/data/db
redis:
image: redis
screeps:
build: screeps
volumes:
- ./mods.json:/screeps/mods.json
depends_on:
- mongodb
- redis
environment:
STEAM_API_KEY: $STEAM_API_KEY
ports:
- "21025:21025"
I start it like this:
export STEAM_API_KEY="x"
docker-compose up -d
and here's mods.json:
{
"mods": [
"node_modules/screepsmod-mongo/index.js",
"node_modules/screepsmod-auth/index.js",
"node_modules/screepsmod-tickrate/index.js",
"node_modules/screepsmod-admin-utils/index.js",
"node_modules/screepsmod-features/index.js"
],
"bots": {
"simplebot": "node_modules/@screeps/simplebot/src"
}
}