Setup

The next step to getting Docker running in your development environment is to download and run the containers.

  1. First, you need to authenitacte with the repository where the database container is saved.
    This repository is located on AWS, so you will need to authenticate your local Docker desktop install with the remote AWS repository. You can do this by obtaining an API Access key from AWS.

    1. Sign in to the AWS console here: https://898363003987.signin.aws.amazon.com/console
    2. Open the Identity and Access Management (IAM) dashboard by typing IAM in the search bar and clicking on the top result.
    3. Open the user list by clicking on the Users link.
      Instructional diagram for locating the "Users" link in the AWS IAM dashboard.
    4. Click on your username in the list.
    5. Click on the Security credentials tab.
      Instructional diagram for locating the "Security Credentials" tab in the AWS IAM User overview.
    6. Under the Access Keys heading, click on the Create access key button.
      Instructional diagram for locating the "Create access key" button in the AWS IAM User overview.
    7. In the popup window, click on the Download .csv file button.
      Instructional diagram for locating the "Download .csv file" button in the AWS IAM Create access key popup.
  2. Open the downloaded accessKeys.csv file in a text editor.

  3. Open a new git bash terminal in the stariumxcv folder.

  4. Configure the AWS CLI.

    1. Enter the configuration mode by running the following command:
       aws configure
    2. First, you will be prompted to enter your Access key id. The id is in the accessKeys.csv file you downloaded, on the second line (everything BEFORE the comma).
    3. Copy the value from the .csv and paste it into your terminal by pressing Shift + Insert.
    4. Press Enter in your terminal to save the Access key id.
    5. Next, you will be prompted for the Secret access key. This key is in the accessKeys.csv file you downloaded, on the second line (everything AFTER the comma).
    6. Copy the value from the .csv and paste it into your terminal by pressing Shift + Insert.
    7. Press Enter in your terminal to save the Secret access key.
    8. When prompted for the Default region name, type us-east-1 and press Enter.
    9. When prompted for the Default output format, type json and press Enter.
      The final result should look something like this (access key id and value removed for security reasons):
      Example diagram for reference when running "aws configure".
    10. Test that your API key is working by running the following command:
      aws ecr list-images --repository-name stariumxcv-dev
      The output should look something like the following:
      {
          "imageIds": [
              {
                  "imageDigest": "sha256:121361b3eedf1b730e25d0ff2e3594eb4f6c6accf6d336154eebd12a6d391422",
                  "imageTag": "latest"
              }
          ]
      }
  5. Make sure you have the latest version of the dev branch:

     git pull
  6. Log your Docker client into the stariumxcv-dev container registry by running the following command:

     aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 898363003987.dkr.ecr.us-east-1.amazonaws.com/stariumxcv-dev

    If the login was succesfull, you should see the following output:

     Login Succeeded
  7. Create a new file in the stariumxcv repository with the following path: stariumxcv/build/secrets/db_root_password. NOTE: Not db_root_password.txt!

  8. Open the new file and enter a password. IMPORTANT: YOUR PASSWORD CAN ONLY CONTAIN LETTERS AND NUMBERS!
    Please note that we MUST set a root password for the database when using Docker, so this file cannot be empty.

  9. Open your stariumxcv/functions/.env.php (NOTE: Not env.php! If you don't have a .env.php file, please refer to the documentation here) file and update the values as follows (replacing PASSWORD_YOU_ENTERED_IN_STEP_8 with its corresponding value):

     <?php
     // UNDER NO CIRCUMSTANCES SHOULD ".env.php" BE COMITTED TO THE GIT REPO
    
     $DB_USER = "root";
     $DB_PASSWORD = "PASSWORD_YOU_ENTERED_IN_STEP_8";
     $DB_HOST = "database";
    
     $DB_NAME_ACCOUNTS = "gwythdarian_accounts";
     $DB_NAME_EMAILS = "gwythdarian_emails";
     $DB_NAME_MASTER = "master";
     $DB_NAME_GAME = "stariumxcv_dev";
    
     $STARIUMXCV_PRODUCTION = false;
  10. Open the Docker desktop client by right clicking on the docker icon in your taskbar:

  11. Click on the Settings icon in the GUI:

  12. Click on the Resources tab on the left:

  13. Click on FILE SHARING:

  14. Select the drive from the list where your stariumxcv folder is located. In my case, this was drive S, but I went ahead and selected drive C as well for the purposes of this tutorial.

  15. Click Apply & Restart to restart the Docker daemon (not your computer).

  16. Close out of the settings menu:

  17. Test that everything up to here worked by running the game with the following command:

    docker-compose up -d
  18. Go back to the Docker desktop client.

  19. You should see the following in the GUI:

  20. Finally, open the game in your browser by clicking on the Open in browser icon in the stariumxcvdev_client_1 container:

If everything worked correctly, you should now be able to login to the game, create a position, and start developing!

To learn more about using the Docker desktop GUI as well as Docker from the command line, go on to the next page.