Getting Started
To begin development for Dysruption you must have Amazon Web Services (AWS) and GitLab accounts with access to the project.
Setup and configuration
The setup and configuration steps in this section will need to be performed only once.
Install Git – access to project source code
Clone the Dysruption GitLab repository
Change directory in your command prompt to the location of your cloned repository.
cd dysruption
Install AWS CLI – used mainly by the AWS CDK, but also for AWS authentication
In your root directory (e.g., Users/johndoe/) you should have a new hidden folder “.aws”. Drag the config file into this folder.
You can login to AWS from the command line to verify the config file works properly:
aws sso login
. You should see a new window open in your browser asking you to confirm the login. Select “confirm”, and “allow” if you see those options.
Install Node – used for the game server, the game client, and AWS dependencies
Change directory in your command prompt to the location of the dysruption/cdk folder.
cd cdk
Install all node packages for project.
npm install
Test to see if you have installed cdk by running
cdk --version
. If you do not see cdk is installed, runnpm install -g aws-cdk
Change directory in your command prompt back to the location of the dysruption folder.
cd ..
and then runnpm run init
Install Docker – used for local development and for packaging releases
Deploy the AWS Resources
This process will generate a cdk/config.txt file if it doesn’t exist. This file should contain a unique string to identify the particular AWS Stack that will be deployed. You can rely on the file being auto-generated, or create your own with a more friendly string. That string will be used to name the AWS resources and allows for a developer to have multiple stacks running at the same time, each with their own identifier.
This project also relies on saving some CDK generated information to a .json file, which is read by the server/client code. Hence, the –outputs-file command line option.
You will get an error if you are not logged into AWS from the command line, or if your login session has timed out. To login to AWS, run aws sso login
. You should see a new window open in your browser asking you to confirm the login. Select “confirm”, and “allow” if you see those options.
Deploy for Local Developement
cd cdk
cdk deploy --outputs-file ../server/cdk-outputs.json DevStack
Deploy for Public Access
The public URL will be the Cloud Front Distribution domain name.
cd cdk
cdk deploy --outputs-file ../server/cdk-outputs.json ProdStack
Apple Silicon Chips Additional Steps for Local Development
The docker image for the QGIS server is not cross-platform. The AWS servers run with an x86_64 chip architecture, and the QGIS server docker image is built for this by default. When you are trying to run the docker images locally, the QGIS server image needs to be rebuilt so that it can run on Apple Silicon chips.
Open dysruption/server_qgis/Dockerfile.
Replace line 23
FROM --platform=linux/x86_64 ubuntu:${ubuntu_dist}
withFROM --platform=linux/amd64 ubuntu:${ubuntu_dist}
Note: You will need to reset this tox86_64
before deploying a ProdStack for productiondocker build -t registry.gitlab.nps.edu/moves/dysruption/qgis_server:1.0.0 .
After this you should only need to this again when you make changes to files within the qgis_server folder such as the data, and need a new image to reflect these changes.
Launching Docker Containers
Launch the Docker Desktop app.
Change directory to dysruption folder
cd dysruption
:Login to ensure you have access to the docker images for the project hosted on GitLab. You will be prompted to enter your GitLab authentication details.
docker login registry.gitlab.nps.edu/moves/dysruption:latest
docker compose up
Your Docker containers should have launched. Ctrl+c to exit out of the containers.
If you receieved an authentication error: You will need to build the images yourself by changing directory to the server_qgis folder
cd server_qgis
, and runningdocker build -t registry.gitlab.nps.edu/moves/dysruption/qgis_server:1.0.0 .
to create a local image.If you make changes to the files, you will want to run
docker compose down
before runningdocker compose up
again. This will completely delete your previous containers and rebuild new ones from source files.