Getting Started

image

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.

  1. Install Git – access to project source code

  2. Clone the Dysruption GitLab repository

  3. Change directory in your command prompt to the location of your cloned repository.
    cd dysruption

  4. Install AWS CLI – used mainly by the AWS CDK, but also for AWS authentication

  5. 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.

  6. Install Node – used for the game server, the game client, and AWS dependencies

  7. Change directory in your command prompt to the location of the dysruption/cdk folder.
    cd cdk

  8. 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, run npm install -g aws-cdk

  9. Change directory in your command prompt back to the location of the dysruption folder.
    cd .. and then run npm run init

  10. 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

  1. cd cdk

  2. cdk deploy --outputs-file ../server/cdk-outputs.json DevStack

Deploy for Public Access

The public URL will be the Cloud Front Distribution domain name.

  1. cd cdk

  2. 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.

  1. Open dysruption/server_qgis/Dockerfile.

  2. Replace line 23 FROM --platform=linux/x86_64 ubuntu:${ubuntu_dist} with FROM --platform=linux/amd64 ubuntu:${ubuntu_dist} Note: You will need to reset this to x86_64 before deploying a ProdStack for production

  3. docker 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

  1. Launch the Docker Desktop app.

  2. Change directory to dysruption folder cd dysruption:

  3. 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

  4. docker compose up

  5. 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 running docker 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 running docker compose up again. This will completely delete your previous containers and rebuild new ones from source files.