Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch the backstage project to support docker build using dind-rootless image #21

Open
cmoulliard opened this issue Jun 9, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@cmoulliard
Copy link
Contributor

cmoulliard commented Jun 9, 2022

To do

Refactor the bash install script to patch the backstage project in order to support to build the docs using the Mkdocs python tool to:

  • Have a new container running dind-rootless
  • Configure the techdocs.generator and specifiy the image of mkdocs to be used
docker pull docker:dind-rootless 
docker tag docker:dind-rootless  registry.harbor.10.0.77.176.nip.io:32443/tap/dind-rootless
docker push registry.harbor.10.0.77.176.nip.io:32443/tap/dind-rootless

k patch pkgi tap -n tap-install -p '{"spec":{"paused":true}}' --type=merge
k patch pkgi tap-gui -n tap-install -p '{"spec":{"paused":true}}' --type=merge

TEMP_DIR="$HOME/tmp"
cat <<EOF > $TEMP_DIR/tap-gui-dind-patch.yaml
spec:
  template:
    spec:
      containers:
      - command:
        - dockerd      
        - --host
        - tcp://127.0.0.1:2375
        image: registry.harbor.10.0.77.176.nip.io:32443/tap/dind-rootless
        imagePullPolicy: IfNotPresent
        name: dind-daemon
        resources: {}
        securityContext:
          privileged: true
          runAsUser: 0
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /tmp
          name: tmp
        - mountPath: /output
          name: output
      - name: backstage
        env:
        - name: DOCKER_HOST
          value: tcp://localhost:2375
        volumeMounts:
        - mountPath: /tmp
          name: tmp
        - mountPath: /output
          name: output
      volumes:
      - emptyDir: {}
        name: tmp
      - emptyDir: {}
        name: output
EOF

k get secret -n tap-gui app-config-ver-1 -o json | jq -r '.data."app-config.yaml"' | base64 -d > $TEMP_DIR/tap-gui-secret.yaml
cat <<EOF >> $TEMP_DIR/tap-gui-secret.yaml
techdocs:
  generator:
    dockerImage: ghcr.io/vrabbi/techdocs:v1.0.3
EOF

CM_CONTENT=`cat $TEMP_DIR/tap-gui-secret.yaml | base64 -w 0`
cat << EOF > $TEMP_DIR/tap-gui-secret-patch.yaml
data:
  app-config.yaml: $CM_CONTENT
EOF

k patch secret -n tap-gui app-config-ver-1 --patch-file $TEMP_DIR/tap-gui-secret-patch.yaml
k patch deploy server -n tap-gui --patch-file $TEMP_DIR/tap-gui-dind-patch.yaml
k rollout status deployment server -n tap-gui

Thanks to vrabbi: https://github.com/vrabbi/local-tap-setup/blob/master/local-tap.sh#L685 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant