On This Page

Prerequisites

Make sure your cluster is in a healthy state:

kops validate cluster --wait 10m

Please make sure you have forked the dx-book/platform to your local environment. Since we’ll be cloning a repository in our newly created organization, outside our personal workspace, we’ll need to refresh our permissions.

unset GITHUB_TOKEN
gh auth login -h github.com -p https -w -s codespace,repo

Please follow the terminal authentication flow to get the permission updated. After, we can clone the dx-book/platform repository and make it our own.

gh repo fork dx-book/platform \
  --clone \
  --default-branch-only \
  --org=$GITHUB_ORG \
  --fork-name platform \
  --remote

From there, you can create a GitHub token with repositories read permission to your organization. And then run, from the platform folder, replacing the token with your own. The script configure.sh is a helper to execute the series of commands explained in the next section called Install manually.

Please have a look into the configure.sh and try to follow what’s happening there. Whenever you’re ready, run the command below, replacing your GitHub token.

cd platform
./configure.sh --github-token=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

TODO: Use sealed-secrets to not store secrets in plain text in the repository

This command, among many things, will also encrypted some secrets so we can store them in git safely. After encrypting the secret, the script will remove the original secret files from git and add it to the .gitignore and chart/.helmignore just to make sure we’ll never commit our secrets to the reopsitory.

If you’re skeptical like me, you can use this command to double-check. Let’s see:

git status
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   chart/.helmignore
        modified:   chart/templates/each/dependencies/values.yaml
        modified:   chart/templates/gene/values.yaml
        modified:   chart/values.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        chart/templates/base/secrets/github-admin-auth-encrypted.yaml
        chart/templates/base/secrets/github-environments-encrypted.yaml
        chart/templates/each/dependencies/templates/secrets/aws-dev-encrypted.yaml

Now we’ll need to push our platform values to the repository. Since this is your first commit inside the Codespace, make sure you can have the git cli configured properly. Use the gh command below for a simplified configuration.

gh auth setup-git 

After that, we can commit and push.

git add .
git commit -m "Updated platform"
git push origin main

In some mins we should have an available instance of ArgoCD and the initial admin login password printed for us to authenticate.

Great, that was easy, wasnt’t? So here ends the platform repository infrastructure deployment.

Next, we’ll look into how to bring the applications to use the platform using GitOps.