swg-docker
This project sets up a development environment for SWG using Docker.
Instructions:
- Clone this repository.
- (Optional) To use a custom git repository for the server source, create a file named
.envin this directory. See the "Custom Repository" section below for details. - Run
docker compose up -d --buildto build the images and start the services. - Run
docker exec -it swg bashto log into a shell in theswgcontainer. - Run
ant swgto compile the game and the assets. You only need to run this once, the first time you build the docker image, or if you destroy the docker volumes. - Run
ant start &to run the server. - Run
ant stopto stop your server.
Connecting your client
To connect your client to the server, you'll need to open the login.cfg file within your client directory
and set the loginServerAddress0 to the ip address of the machine that is hosting the docker container, or
to 127.0.0.1 if you are hosting the docker container on the same machine as the client.
[Station]
subscriptionFeatures=1
gameFeatures=65535
[ClientGame]
loginServerPort0=44453
loginServerAddress0=127.0.0.1
NOTE: If your client does not connect, i.e., you're able to login but you can't connect to the galaxy, it's likely that you
need to update the CLUSTER_LIST with the correct IP ADDRESS to match where the docker container is being hosted. By default
this gets set to 127.0.0.1 in the entrypoint.sh script. If you're hosting docker remotely, then you need to update the
entrypoint.sh script, at the bottom and set the CLUSTER_LIST IP to your remote IP. Then just do a docker compose down and
a docker compose up -d --build and everything will be fixed.
Completely wiping your local Docker environment
docker compose down -v
This will remove all the volumes, including the database and the swg-main project directory. You will have to recompile the project all over again.
Shutting down your Container, Safely, Without Loss
docker compose down
This will shut down the container, but it will keep the volumes, i.e., your database will stay, and your swg-main project directory will be kept intact.
Custom Repository
You can configure the Docker build to pull the swg-main source from your own repository. Create a file named .env in the root of this project and add the following variables as needed.
Example .env file:
# .env file for custom repository configuration
# The full HTTPS URL to your git repository.
# If left unset, it defaults to https://github.com/SWG-Source/swg-main.git
REPO_URL=https://github.com/SWG-Source/swg-main.git
# (Optional) Credentials for private repositories.
# For security, it is highly recommended to use a Personal Access Token instead of your actual password.
# If you do not need a username or password then ignore adding these lines.
REPO_USERNAME=your-gitlab-username
REPO_PASSWORD=your-personal-access-token
# (Optional) Credentials for the oracle DB user/pass, otherwise DO NOT add these 2 lines.
DB_USER=swg
DB_USER_PASSWORD=swg
DEVELOPER GUIDE
Here are some commands that will help with development. Say you need to move files to the TRE and they compiled within the container, you can easily copy files to your local file system.
First, exit the container with exit then:
docker cp <container_name>:<path_inside_container> <local_path>
For example, this command will copy the buff.iff file to a local directory called ServerFiles on the Desktop of my
Window's machine. NOTE: For Windows, surround the <local_path> with quotes.
docker cp swg:/swg-main/data/sku.0/sys.shared/compiled/game/datatables/buff/buff.iff "C:\Users\username\OneDrive\Desktop\ServerFiles"