Flesh out workshop instructions.

This commit is contained in:
2023-08-31 08:43:47 +12:00
parent 7515d116a4
commit 91220f9a78
3 changed files with 136 additions and 29 deletions

View File

@ -38,7 +38,7 @@ oc new-project bitbucket
#+RESULTS:
#+begin_example
Already on project "bitbucket" on server "https://api.rosa-7lpn7.2pqm.p1.openshiftapps.com:6443".
Now using project "bitbucket" on server "https://api.cluster-dkxhl.dkxhl.sandbox1652.opentlc.com:6443".
You can add applications to this project with the 'new-app' command. For example, try:
@ -53,35 +53,72 @@ to build a new example application in Ruby. Or use kubectl to deploy a simple Ku
Once the namespace is created we can deploy Bitbucket using the official Bitbucket image from Atlassian.
#+begin_src bash :results output
oc --namespace bitbucket new-app --image docker.io/atlassian/bitbucket-server --name bitbucket
cat << EOF | oc --namespace bitbucket apply --filename -
kind: Deployment
apiVersion: apps/v1
metadata:
name: bitbucket
namespace: bitbucket
labels:
app: bitbucket
spec:
replicas: 1
selector:
matchLabels:
deployment: bitbucket
template:
metadata:
labels:
deployment: bitbucket
spec:
volumes:
- name: bitbucket-volume
emptyDir: {}
containers:
- name: bitbucket
image: docker.io/atlassian/bitbucket-server@sha256:30556d63fc935a1c3c9da41e6fff617e452ad7a52060a92b6a20f9179dd637a5
ports:
- containerPort: 7990
protocol: TCP
- containerPort: 7999
protocol: TCP
resources:
limits:
cpu: 500m
memory: 4096Mi
volumeMounts:
- name: bitbucket-volume
mountPath: /var/atlassian/application-data/bitbucket
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: IfNotPresent
restartPolicy: Always
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 25%
maxSurge: 25%
revisionHistoryLimit: 10
progressDeadlineSeconds: 600
EOF
#+end_src
#+RESULTS:
#+begin_example
--> Found container image 525a6bc (3 days old) from docker.io for "docker.io/atlassian/bitbucket-server"
,* An image stream tag will be created as "bitbucket:latest" that will track this image
--> Creating resources ...
imagestream.image.openshift.io "bitbucket" created
deployment.apps "bitbucket" created
service "bitbucket" created
--> Success
Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
'oc expose service/bitbucket'
Run 'oc status' to view your app.
#+end_example
: deployment.apps/bitbucket created
Now, let's verify that the Bitbucket pod started successfully.
#+begin_src bash :results output
oc --namespace bitbucket get pods
#+end_src
#+RESULTS:
: NAME READY STATUS RESTARTS AGE
: bitbucket-56d9849bbf-7922z 1/1 Running 0 2m36s
: bitbucket-74bc96b849-5nbvl 1/1 Running 0 45s
As this is running successfully, let's expose it with a ~route~ so that we can access it from our web browser.
@ -92,12 +129,12 @@ oc --namespace bitbucket get route
#+RESULTS:
: route.route.openshift.io/bitbucket created
: NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
: bitbucket bitbucket-bitbucket.apps.rosa-7lpn7.2pqm.p1.openshiftapps.com bitbucket 7990 edge None
: NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD
: bitbucket bitbucket-bitbucket.apps.cluster-dkxhl.dkxhl.sandbox1652.opentlc.com bitbucket 7990 edge None
Once we open the Bitbucket route in our browser, we need to follow a short setup process manually before we can continue with the rest of our automation.
1. Select your language ~English~.
1. Select your language ~English (United States)~.
2. Select ~internal~ and click ~Next~.
You'll then be prompted for an Atlassian license key. For the purposes of this workshop, we'll be generating a new trial license [[https://my.atlassian.com/license/evaluation][here]].
@ -118,15 +155,14 @@ First step is to create additional users.
#+begin_src bash :results none
source .env
bitbucket_route=$(oc get route --namespace bitbucket | awk '{print $2}' | tail -n 1)
for user in {1..30}; do
echo curl --user "admin:${bitbucket_password}" \
--header "'Content-Type: application/json'" \
--data ""
"\"https://${bitbucket_route}/rest/api/latest/admin/users?name=user${user}&displayName=user${user}&emailAddress=user${user}%40example.com&password=${bitbucket_user_password}\"" >> users.sh
--header "'X-Atlassian-Token: nocheck'" \
--request "POST" \
"\"https://${bitbucket_route}/rest/api/latest/admin/users?name=user${user}&displayName=user${user}&emailAddress=user${user}%40example.com&password=${bitbucket_user_password}\"" >> users.sh
cat users.sh
done
chmod +x users.sh && ./users.sh && rm users.sh
#+end_src
@ -178,7 +214,7 @@ EOF
#+end_src
#+RESULTS:
: subscription.operators.coreos.com/openshift-pipelines-operator created
: subscription.operators.coreos.com/openshift-pipelines-operator configured
* 5 - Install openshift web terminal operator
@ -241,4 +277,3 @@ EOF
#+end_src
#+RESULTS:
: knativeserving.operator.knative.dev/knative-serving created