├── test-requirements.txt ├── images ├── kube_ui.png ├── system.png ├── dashboard.png ├── register.png ├── first_commit.png ├── kube_ui_gr.png ├── new_project.png ├── gitlab-passwd.png ├── pg_credentials.png ├── gitlab_container.png ├── gitlab_first_run.png └── gitlab_container_2.png ├── scripts ├── quickstart-postgres-svc.sh ├── quickstart.sh ├── resources.sh ├── bx_auth.sh ├── deploy.sh └── install.sh ├── tests ├── test-shellcheck.sh ├── test-yamllint.sh ├── test-docker-compose.sh ├── test-minikube.sh └── test-kubernetes.sh ├── .gitignore ├── CONTRIBUTING.md ├── config.yaml ├── kubernetes ├── local-volumes.yaml ├── redis.yaml ├── postgres.yaml ├── gitlab.yaml └── gitlab-postgres-svc.yaml ├── .travis.yml ├── .yamllint.yml ├── config-persistent.yaml ├── docs ├── using-gitlab.md ├── ssh-port-ingress.md ├── deploy-with-ICP.md ├── deploy-with-docker.md ├── use-bluemix-container-registry.md ├── deploy-with-docker-on-linuxone.md └── bluemix-postgres.md ├── .bluemix ├── pipeline.yml ├── toolchain.yml ├── icon.svg ├── deploy.json └── toolchain.svg ├── docker-compose.yml ├── MAINTAINERS.md ├── README-cn.md ├── README.ko.md ├── README.md ├── README-pt.md └── LICENSE /test-requirements.txt: -------------------------------------------------------------------------------- 1 | yamllint 2 | -------------------------------------------------------------------------------- /images/kube_ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/kube_ui.png -------------------------------------------------------------------------------- /images/system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/system.png -------------------------------------------------------------------------------- /images/dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/dashboard.png -------------------------------------------------------------------------------- /images/register.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/register.png -------------------------------------------------------------------------------- /images/first_commit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/first_commit.png -------------------------------------------------------------------------------- /images/kube_ui_gr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/kube_ui_gr.png -------------------------------------------------------------------------------- /images/new_project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/new_project.png -------------------------------------------------------------------------------- /images/gitlab-passwd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/gitlab-passwd.png -------------------------------------------------------------------------------- /images/pg_credentials.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/pg_credentials.png -------------------------------------------------------------------------------- /images/gitlab_container.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/gitlab_container.png -------------------------------------------------------------------------------- /images/gitlab_first_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/gitlab_first_run.png -------------------------------------------------------------------------------- /images/gitlab_container_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IBM/Kubernetes-container-service-GitLab-sample/HEAD/images/gitlab_container_2.png -------------------------------------------------------------------------------- /scripts/quickstart-postgres-svc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | kubectl create -f kubernetes/local-volumes.yaml 3 | kubectl create -f kubernetes/redis.yaml 4 | kubectl create -f kubernetes/gitlab-postgres-svc.yaml 5 | kubectl get nodes 6 | kubectl get svc gitlab 7 | -------------------------------------------------------------------------------- /scripts/quickstart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | kubectl create -f kubernetes/local-volumes.yaml 3 | kubectl create -f kubernetes/postgres.yaml 4 | kubectl create -f kubernetes/redis.yaml 5 | kubectl create -f kubernetes/gitlab.yaml 6 | kubectl get nodes 7 | kubectl get svc gitlab 8 | -------------------------------------------------------------------------------- /tests/test-shellcheck.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # shellcheck disable=SC1090 4 | source "$(dirname "$0")"/../scripts/resources.sh 5 | 6 | if find . -name '*.sh' -print0 | xargs -n1 -0 shellcheck -x -s bash; then 7 | test_passed "$0" 8 | else 9 | test_failed "$0" 10 | fi 11 | -------------------------------------------------------------------------------- /tests/test-yamllint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # shellcheck disable=SC1090 4 | source "$(dirname "$0")"/../scripts/resources.sh 5 | 6 | if find . \( -name '*.yml' -o -name '*.yaml' \) -print0 | xargs -n1 -0 yamllint -c .yamllint.yml; then 7 | test_passed "$0" 8 | else 9 | test_failed "$0" 10 | fi 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Vim files 2 | [._]*.s[a-w][a-z] 3 | [._]s[a-w][a-z] 4 | Session.vim 5 | .netrwhist 6 | *~ 7 | tags 8 | 9 | # Ignore macOS files 10 | *.DS_Store 11 | .AppleDouble 12 | .LSOverride 13 | ._* 14 | .DocumentRevisions-V100 15 | .fseventsd 16 | .Spotlight-V100 17 | .TemporaryItems 18 | .Trashes 19 | .VolumeIcon.icns 20 | .com.apple.timemachine.donotpresent 21 | .AppleDB 22 | .AppleDesktop 23 | Network Trash Folder 24 | Temporary Items 25 | .apdisk 26 | -------------------------------------------------------------------------------- /tests/test-docker-compose.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # shellcheck disable=SC1090 4 | source "$(dirname "$0")"/../pattern-ci/scripts/resources.sh 5 | 6 | main(){ 7 | if ! docker-compose up -d; then 8 | test_failed "$0" 9 | elif ! docker-compose ps; then 10 | test_failed "$0" 11 | elif ! sleep 1 && curl -sS localhost:30080; then 12 | test_failed "$0" 13 | else 14 | test_passed "$0" 15 | fi 16 | } 17 | 18 | main "$@" 19 | -------------------------------------------------------------------------------- /scripts/resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script contains functions used by many of the scripts found in scripts/ 4 | # and tests/. 5 | 6 | test_failed(){ 7 | echo -e >&2 "\033[0;31m$1 test failed!\033[0m" 8 | exit 1 9 | } 10 | 11 | test_passed(){ 12 | echo -e "\033[0;32m$1 test passed!\033[0m" 13 | } 14 | 15 | is_pull_request(){ 16 | if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then 17 | echo -e "\033[0;33mPull Request detected; not running $1!\033[0m" 18 | exit 0 19 | fi 20 | } 21 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | This is an open source project, and we appreciate your help! 4 | 5 | We use the GitHub issue tracker to discuss new features and non-trivial bugs. 6 | 7 | In addition to the issue tracker, [#journeys on 8 | Slack](https://dwopen.slack.com) is the best way to get into contact with the 9 | project's maintainers. 10 | 11 | To contribute code, documentation, or tests, please submit a pull request to 12 | the GitHub repository. Generally, we expect two maintainers to review your pull 13 | request before it is approved for merging. For more details, see the 14 | [MAINTAINERS](MAINTAINERS.md) page. 15 | -------------------------------------------------------------------------------- /config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | global: 3 | hosts: 4 | domain: 5 | externalIP: 6 | ingress: 7 | configureCertmanager: false 8 | tls: 9 | secretName: 10 | class: "" 11 | annotations: 12 | ingress.bluemix.net/client-max-body-size: size=0 13 | edition: ce 14 | 15 | gitlab: 16 | gitaly: 17 | persistence: 18 | enabled: false 19 | 20 | postgresql: 21 | persistence: 22 | enabled: false 23 | metrics: 24 | enabled: false 25 | 26 | minio: 27 | persistence: 28 | enabled: false 29 | 30 | redis: 31 | persistence: 32 | enabled: false 33 | 34 | certmanager: 35 | install: false 36 | 37 | nginx-ingress: 38 | enabled: false 39 | 40 | prometheus: 41 | install: false 42 | -------------------------------------------------------------------------------- /scripts/bx_auth.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # This script is intended to be run by Travis CI. If running elsewhere, invoke 4 | # it with: TRAVIS_PULL_REQUEST=false [path to script] 5 | # If no credentials are provided at runtime, bx will use the environment 6 | # variable BLUEMIX_API_KEY. If no API key is set, it will prompt for 7 | # credentials. 8 | 9 | # shellcheck disable=SC1090 10 | source "$(dirname "$0")"/../scripts/resources.sh 11 | 12 | BLUEMIX_ORG="Developer Advocacy" 13 | BLUEMIX_SPACE="dev" 14 | 15 | is_pull_request "$0" 16 | 17 | echo "Authenticating to Bluemix" 18 | bx login -a https://api.ng.bluemix.net 19 | 20 | echo "Targeting Bluemix org and space" 21 | bx target -o "$BLUEMIX_ORG" -s "$BLUEMIX_SPACE" 22 | 23 | echo "Initializing Bluemix Container Service" 24 | bx cs init 25 | -------------------------------------------------------------------------------- /kubernetes/local-volumes.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: PersistentVolume 4 | metadata: 5 | name: local-volume-1 6 | labels: 7 | type: local 8 | spec: 9 | capacity: 10 | storage: 10Gi 11 | accessModes: 12 | - ReadWriteOnce 13 | hostPath: 14 | path: /tmp/data/pv-1 15 | persistentVolumeReclaimPolicy: Recycle 16 | --- 17 | apiVersion: v1 18 | kind: PersistentVolume 19 | metadata: 20 | name: local-volume-2 21 | labels: 22 | type: local 23 | spec: 24 | capacity: 25 | storage: 10Gi 26 | accessModes: 27 | - ReadWriteOnce 28 | hostPath: 29 | path: /tmp/data/pv-2 30 | persistentVolumeReclaimPolicy: Recycle 31 | --- 32 | apiVersion: v1 33 | kind: PersistentVolume 34 | metadata: 35 | name: local-volume-3 36 | labels: 37 | type: local 38 | spec: 39 | capacity: 40 | storage: 10Gi 41 | accessModes: 42 | - ReadWriteOnce 43 | hostPath: 44 | path: /tmp/data/pv-3 45 | persistentVolumeReclaimPolicy: Recycle 46 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | language: python 3 | python: 2.7 4 | cache: pip 5 | 6 | notifications: 7 | webhooks: https://openwhisk.ng.bluemix.net/api/v1/namespaces/Developer%20Advocacy_Cloud%20Developer%20Advocacy/actions/travisreporting-olaph/processbuild 8 | slack: 9 | rooms: 10 | - "$SLACK_ROOM" 11 | on_pull_requests: false 12 | on_success: change 13 | 14 | services: 15 | - docker 16 | 17 | matrix: 18 | fast_finish: true 19 | 20 | before_install: 21 | - sudo apt-get install shellcheck 22 | - sudo pip install yamllint 23 | - git clone https://github.com/IBM/pattern-ci 24 | 25 | before_script: 26 | - "./pattern-ci/tests/shellcheck-lint.sh" 27 | - "./pattern-ci/tests/yaml-lint.sh" 28 | 29 | jobs: 30 | include: 31 | - script: ./tests/test-docker-compose.sh 32 | - install: ./pattern-ci/scripts/install-minikube.sh 33 | script: ./tests/test-minikube.sh 34 | - install: 35 | - ./pattern-ci/scripts/install-ibmcloud.sh 36 | - ./pattern-ci/scripts/bx-auth.sh 37 | script: ./tests/test-kubernetes.sh 38 | -------------------------------------------------------------------------------- /scripts/deploy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Create Gitlab" 4 | IP_ADDR=$(bx cs workers "$CLUSTER_NAME" | grep Ready | awk '{ print $2 }') 5 | if [[ -z "$IP_ADDR" ]]; then 6 | echo "$CLUSTER_NAME not created or workers not ready" 7 | exit 1 8 | fi 9 | 10 | echo -e "Configuring vars" 11 | if ! exp=$(bx cs cluster-config "$CLUSTER_NAME" | grep export); then 12 | echo "Cluster $CLUSTER_NAME not created or not ready." 13 | exit 1 14 | fi 15 | eval "$exp" 16 | 17 | echo -e "Deleting previous version of Gitlab if it exists" 18 | kubectl delete --ignore-not-found=true svc,pvc,deployment -l app=gitlab 19 | kubectl delete --ignore-not-found=true -f kubernetes/local-volumes.yaml 20 | 21 | echo -e "Creating pods" 22 | kubectl create -f kubernetes/local-volumes.yaml 23 | kubectl create -f kubernetes/postgres.yaml 24 | kubectl create -f kubernetes/redis.yaml 25 | kubectl create -f kubernetes/gitlab.yaml 26 | kubectl get svc gitlab 27 | 28 | echo "" && echo "View your Gitlab website at http://$IP_ADDR:30080" 29 | 30 | echo "Note: Your Gitlab may take up to 5 minutes to be fully functioning" 31 | -------------------------------------------------------------------------------- /scripts/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # This script is intended to be run by Travis CI. If running elsewhere, invoke 4 | # it with: TRAVIS_PULL_REQUEST=false [path to script] 5 | 6 | # shellcheck disable=SC1090 7 | source "$(dirname "$0")"/../scripts/resources.sh 8 | 9 | is_pull_request "$0" 10 | 11 | echo "Install Bluemix CLI" 12 | curl -L https://public.dhe.ibm.com/cloud/bluemix/cli/bluemix-cli/latest/IBM_Cloud_CLI_amd64.tar.gz > Bluemix_CLI.tar.gz 13 | tar -xvf Bluemix_CLI.tar.gz 14 | sudo ./Bluemix_CLI/install_bluemix_cli 15 | 16 | echo "Install kubectl" 17 | curl -LO https://storage.googleapis.com/kubernetes-release/release/"$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)"/bin/linux/amd64/kubectl 18 | chmod 0755 kubectl 19 | sudo mv kubectl /usr/local/bin 20 | 21 | echo "Configuring bx to disable version check" 22 | bx config --check-version=false 23 | echo "Checking bx version" 24 | bx --version 25 | echo "Install the Bluemix container-service plugin" 26 | bx plugin install container-service -r Bluemix 27 | 28 | if [[ -n "$DEBUG" ]]; then 29 | bx --version 30 | bx plugin list 31 | fi 32 | -------------------------------------------------------------------------------- /tests/test-minikube.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | 3 | # shellcheck disable=SC1090 4 | source "$(dirname "$0")"/../pattern-ci/scripts/resources.sh 5 | 6 | kubectl_deploy() { 7 | echo "Running scripts/quickstart.sh" 8 | "$(dirname "$0")"/../scripts/quickstart.sh 9 | 10 | echo "Waiting for pods to be running" 11 | i=0 12 | while [[ $(kubectl get pods | grep -c Running) -ne 3 ]]; do 13 | if [[ ! "$i" -lt 24 ]]; then 14 | echo "Timeout waiting on pods to be ready" 15 | kubectl get pods -a 16 | test_failed "$0" 17 | fi 18 | sleep 10 19 | echo "...$i * 10 seconds elapsed..." 20 | ((i++)) 21 | done 22 | echo "All pods are running" 23 | } 24 | 25 | verify_deploy(){ 26 | echo "Verifying deployment was successful" 27 | if ! sleep 1 && curl -sS "$(kubectl get svc gitlab | grep gitlab | awk '{ print $2 }')":30080; then 28 | test_failed "$0" 29 | fi 30 | } 31 | 32 | main(){ 33 | if ! kubectl_deploy; then 34 | test_failed "$0" 35 | elif ! verify_deploy; then 36 | test_failed "$0" 37 | else 38 | test_passed "$0" 39 | fi 40 | } 41 | 42 | main 43 | -------------------------------------------------------------------------------- /kubernetes/redis.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: redis 6 | labels: 7 | app: gitlab 8 | spec: 9 | ports: 10 | - port: 6379 11 | targetPort: 6379 12 | selector: 13 | app: gitlab 14 | tier: backend 15 | --- 16 | apiVersion: v1 17 | kind: PersistentVolumeClaim 18 | metadata: 19 | name: redis-claim 20 | labels: 21 | app: gitlab 22 | spec: 23 | accessModes: 24 | - ReadWriteOnce 25 | resources: 26 | requests: 27 | storage: 10Gi 28 | --- 29 | apiVersion: extensions/v1beta1 30 | kind: Deployment 31 | metadata: 32 | name: redis 33 | labels: 34 | app: gitlab 35 | spec: 36 | strategy: 37 | type: Recreate 38 | template: 39 | metadata: 40 | labels: 41 | app: gitlab 42 | tier: backend 43 | spec: 44 | containers: 45 | - image: redis:3.0.7-alpine 46 | name: redis 47 | ports: 48 | - containerPort: 6379 49 | name: redis 50 | volumeMounts: 51 | - name: redis 52 | mountPath: /data 53 | volumes: 54 | - name: redis 55 | persistentVolumeClaim: 56 | claimName: redis-claim 57 | -------------------------------------------------------------------------------- /.yamllint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | rules: 3 | braces: 4 | min-spaces-inside: 0 5 | max-spaces-inside: 0 6 | min-spaces-inside-empty: 0 7 | max-spaces-inside-empty: 0 8 | brackets: 9 | min-spaces-inside: 0 10 | max-spaces-inside: 0 11 | min-spaces-inside-empty: 0 12 | max-spaces-inside-empty: 0 13 | colons: 14 | max-spaces-before: 0 15 | max-spaces-after: 1 16 | commas: 17 | max-spaces-before: 0 18 | min-spaces-after: 1 19 | max-spaces-after: 1 20 | comments: 21 | require-starting-space: true 22 | min-spaces-from-content: 2 23 | comments-indentation: enable 24 | document-end: disable 25 | document-start: 26 | present: true 27 | empty-lines: 28 | max: 2 29 | max-start: 0 30 | max-end: 0 31 | hyphens: 32 | max-spaces-after: 1 33 | indentation: 34 | spaces: consistent 35 | indent-sequences: true 36 | check-multi-line-strings: false 37 | key-duplicates: enable 38 | line-length: 39 | max: 80 40 | allow-non-breakable-words: true 41 | allow-non-breakable-inline-mappings: true 42 | level: warning 43 | new-line-at-end-of-file: enable 44 | new-lines: 45 | type: unix 46 | trailing-spaces: enable 47 | truthy: enable 48 | -------------------------------------------------------------------------------- /config-persistent.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # note: this is using a forked repo of 3 | # the gitlab chart for minio security context 4 | # https://gitlab.com/AnthonyAmanse/gitlab 5 | global: 6 | hosts: 7 | domain: 8 | externalIP: 9 | ingress: 10 | configureCertmanager: false 11 | tls: 12 | secretName: 13 | class: "" 14 | annotations: 15 | ingress.bluemix.net/client-max-body-size: size=0 16 | edition: ce 17 | 18 | gitlab: 19 | gitaly: 20 | persistence: 21 | size: 20Gi 22 | storageClass: ibmc-file-gold 23 | securityContext: 24 | runAsUser: 0 25 | 26 | postgresql: 27 | persistence: 28 | size: 20Gi 29 | storageClass: ibmc-file-gold 30 | securityContext: 31 | runAsUser: 0 32 | metrics: 33 | enabled: false 34 | 35 | minio: 36 | persistence: 37 | size: 20Gi 38 | storageClass: ibmc-file-gold 39 | securityContext: 40 | runAsUser: 0 41 | 42 | redis: 43 | persistence: 44 | size: 20Gi 45 | storageClass: ibmc-file-gold 46 | securityContext: 47 | runAsUser: 0 48 | 49 | certmanager: 50 | install: false 51 | 52 | nginx-ingress: 53 | enabled: false 54 | 55 | prometheus: 56 | install: false 57 | -------------------------------------------------------------------------------- /docs/using-gitlab.md: -------------------------------------------------------------------------------- 1 | # Using gitlab 2 | 3 | ![Registration page](../images/register.png) 4 | 5 | 6 | After logging in as your newly-created user you can create a new project. 7 | 8 | ![Create project](../images/new_project.png) 9 | 10 | Once a project has been created you'll be asked to add an SSH key for your user. 11 | 12 | To verify that your key is working correctly run: 13 | 14 | ```bash 15 | ssh -T git@gitlab.example.com -p 30022 16 | ``` 17 | 18 | Which should result in: 19 | 20 | ```bash 21 | Welcome to GitLab, ! 22 | ``` 23 | 24 | > Note: Remember you need to have modified your hosts file to use the URL provided, otherwise you'll need to use the node's IP address as described [here](../README.md#2-retrieve-external-ip-and-port-for-gitLab). 25 | 26 | Now you can clone your project. 27 | ```bash 28 | git clone ssh://git@gitlab.example.com:30022// 29 | ``` 30 | 31 | Add a file and commit: 32 | ```bash 33 | echo "Gitlab project" > README.md 34 | git add README.md 35 | git commit -a -m "Initial commit" 36 | git push origin master 37 | ``` 38 | 39 | You can now see it in the Gitlab UI. 40 | 41 | ![Repo](../images/first_commit.png) 42 | 43 | If you want to use http URLs for cloning and pushing to a public repository on GitLab, that`s enabled as well. 44 | -------------------------------------------------------------------------------- /docs/ssh-port-ingress.md: -------------------------------------------------------------------------------- 1 | # Expose SSH Port with Ingress Controller in IKS 2 | 3 | 1. Edit configmap for ALB (Application Load Balancer) 4 | 5 | ``` 6 | $ kubectl edit configmap ibm-cloud-provider-ingress-cm -n kube-system 7 | ``` 8 | 9 | Add port `22` in the public ports: 10 | 11 | ``` 12 | ... 13 | data: 14 | public-ports: 80;443;22 15 | ... 16 | ``` 17 | 18 | 2. Edit Ingress of GitLab 19 | 20 | ``` 21 | $ kubectl edit ingress gitlab-unicorn 22 | ``` 23 | 24 | Add this in one of the annotations: 25 | 26 | ``` 27 | ... 28 | annotations: 29 | ingress.bluemix.net/tcp-ports: "serviceName=gitlab-gitlab-shell ingressPort=22" 30 | ... 31 | ``` 32 | 33 | 3. Verify 34 | 35 | First, verify if the ALB is exposing the `22` port. 36 | 37 | ``` 38 | $ kubectl get service -n kube-system 39 | 40 | NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE 41 | ... 42 | public-cr486e6497c6da4d5ca3b15edb99e216fe-alb1 LoadBalancer 172.21.130.120 169.XX.XX.XX 80:31256/TCP,443:32340/TCP,22:30917/TCP 47d 4d 43 | ``` 44 | 45 | Next, verify if you can ssh with the ingress subdomain _(Assuming you already have registered and added an SSH key in your GitLab deployment)_: 46 | > Use your own Ingress Subdomain `gitlab.` 47 | 48 | ``` 49 | $ ssh -T git@gitlab.anthony-dev.us-south.containers.appdomain.cloud 50 | 51 | Welcome to GitLab, @anthony! 52 | ``` -------------------------------------------------------------------------------- /kubernetes/postgres.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: postgresql 6 | labels: 7 | app: gitlab 8 | spec: 9 | ports: 10 | - port: 5432 11 | selector: 12 | app: gitlab 13 | tier: postgreSQL 14 | --- 15 | apiVersion: v1 16 | kind: PersistentVolumeClaim 17 | metadata: 18 | name: postgres-claim 19 | labels: 20 | app: gitlab 21 | spec: 22 | accessModes: 23 | - ReadWriteOnce 24 | resources: 25 | requests: 26 | storage: 10Gi 27 | --- 28 | apiVersion: extensions/v1beta1 29 | kind: Deployment 30 | metadata: 31 | name: postgresql 32 | labels: 33 | app: gitlab 34 | spec: 35 | strategy: 36 | type: Recreate 37 | template: 38 | metadata: 39 | labels: 40 | app: gitlab 41 | tier: postgreSQL 42 | spec: 43 | containers: 44 | - image: postgres:9.6.2-alpine 45 | name: postgresql 46 | env: 47 | - name: POSTGRES_USER 48 | value: gitlab 49 | - name: POSTGRES_DB 50 | value: gitlabhq_production 51 | - name: POSTGRES_PASSWORD 52 | value: gitlab 53 | ports: 54 | - containerPort: 5432 55 | name: postgresql 56 | volumeMounts: 57 | - name: postgresql 58 | mountPath: /var/lib/postgresql/data 59 | volumes: 60 | - name: postgresql 61 | persistentVolumeClaim: 62 | claimName: postgres-claim 63 | -------------------------------------------------------------------------------- /.bluemix/pipeline.yml: -------------------------------------------------------------------------------- 1 | --- 2 | stages: 3 | - name: BUILD 4 | inputs: 5 | - type: git 6 | branch: master 7 | service: ${SAMPLE_REPO} 8 | triggers: 9 | - type: commit 10 | jobs: 11 | - name: Build 12 | type: builder 13 | artifact_dir: '' 14 | build_type: shell 15 | script: |- 16 | #!/bin/bash 17 | bash -n *.sh 18 | - name: DEPLOY 19 | inputs: 20 | - type: job 21 | stage: BUILD 22 | job: Build 23 | dir_name: null 24 | triggers: 25 | - type: stage 26 | properties: 27 | - name: BLUEMIX_USER 28 | type: text 29 | value: ${BLUEMIX_USER} 30 | - name: BLUEMIX_PASSWORD 31 | type: secure 32 | value: ${BLUEMIX_PASSWORD} 33 | - name: BLUEMIX_ACCOUNT 34 | type: secure 35 | value: ${BLUEMIX_ACCOUNT} 36 | - name: CLUSTER_NAME 37 | type: text 38 | value: ${CLUSTER_NAME} 39 | - name: API_KEY 40 | type: secure 41 | value: ${API_KEY} 42 | jobs: 43 | - name: Deploy 44 | type: deployer 45 | target: 46 | region_id: ${PROD_REGION_ID} 47 | organization: ${PROD_ORG_NAME} 48 | space: ${PROD_SPACE_NAME} 49 | application: Pipeline 50 | script: | 51 | #!/bin/bash 52 | . ./scripts/install_bx.sh 53 | ./scripts/bx_login.sh 54 | ./scripts/deploy.sh 55 | hooks: 56 | - enabled: true 57 | label: null 58 | ssl_enabled: false 59 | url: https://devops-api-integration.stage1.ng.bluemix.net/v1/messaging/webhook/publish 60 | -------------------------------------------------------------------------------- /.bluemix/toolchain.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Deploy Kubernetes Gitlab sample to Bluemix" 3 | description: "Toolchain to deploy Kubernetes Gitlab sample to Bluemix" 4 | version: 0.1 5 | image: data:image/svg+xml;base64,$file(toolchain.svg,base64) 6 | icon: data:image/svg+xml;base64,$file(icon.svg,base64) 7 | required: 8 | - deploy 9 | - sample-repo 10 | 11 | # Github repos 12 | sample-repo: 13 | service_id: githubpublic 14 | parameters: 15 | repo_name: "{{name}}" 16 | repo_url: https://github.com/IBM/Kubernetes-container-service-GitLab-sample 17 | type: clone 18 | has_issues: false 19 | 20 | # Pipelines 21 | sample-build: 22 | service_id: pipeline 23 | parameters: 24 | name: "{{name}}" 25 | ui-pipeline: true 26 | configuration: 27 | content: $file(pipeline.yml) 28 | env: 29 | SAMPLE_REPO: "sample-repo" 30 | CF_APP_NAME: "{{deploy.parameters.prod-app-name}}" 31 | PROD_SPACE_NAME: "{{deploy.parameters.prod-space}}" 32 | PROD_ORG_NAME: "{{deploy.parameters.prod-organization}}" 33 | PROD_REGION_ID: "{{deploy.parameters.prod-region}}" 34 | BLUEMIX_USER: "{{deploy.parameters.bluemix-user}}" 35 | BLUEMIX_PASSWORD: "{{deploy.parameters.bluemix-password}}" 36 | API_KEY: "{{deploy.parameters.bluemix-api-key}}" 37 | BLUEMIX_ACCOUNT: "{{deploy.parameters.bluemix-cluster-account}}" 38 | CLUSTER_NAME: "{{deploy.parameters.bluemix-cluster-name}}" 39 | execute: true 40 | services: ["sample-repo"] 41 | hidden: [form, description] 42 | 43 | # Deployment 44 | deploy: 45 | schema: 46 | $ref: deploy.json 47 | service-category: pipeline 48 | parameters: 49 | prod-app-name: "{{sample-repo.parameters.repo_name}}" 50 | -------------------------------------------------------------------------------- /docs/deploy-with-ICP.md: -------------------------------------------------------------------------------- 1 | # Deploy with IBM Cloud Private 2 | 3 | Another option for getting a Kubernetes cluster up and running is to install 4 | IBM Cloud Private. 5 | 6 | Follow the directions at https://github.com/IBM/deploy-ibm-cloud-private to 7 | either install a local instance of IBM Cloud Private via Vagrant or a remote 8 | instance at Softlayer. These instructions assume the former. 9 | 10 | Log into the Vagrant VM 11 | 12 | ```bash 13 | $ vagrant ssh 14 | ``` 15 | 16 | Start helm and add the repository 17 | 18 | ```bash 19 | $ helm init 20 | $ helm repo add gitlab https://charts.gitlab.io 21 | ``` 22 | 23 | Install Gitlab 24 | 25 | ```bash 26 | $ helm install --name gitlab --set baseDomain=example.com,baseIP=1.1.1.1,gitlab=ce,legoEmail=fake@fake.com gitlab/gitlab-omnibus 27 | ``` 28 | 29 | This will deploy a gitlab installation that includes: 30 | 31 | A GitLab Omnibus Pod, including Mattermost, Container Registry, and Prometheus 32 | An auto-scaling GitLab Runner using the Kubernetes executor 33 | Redis 34 | PostgreSQL 35 | NGINX Ingress 36 | Persistent Volume Claims for Data, Registry, Postgres, and Redis 37 | 38 | To access the web UI, first navigate to the list of applications 39 | (nav menu -> workloads -> applications) and select the "default-http-backend" 40 | application that is under the nginx-ingress namespace by clicking on its name. 41 | Scroll down to the Expose Details section - listed under Endpoint is a link to 42 | "access 80" - click on it to interact with gitlab through its UI (once it has 43 | had a chance to spin up). 44 | 45 | # Clean up 46 | 47 | To uninstall the Gitlab Chart 48 | 49 | ```bash 50 | $ helm delete gitlab 51 | ``` 52 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | --- 2 | gitlab: 3 | image: 'gitlab/gitlab-ce:9.1.0-ce.0' 4 | restart: always 5 | hostname: 'gitlab.example.com' 6 | links: 7 | - postgresql:postgresql 8 | - redis:redis 9 | environment: 10 | GITLAB_OMNIBUS_CONFIG: | 11 | postgresql['enable'] = false 12 | gitlab_rails['db_username'] = "gitlab" 13 | gitlab_rails['db_password'] = "gitlab" 14 | gitlab_rails['db_host'] = "postgresql" 15 | gitlab_rails['db_port'] = "5432" 16 | gitlab_rails['db_database'] = "gitlabhq_production" 17 | gitlab_rails['db_adapter'] = 'postgresql' 18 | gitlab_rails['db_encoding'] = 'utf8' 19 | redis['enable'] = false 20 | gitlab_rails['redis_host'] = 'redis' 21 | gitlab_rails['redis_port'] = '6379' 22 | external_url 'http://gitlab.example.com:30080' 23 | gitlab_rails['gitlab_shell_ssh_port'] = 30022 24 | ports: 25 | # both ports must match the port from external_url above 26 | - "30080:30080" 27 | # the mapped port must match ssh_port specified above. 28 | - "30022:22" 29 | # the following are hints on what volumes to mount if you want to persist data 30 | # volumes: 31 | # - data/gitlab/config:/etc/gitlab:rw 32 | # - data/gitlab/logs:/var/log/gitlab:rw 33 | # - data/gitlab/data:/var/opt/gitlab:rw 34 | 35 | postgresql: 36 | restart: always 37 | image: postgres:9.6.2-alpine 38 | environment: 39 | - POSTGRES_USER=gitlab 40 | - POSTGRES_PASSWORD=gitlab 41 | - POSTGRES_DB=gitlabhq_production 42 | # the following are hints on what volumes to mount if you want to persist data 43 | # volumes: 44 | # - data/postgresql:/var/lib/postgresql:rw 45 | 46 | redis: 47 | restart: always 48 | image: redis:3.0.7-alpine 49 | -------------------------------------------------------------------------------- /tests/test-kubernetes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script is intended to be run by Travis CI. If running elsewhere, invoke 4 | # it with: TRAVIS_PULL_REQUEST=false [path to script] 5 | 6 | # shellcheck disable=SC1090 7 | source "$(dirname "$0")"/../pattern-ci/scripts/resources.sh 8 | 9 | kubeclt_clean() { 10 | echo "Cleaning cluster" 11 | kubectl delete pvc,deployment,service,replicaset -l app=gitlab 12 | sleep 30s 13 | kubectl delete pv local-volume-1 local-volume-2 local-volume-3 14 | } 15 | 16 | kubectl_config() { 17 | echo "Configuring kubectl" 18 | #shellcheck disable=SC2091 19 | $(bx cs cluster-config "$CLUSTER_NAME" | grep export) 20 | } 21 | 22 | 23 | kubectl_deploy() { 24 | kubeclt_clean 25 | 26 | echo "Running scripts/quickstart.sh" 27 | "$(dirname "$0")"/../scripts/quickstart.sh 28 | 29 | echo "Waiting for pods to be running" 30 | i=0 31 | while [[ $(kubectl get pods -l app=gitlab | grep -c Running) -ne 3 ]]; do 32 | if [[ ! "$i" -lt 24 ]]; then 33 | echo "Timeout waiting on pods to be ready" 34 | kubectl get pods -a 35 | test_failed "$0" 36 | fi 37 | sleep 10 38 | echo "...$i * 10 seconds elapsed..." 39 | ((i++)) 40 | done 41 | echo "All pods are running" 42 | 43 | echo "Waiting for service to be available" 44 | sleep 120 45 | } 46 | 47 | verify_deploy(){ 48 | echo "Verifying deployment was successful" 49 | IPS=$(bx cs workers "$CLUSTER_NAME" | awk '{ print $2 }' | grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}') 50 | for IP in $IPS; do 51 | if ! curl -sS "$IP":30080; then 52 | test_failed "$0" 53 | fi 54 | echo 55 | done 56 | } 57 | 58 | main(){ 59 | is_pull_request "$0" 60 | 61 | if ! kubectl_config; then 62 | echo "Config failed." 63 | test_failed "$0" 64 | elif ! kubectl_deploy; then 65 | echo "Deploy failed" 66 | test_failed "$0" 67 | elif ! verify_deploy; then 68 | test_failed "$0" 69 | else 70 | test_passed "$0" 71 | fi 72 | } 73 | 74 | main 75 | -------------------------------------------------------------------------------- /docs/deploy-with-docker.md: -------------------------------------------------------------------------------- 1 | # Deploy gitlab with docker 2 | 3 | ## 1. Install Docker CLI 4 | 5 | First, install [Docker](https://www.docker.com) by following the instructions [here](https://www.docker.com/community-edition#/download) for your preferred operating system. 6 | 7 | ## Single Container deployment via Docker 8 | 9 | ### Deploy 10 | 11 | The easiest, but least versatile way to deploy Gitlab CE is to launch it directly on your laptop which is already running Docker. By default gitlab includes postgres and redis in the container to make it easy to run as just a single container. 12 | 13 | ```bash 14 | $ sudo docker run --detach \ 15 | --hostname gitlab.example.com \ 16 | --publish 30080:80 --publish 30022:22 \ 17 | --name gitlab \ 18 | gitlab/gitlab-ce:9.1.0-ce.0 19 | 20 | ``` 21 | 22 | ### Use 23 | 24 | Once gitlab is started you will be able to access it via http://:30080. See [Using Gitlab](#using-gitlab) 25 | 26 | ### Teardown 27 | 28 | Once you're done you can stop your container, and then remove it: 29 | 30 | ```bash 31 | $ sudo docker stop gitlab 32 | $ sudo docker rm gitlab 33 | ``` 34 | 35 | ## Multiple Container deployment via Docker Compose 36 | 37 | It's easy to connect gitlab to external PostgreSQL and Redis services by making a few tweaks to the environment variables passed to the gitlab container. In the root of this repo is a [docker-compose.yml](../docker-compose.yml) file which will demonstrate a multiple container deployment that you can run locally or against a remote docker server. 38 | 39 | ### Deploy 40 | 41 | ```bash 42 | $ docker-compose up -d 43 | Starting kubernetescontainerservicegitlabsample_redis_1 44 | Starting kubernetescontainerservicegitlabsample_postgresql_1 45 | Recreating kubernetescontainerservicegitlabsample_gitlab_1 46 | ``` 47 | 48 | ### Use 49 | 50 | Once gitlab is started you will be able to access it via http://:30080. See [Using Gitlab](#using-gitlab) 51 | 52 | ### Teardown 53 | 54 | Once you're done you can stop your container, and then remove it: 55 | 56 | ```bash 57 | $ sudo docker-compose stop gitlab 58 | $ sudo docker-compose rm gitlab 59 | ``` 60 | -------------------------------------------------------------------------------- /docs/use-bluemix-container-registry.md: -------------------------------------------------------------------------------- 1 | # Build and push GitLab component images to the Bluemix Container Registry 2 | 3 | *If you want to use the images directly from the docker hub you can skip this step.* 4 | 5 | To ensure consistency you should always use tagged images from the docker registry. Taking this one step further you can push those images to your own namespace on the Bluemix Container Registry, or on [Docker Hub](https://docs.docker.com/datacenter/dtr/2.2/guides/user/manage-images/pull-and-push-images) 6 | 7 | Install Docker CLI using the instructions found [here](https://www.docker.com/community-edition#/download). 8 | 9 | Optionally, to use Bluemix Container Registry, install this plugin. 10 | 11 | ```bash 12 | bx plugin install container-registry -r bluemix 13 | ``` 14 | 15 | Once the plugin is installed you can log into the Bluemix Container Registry. 16 | 17 | ```bash 18 | bx cr login 19 | ``` 20 | 21 | If this is the first time using the Bluemix Container Registry you must set a namespace which identifies your private Bluemix images registry. It can be between 4 and 30 characters. 22 | 23 | ```bash 24 | bx cr namespace-add 25 | ``` 26 | 27 | Verify that it works. 28 | 29 | ```bash 30 | bx cr images 31 | ``` 32 | 33 | Fetch, tag, and push the GitLab container. 34 | 35 | ```bash 36 | $ docker pull gitlab/gitlab-ce:9.1.0-ce.0 37 | $ docker tag gitlab/gitlab-ce:9.1.0-ce.0 registry.ng.bluemix.net//gitlab-ce:9.1.0-ce.0 38 | $ docker push registry.ng.bluemix.net//gitlab-ce:9.1.0-ce.0 39 | ``` 40 | 41 | Fetch, tag, and push the PostgreSQL container. 42 | 43 | ```bash 44 | $ docker pull postgres:9.6.2-alpine 45 | $ docker tag postgres:9.6.2-alpine registry.ng.bluemix.net//postgres:9.6.2-alpine 46 | $ docker push registry.ng.bluemix.net//postgres:9.6.2-alpine 47 | ``` 48 | 49 | Fetch, tag, and push the Redis container. 50 | 51 | ```bash 52 | $ docker pull redis:3.0.7-alpine 53 | $ docker tag redis:3.0.7-alpine registry.ng.bluemix.net//redis:3.0.7-alpine 54 | $ docker push registry.ng.bluemix.net//redis:3.0.7-alpine 55 | ``` 56 | 57 | After you finish building and pushing the images in registry, please modify the container images in `kubernetes/*.yaml` to match the new locations. 58 | 59 | -------------------------------------------------------------------------------- /kubernetes/gitlab.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: gitlab 6 | labels: 7 | app: gitlab 8 | spec: 9 | ports: 10 | - name: gitlab-ui 11 | port: 80 12 | protocol: TCP 13 | targetPort: 30080 14 | nodePort: 30080 15 | - name: gitlab-ssh 16 | port: 22 17 | protocol: TCP 18 | targetPort: 22 19 | nodePort: 30022 20 | selector: 21 | app: gitlab 22 | tier: frontend 23 | type: NodePort 24 | --- 25 | apiVersion: v1 26 | kind: PersistentVolumeClaim 27 | metadata: 28 | name: gitlab-claim 29 | labels: 30 | app: gitlab 31 | spec: 32 | accessModes: 33 | - ReadWriteOnce 34 | resources: 35 | requests: 36 | storage: 10Gi 37 | --- 38 | apiVersion: extensions/v1beta1 39 | kind: Deployment 40 | metadata: 41 | name: gitlab 42 | labels: 43 | app: gitlab 44 | spec: 45 | strategy: 46 | type: Recreate 47 | template: 48 | metadata: 49 | labels: 50 | app: gitlab 51 | tier: frontend 52 | spec: 53 | containers: 54 | - image: gitlab/gitlab-ce:9.1.0-ce.0 55 | name: gitlab 56 | env: 57 | - name: GITLAB_OMNIBUS_CONFIG 58 | value: | 59 | postgresql['enable'] = false 60 | gitlab_rails['db_username'] = "gitlab" 61 | gitlab_rails['db_password'] = "gitlab" 62 | gitlab_rails['db_host'] = "postgresql" 63 | gitlab_rails['db_port'] = "5432" 64 | gitlab_rails['db_database'] = "gitlabhq_production" 65 | gitlab_rails['db_adapter'] = 'postgresql' 66 | gitlab_rails['db_encoding'] = 'utf8' 67 | redis['enable'] = false 68 | gitlab_rails['redis_host'] = 'redis' 69 | gitlab_rails['redis_port'] = '6379' 70 | gitlab_rails['gitlab_shell_ssh_port'] = 30022 71 | external_url 'http://gitlab.example.com:30080' 72 | ports: 73 | - containerPort: 30080 74 | name: gitlab 75 | volumeMounts: 76 | - name: gitlab 77 | mountPath: /var/opt/gitlab 78 | subPath: gitlab_data 79 | - name: gitlab 80 | mountPath: /etc/gitlab 81 | subPath: gitlab_configuration 82 | volumes: 83 | - name: gitlab 84 | persistentVolumeClaim: 85 | claimName: gitlab-claim 86 | -------------------------------------------------------------------------------- /.bluemix/icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 28 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /kubernetes/gitlab-postgres-svc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Service 4 | metadata: 5 | name: gitlab 6 | labels: 7 | app: gitlab 8 | spec: 9 | ports: 10 | - name: gitlab-ui 11 | port: 80 12 | protocol: TCP 13 | targetPort: 30080 14 | nodePort: 30080 15 | - name: gitlab-ssh 16 | port: 22 17 | protocol: TCP 18 | targetPort: 22 19 | nodePort: 30022 20 | selector: 21 | app: gitlab 22 | tier: frontend 23 | type: NodePort 24 | --- 25 | apiVersion: v1 26 | kind: PersistentVolumeClaim 27 | metadata: 28 | name: gitlab-claim 29 | labels: 30 | app: gitlab 31 | spec: 32 | accessModes: 33 | - ReadWriteOnce 34 | resources: 35 | requests: 36 | storage: 10Gi 37 | --- 38 | apiVersion: extensions/v1beta1 39 | kind: Deployment 40 | metadata: 41 | name: gitlab 42 | labels: 43 | app: gitlab 44 | spec: 45 | strategy: 46 | type: Recreate 47 | template: 48 | metadata: 49 | labels: 50 | app: gitlab 51 | tier: frontend 52 | spec: 53 | containers: 54 | - image: gitlab/gitlab-ce:9.1.0-ce.0 55 | name: gitlab 56 | env: 57 | - name: GITLAB_OMNIBUS_CONFIG 58 | value: | 59 | postgresql['enable'] = false 60 | gitlab_rails['db_username'] = "admin" 61 | # Update with password from Databases for PostgreSQL password 62 | gitlab_rails['db_password'] = "DATABASES_PG_PASSWORD" 63 | # Update with password from Databases for PostgreSQL host endpoint 64 | gitlab_rails['db_host'] = "DATABASES_PG_HOST" 65 | # Update with password from Databases for PostgreSQL service port 66 | gitlab_rails['db_port'] = "DATABASES_PG_PORT" 67 | gitlab_rails['db_database'] = "ibmclouddb" 68 | gitlab_rails['db_adapter'] = 'postgresql' 69 | gitlab_rails['db_encoding'] = 'utf8' 70 | redis['enable'] = false 71 | gitlab_rails['redis_host'] = 'redis' 72 | gitlab_rails['redis_port'] = '6379' 73 | gitlab_rails['gitlab_shell_ssh_port'] = 30022 74 | external_url 'http://gitlab.example.com:30080' 75 | ports: 76 | - containerPort: 30080 77 | name: gitlab 78 | volumeMounts: 79 | - name: gitlab 80 | mountPath: /var/opt/gitlab 81 | subPath: gitlab_data 82 | - name: gitlab 83 | mountPath: /etc/gitlab 84 | subPath: gitlab_configuration 85 | volumes: 86 | - name: gitlab 87 | persistentVolumeClaim: 88 | claimName: gitlab-claim 89 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Maintainers Guide 2 | 3 | This guide is intended for maintainers - anybody with commit access to one or 4 | more Code Pattern repositories. 5 | 6 | ## Methodology 7 | 8 | This repository does not have a traditional release management cycle, but 9 | should instead be maintained as a useful, working, and polished reference at 10 | all times. While all work can therefore be focused on the master branch, the 11 | quality of this branch should never be compromised. 12 | 13 | The remainder of this document details how to merge pull requests to the 14 | repositories. 15 | 16 | ## Merge approval 17 | 18 | The project maintainers use LGTM (Looks Good To Me) in comments on the pull 19 | request to indicate acceptance prior to merging. A change requires LGTMs from 20 | two project maintainers. If the code is written by a maintainer, the change 21 | only requires one additional LGTM. 22 | 23 | ## Reviewing Pull Requests 24 | 25 | We recommend reviewing pull requests directly within GitHub. This allows a 26 | public commentary on changes, providing transparency for all users. When 27 | providing feedback be civil, courteous, and kind. Disagreement is fine, so long 28 | as the discourse is carried out politely. If we see a record of uncivil or 29 | abusive comments, we will revoke your commit privileges and invite you to leave 30 | the project. 31 | 32 | During your review, consider the following points: 33 | 34 | ### Does the change have positive impact? 35 | 36 | Some proposed changes may not represent a positive impact to the project. Ask 37 | whether or not the change will make understanding the code easier, or if it 38 | could simply be a personal preference on the part of the author (see 39 | [bikeshedding](https://en.wiktionary.org/wiki/bikeshedding)). 40 | 41 | Pull requests that do not have a clear positive impact should be closed without 42 | merging. 43 | 44 | ### Do the changes make sense? 45 | 46 | If you do not understand what the changes are or what they accomplish, ask the 47 | author for clarification. Ask the author to add comments and/or clarify test 48 | case names to make the intentions clear. 49 | 50 | At times, such clarification will reveal that the author may not be using the 51 | code correctly, or is unaware of features that accommodate their needs. If you 52 | feel this is the case, work up a code sample that would address the pull 53 | request for them, and feel free to close the pull request once they confirm. 54 | 55 | ### Does the change introduce a new feature? 56 | 57 | For any given pull request, ask yourself "is this a new feature?" If so, does 58 | the pull request (or associated issue) contain narrative indicating the need 59 | for the feature? If not, ask them to provide that information. 60 | 61 | Are new unit tests in place that test all new behaviors introduced? If not, do 62 | not merge the feature until they are! Is documentation in place for the new 63 | feature? (See the documentation guidelines). If not do not merge the feature 64 | until it is! Is the feature necessary for general use cases? Try and keep the 65 | scope of any given component narrow. If a proposed feature does not fit that 66 | scope, recommend to the user that they maintain the feature on their own, and 67 | close the request. You may also recommend that they see if the feature gains 68 | traction among other users, and suggest they re-submit when they can show such 69 | support. 70 | -------------------------------------------------------------------------------- /.bluemix/deploy.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "title": "Sample Deploy Stage", 4 | "description": "sample toolchain", 5 | "longDescription": "The Delivery Pipeline automates continuous deployment.", 6 | "type": "object", 7 | "properties": { 8 | "prod-region": { 9 | "description": "The bluemix region", 10 | "type": "string" 11 | }, 12 | "prod-organization": { 13 | "description": "The bluemix org", 14 | "type": "string" 15 | }, 16 | "prod-space": { 17 | "description": "The bluemix space", 18 | "type": "string" 19 | }, 20 | "prod-app-name": { 21 | "description": "The name of your Gitlab app", 22 | "type": "string" 23 | }, 24 | "bluemix-user": { 25 | "description": "Your Bluemix user ID", 26 | "type": "string" 27 | }, 28 | "bluemix-password": { 29 | "description": "Your Bluemix Password", 30 | "type": "string" 31 | }, 32 | "bluemix-api-key": { 33 | "description": "Required for **Federated ID** since Federated ID can't login with Bluemix user and password via Bluemix CLI. You can obtain your API_KEY via https://console.ng.bluemix.net/iam/#/apikeys by clicking **Create API key** (Each API key only can be viewed once).", 34 | "type": "string" 35 | }, 36 | "bluemix-cluster-account": { 37 | "description": "The GUID of the Bluemix account where you created the cluster. Retrieve it with [bx iam accounts].", 38 | "type": "string" 39 | }, 40 | "bluemix-cluster-name": { 41 | "description": "Your cluster name. Retrieve it with [bx cs clusters].", 42 | "type": "string" 43 | } 44 | }, 45 | "required": ["prod-region", "prod-organization", "prod-space", "bluemix-cluster-name"], 46 | "anyOf": [ 47 | { 48 | "required": ["bluemix-user", "bluemix-password", "bluemix-cluster-account"] 49 | }, 50 | { 51 | "required": ["bluemix-api-key"] 52 | } 53 | ], 54 | "form": [ 55 | { 56 | "type": "validator", 57 | "url": "/devops/setup/bm-helper/helper.html" 58 | }, 59 | { 60 | "type": "text", 61 | "readonly": false, 62 | "title": "Bluemix User ID", 63 | "key": "bluemix-user" 64 | },{ 65 | "type": "password", 66 | "readonly": false, 67 | "title": "Bluemix Password", 68 | "key": "bluemix-password" 69 | },{ 70 | "type": "password", 71 | "readonly": false, 72 | "title": "Bluemix API Key (Optional)", 73 | "key": "bluemix-api-key" 74 | },{ 75 | "type": "password", 76 | "readonly": false, 77 | "title": "Bluemix Cluster Account ID", 78 | "key": "bluemix-cluster-account" 79 | },{ 80 | "type": "text", 81 | "readonly": false, 82 | "title": "Bluemix Cluster Name", 83 | "key": "bluemix-cluster-name" 84 | }, 85 | { 86 | "type": "table", 87 | "columnCount": 4, 88 | "widths": ["15%", "28%", "28%", "28%"], 89 | "items": [ 90 | { 91 | "type": "label", 92 | "title": "" 93 | }, 94 | { 95 | "type": "label", 96 | "title": "Region" 97 | }, 98 | { 99 | "type": "label", 100 | "title": "Organization" 101 | }, 102 | { 103 | "type": "label", 104 | "title": "Space" 105 | }, 106 | { 107 | "type": "label", 108 | "title": "Production stage" 109 | }, 110 | { 111 | "type": "select", 112 | "key": "prod-region" 113 | }, 114 | { 115 | "type": "select", 116 | "key": "prod-organization" 117 | }, 118 | { 119 | "type": "select", 120 | "key": "prod-space", 121 | "readonly": false 122 | } 123 | ] 124 | } 125 | ] 126 | } 127 | -------------------------------------------------------------------------------- /docs/deploy-with-docker-on-linuxone.md: -------------------------------------------------------------------------------- 1 | # Deploy with Docker on LinuxONE 2 | 3 | Open source software has expanded from a low-cost alternative to a platform for enterprise databases, clouds and next-generation apps. These workloads need higher levels of scalability, security and availability from the underlying hardware infrastructure. 4 | 5 | LinuxONE was built for open source so you can harness the agility of the open revolution on the industry’s most secure, scalable and high-performing Linux server. In this journey we will show how to run open source Cloud-Native workloads on LinuxONE 6 | 7 | It helps to start with a base OS image; in this case we will be 8 | using Ubuntu ([s390x/ubuntu](https://hub.docker.com/r/s390x/ubuntu/)). On top 9 | of which we will install GitLab. 10 | 11 | ## Included Components 12 | 13 | - [LinuxONE](https://www-03.ibm.com/systems/linuxone/open-source/index.html) 14 | - [Docker](https://www.docker.com) 15 | - [Docker Store](https://store.docker.com) 16 | 17 | ## Prerequisites 18 | 19 | Register at [LinuxONE Communinity Cloud](https://developer.ibm.com/linuxone/) for a trial account. 20 | We will be using a Red Hat base image for this journey, so be sure to chose the 21 | `Request your trial` button on the left side of this page. 22 | 23 | ## Steps 24 | 25 | ### 1. Setup 26 | 27 | First, let's create a directory for our scenario: 28 | 29 | ```text 30 | $ mkdir gitlabexercise 31 | $ cd gitlabexercise 32 | ``` 33 | 34 | You will also need a `requirements.txt` file in the directory with the contents: 35 | 36 | ```text 37 | gitlab 38 | postgres 39 | redis 40 | ``` 41 | 42 | ### 2. Create Dockerfiles 43 | 44 | Next we need to write a few Dockerfiles to build our Docker images. In the 45 | project directory, create the following three files with their respective 46 | content: 47 | 48 | Dockerfile-gitlab 49 | ```text 50 | FROM s390x/ubuntu 51 | 52 | # update & upgrade the ubuntu base image 53 | RUN apt-get update && apt-get upgrade -y 54 | 55 | # Install required packages 56 | RUN apt-get update -q \ 57 | && DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \ 58 | ca-certificates \ 59 | openssh-server \ 60 | wget \ 61 | apt-transport-https \ 62 | vim \ 63 | apt-utils \ 64 | curl \ 65 | postfix \ 66 | nano 67 | 68 | # Install the gitlab 69 | RUN apt-get install -y gitlab 70 | 71 | # Manage SSHD through runit 72 | RUN mkdir -p /opt/gitlab/sv/sshd/supervise \ 73 | && mkfifo /opt/gitlab/sv/sshd/supervise/ok \ 74 | && printf "#!/bin/sh\nexec 2>&1\numask 077\nexec /usr/sbin/sshd -D" > /opt/gitlab/sv/sshd/run \ 75 | && chmod a+x /opt/gitlab/sv/sshd/run \ 76 | && ln -s /opt/gitlab/sv/sshd /opt/gitlab/service \ 77 | && mkdir -p /var/run/sshd 78 | 79 | # Disabling use DNS in ssh since it tends to slow connecting 80 | RUN echo "UseDNS no" >> /etc/ssh/sshd_config 81 | 82 | # Prepare default configuration 83 | RUN ( \ 84 | echo "" && \ 85 | echo "# Docker options" && \ 86 | echo "# Prevent Postgres from trying to allocate 25% of total memory" && \ 87 | echo "postgresql['shared_buffers'] = '1MB'" ) >> /etc/gitlab/gitlab.rb && \ 88 | mkdir -p /assets/ && \ 89 | cp /etc/gitlab/gitlab.rb /assets/gitlab.rb 90 | 91 | # Expose web & ssh 92 | EXPOSE 443 80 22 93 | 94 | # Define data volumes 95 | VOLUME ["/etc/gitlab", "/var/opt/gitlab", "/var/log/gitlab"] 96 | 97 | # Copy assets 98 | COPY assets/wrapper /usr/local/bin/ 99 | 100 | # Wrapper to handle signal, trigger runit and reconfigure GitLab 101 | CMD ["/usr/local/bin/wrapper"] 102 | ``` 103 | 104 | Dockerfile-postgres 105 | 106 | ```text 107 | # 108 | # example Dockerfile for https://docs.docker.com/examples/postgresql_service/ 109 | # 110 | 111 | FROM s390x/ubuntu 112 | 113 | RUN apt-get update && apt-get upgrade -y 114 | 115 | # Add the PostgreSQL PGP key to verify their Debian packages. 116 | # It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc 117 | RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 118 | 119 | # Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 120 | # There are some warnings (in red) that show up during the build. You can hide 121 | # them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive 122 | RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql postgresql-client postgresql-contrib 123 | 124 | # Note: The official Debian and Ubuntu images automatically ``apt-get clean`` 125 | # after each ``apt-get`` 126 | 127 | # Run the rest of the commands as the ``postgres`` user created by the ``postgres`` package when it was ``apt-get installed`` 128 | USER postgres 129 | 130 | # Create a PostgreSQL role named ``docker`` with ``docker`` as the password and 131 | # then create a database `docker` owned by the ``docker`` role. 132 | # Note: here we use ``&&\`` to run commands one after the other - the ``\`` 133 | # allows the RUN command to span multiple lines. 134 | RUN /etc/init.d/postgresql start &&\ 135 | psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\ 136 | createdb -O docker docker 137 | 138 | # Adjust PostgreSQL configuration so that remote connections to the 139 | # database are possible. 140 | RUN echo "host all all 0.0.0.0/0 md5" >> /etc/postgresql/9.5/main/pg_hba.conf 141 | 142 | # And add ``listen_addresses`` to ``/etc/postgresql/9.5/main/postgresql.conf`` 143 | RUN echo "listen_addresses='*'" >> /etc/postgresql/9.5/main/postgresql.conf 144 | 145 | # Expose the PostgreSQL port 146 | EXPOSE 5432 147 | 148 | # Add VOLUMEs to allow backup of config, logs and databases 149 | VOLUME ["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"] 150 | 151 | # Set the default command to run when starting the container 152 | CMD ["/usr/lib/postgresql/9.5/bin/postgres", "-D", "/var/lib/postgresql/9.5/main", "-c", "config_file=/etc/postgresql/9.5/main/postgresql.conf"] 153 | ``` 154 | 155 | Dockerfile-redis 156 | 157 | ```text 158 | FROM s390x/ubuntu 159 | RUN apt-get update && apt-get upgrade -y && apt-get install -y redis-server 160 | EXPOSE 6379 161 | ENTRYPOINT ["/usr/bin/redis-server"] 162 | ``` 163 | 164 | ### 3. Define service in a Compose file 165 | 166 | Again, we are going to use docker-compose to manage our Docker images. In the 167 | project directory, create a `docker-compose.yml` file that contains: 168 | 169 | ### 4. Build and run 170 | 171 | ```text 172 | $ docker-compose up 173 | ``` 174 | -------------------------------------------------------------------------------- /docs/bluemix-postgres.md: -------------------------------------------------------------------------------- 1 | # Steps using Databases for PostgreSQL on IBM Cloud as the database 2 | 3 | Note: The Databases for PostgreSQL service on IBM Cloud is available through a pricing plan. Please see [Databases for PostgreSQL Catalog item](https://console.bluemix.net/catalog/services/databases-for-postgresql) for more details on pricing. 4 | 5 | # Prerequisites 6 | 7 | Create a Kubernetes cluster with [IBM Cloud Kubernetes Service](https://console.bluemix.net/docs/containers/cs_tutorials.html#cs_cluster_tutorial), folowing the steps to also configure the IBM Cloud CLI with the Kubernetes Service plug-in. 8 | 9 | # Steps 10 | 11 | 1. [Create Databases for PostgreSQL on IBM Cloud](#1-create-databases-for-postgresql-on-ibm-cloud) 12 | 2. [Create Services and Deployments](#2-create-services-and-deployments) 13 | 3. [Using Gitlab](#3-using-gitlab) 14 | 15 | # 1. Create Databases for PostgreSQL on IBM Cloud 16 | 17 | Use the IBM Cloud catalog or the `ibmcloud` command to create a service instance of `databases-for-postgresql-gl` and add a set of credentials. 18 | 19 | ```bash 20 | $ibmcloud resource service-instance-create databases-for-postgresql-gl databases-for-postgresql standard 21 | 22 | $ibmcloud resource service-key-create --instance-name databases-for-postgresql-gl Credentials-1 Administrator 23 | ``` 24 | For example, in `us-south`: 25 | ```$ ibmcloud resource service-instance-create databases-for-postgresql-gl databases-for-postgresql standard us-south``` 26 | 27 | Set the PostgreSQL database administrator password. 28 | 29 | ```bash 30 | $ ibmcloud cdb user-password databases-for-postgresql-gl admin 31 | ``` 32 | 33 | Get the name of the target cluster and bind the credentials of the service instance to your kubernetes cluster. 34 | 35 | ```bash 36 | $ ibmcloud cs clusters 37 | $ ibmcloud cs cluster-service-bind --cluster --namespace default --service databases-for-postgresql-gl 38 | ``` 39 | 40 | Verify that the credentials have been added. 41 | 42 | ```bash 43 | $ kubectl get secrets 44 | ``` 45 | 46 | # 2. Create Services and Deployments 47 | 48 | Run the following commands or run the quickstart script `bash scripts/quickstart-postgres-svc.sh` with your Kubernetes cluster. 49 | 50 | ```bash 51 | $ kubectl create -f kubernetes/local-volumes.yaml 52 | $ kubectl create -f kubernetes/redis.yaml 53 | $ kubectl create -f kubernetes/gitlab-postgres-svc.yaml 54 | ``` 55 | 56 | After you have created all the services and deployments, wait for 3 to 5 minutes. You can check the status of your deployment on the Kubernetes UI. Go to the cluster on the IBM Cloud and click on `Kubernetes Dashbaord` to check when the GitLab container becomes ready. 57 | 58 | ![Kubernetes Status Page](/images/kube_ui_gr.png) 59 | 60 | After few minutes run the following commands to get your public IP and NodePort number. 61 | 62 | ```bash 63 | $ kubectl get nodes 64 | NAME STATUS AGE 65 | 169.47.241.106 Ready 23h 66 | $ kubectl get svc gitlab 67 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 68 | gitlab 10.10.10.148 80:30080/TCP,22:30022/TCP 2s 69 | ``` 70 | 71 | > Note: The `30080` port is for gitlab UI and the `30022` port is for ssh. 72 | 73 | Congratulation. Now you can use the link **http://[IP]:30080** to access your gitlab site on browser. 74 | 75 | > Note: For the above example, the link would be http://169.47.241.106:30080 since its IP is `169.47.241.106` and the UI port number is `30080`. 76 | 77 | Depending on your cluster, the output might be as follows: 78 | 79 | ```bash 80 | $ kubectl get nodes -o wide 81 | NAME STATUS ROLES AGE VERSION EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME 82 | 10.176.239.136 Ready 2d v1.10.8+IKS 169.47.252.83 Ubuntu 16.04.5 LTS 4.4.0-137-generic docker://17.6.2 83 | 10.176.239.146 Ready 2d v1.10.8+IKS 169.47.252.51 Ubuntu 16.04.5 LTS 4.4.0-137-generic docker://17.6.2 84 | 10.176.239.161 Ready 2d v1.10.8+IKS 169.47.252.52 Ubuntu 16.04.5 LTS 4.4.0-137-generic docker://17.6.2 85 | $ kubectl get svc gitlab 86 | NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE 87 | gitlab NodePort 172.21.170.161 80:30080/TCP,22:30022/TCP 2d 88 | ``` 89 | 90 | > Note: In this situation, you can use the external IP from any of the nodes. For the above example, the link can be http://169.47.252.51:30080 since an external IP is `169.47.252.51` and the UI port number is `30080`. 91 | 92 | # 3. Using GitLab 93 | 94 | Now that Gitlab is running you can register as a new user and create a project. 95 | 96 | Firstly, you may need to create a password even before registering: 97 | 98 | ![Gitlab password page](/images/gitlab-passwd.png) 99 | 100 | Then you can register a user: 101 | 102 | ![Registration page](/images/register.png) 103 | 104 | After logging in as your newly-created user you can create a new project. 105 | 106 | ![Create project](/images/new_project.png) 107 | 108 | Once a project has been created you'll be asked to add an SSH key for your user. You will also be provided with information on setting up your git global configuration which you should set on your environment. 109 | 110 | To verify that your key is working correctly run: 111 | 112 | ```bash 113 | $ ssh -T git@ -p 30022 114 | ``` 115 | 116 | Which should result in: 117 | 118 | ```bash 119 | Welcome to GitLab, ! 120 | ``` 121 | Now you can clone your project. 122 | ```bash 123 | $ git clone ssh://git@:30022// 124 | ``` 125 | 126 | Add a file and commit: 127 | ```bash 128 | $ echo "Gitlab project" > README.md 129 | $ git add README.md 130 | $ git commit -a -m "Initial commit" 131 | $ git push origin master 132 | ``` 133 | 134 | You can now see it in the Gitlab UI. 135 | ![Repo](/images/first_commit.png) 136 | 137 | If you want to use http URLs for cloning and pushing to a public repository on GitLab, that`s enabled as well. 138 | 139 | # Troubleshooting 140 | 141 | If a pod doesn't start examine the logs. 142 | ```bash 143 | $ kubectl get pods 144 | $ kubectl logs 145 | ``` 146 | 147 | If you are getting the error `Permission denied (publickey).` when SSHing to GitLab and you have added the SSH key, then it might be related to a directory or file permission issue on the gitlab container. This can be due to an ownership problem of the `/var/opt/gitlab/` directory or the ` /var/opt/gitlab/.ssh/authorized_keys` file. Refer to the [stackoverflow question](https://stackoverflow.com/a/42474788) for more details. 148 | 149 | To delete all your kubernetes services, deployments, and persistent volume claim, run 150 | 151 | ```bash 152 | $ kubectl delete deployment,service,pvc -l app=gitlab 153 | ``` 154 | 155 | To delete your persistent volume, run 156 | 157 | ```bash 158 | $ kubectl delete pv local-volume-1 local-volume-2 local-volume-3 159 | ``` 160 | 161 | To delete your PostgreSQL secret in kubernetes and remove the service instance from IBM Cloud, run 162 | 163 | ```bash 164 | $ kubectl delete secret binding-databases-for-postgresql-gl 165 | $ ibmcloud service key-delete "Databases for PostgreSQL-GL" Credentials-1 166 | $ ibmcloud service delete "Databases for PostgreSQL-GL" 167 | ``` 168 | 169 | # License 170 | [Apache 2.0](LICENSE) 171 | -------------------------------------------------------------------------------- /README-cn.md: -------------------------------------------------------------------------------- 1 | [![构建状态](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample.svg?branch=master)](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample) 2 | 3 | # 将 GitLab 部署到 Kubernetes 集群上 4 | 5 | *阅读本文的其他语言版本:[English](README.md)。* 6 | 7 | 本项目展示,如何将一个常见的多组件工作负载(在本例中是 GitLab)部署到 Kubernetes 集群上。GitLab 因其基于 Git 的代码跟踪工具而流行。GitLab 代表着一种典型的多层应用程序,每个组件都拥有自己的容器。微服务容器将用于 Web 层,状态/作业数据库使用 Redis 和 PostgreSQL 作为数据库。 8 | 9 | 通过使用不同的 GitLab 组件(NGINX、Ruby on Rails、Redis、PostgreSQL 等),可以将它部署到 Kubernetes 上。也可以使用 Bluemix 中的 Compose for PostgreSQL 作为数据库来部署这个示例。 10 | 11 | ![流](images/gitlab_container_2.png) 12 | 13 | 1.用户通过 Web 接口或通过将代码推送到 GitHub 存储库来与 GitLab 交互。GitLab 容器运行 NGINX 和 gitlab-workhorse 背后的主要 Ruby on Rails 应用程序,gitlab-workhorse 是一个针对大型 HTTP 请求的逆向代理,比如文件下载和 Git 推送/拉取请求。在通过 HTTP/HTTPS 提供存储库时,GitLab 利用 GitLab API 来解决授权和访问,并提供 Git 对象。 14 | 15 | 2.经过身份验证和授权后,GitLab Rails 应用程序将传入的作业、作业信息和元数据放在 Redis 作业队列上,该作业队列充当着一个非持久数据库。 16 | 17 | 3.存储库创建于本地文件系统中。 18 | 19 | 4.用户创建用户、角色、合并请求、组等信息 - 所有这些信息然后存储在 PostgreSQL 中。 20 | 21 | 5.用户运行 Git shell 来访问存储库。 22 | 23 | ## 包含的组件 24 | - [GitLab](https://about.gitlab.com/) 25 | - [PostgreSQL](https://www.postgresql.org/) 26 | - [Redis](https://redis.io/) 27 | - [Kubernetes Clusters](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) 28 | - [IBM Cloud Container Service](https://console.ng.bluemix.net/catalog/?taxonomyNavigation=apps&category=containers) 29 | - [IBM Cloud Compose for PostgreSQL](https://console.ng.bluemix.net/catalog/services/compose-for-postgresql) 30 | 31 | ## 目标 32 | 这个场景提供以下任务的操作说明和经验: 33 | 34 | - 构建容器并将它们存储在容器注册表中 35 | - 使用 Kubernetes 创建本地持久卷来定义持久磁盘 36 | - 使用 Kubernetes pod 和服务部署容器 37 | - 在 Kubernetes 应用程序中使用 IBM Cloud 服务 38 | - 将一个分布式 GitLab 部署到 Kubernetes 上 39 | 40 | ## 部署场景 41 | 42 | ### 使用 Docker 部署 43 | 44 | 参阅[使用 Docker 部署 Gitlab](docs/deploy-with-docker.md) 45 | 46 | ### 部署到 Kubernetes 47 | 48 | 如果希望将此 Gitlab 安装在 IBM Cloud Private 上,使用 [Deploying Gitlab to IBM Cloud Private](docs/deploy-with-ICP.md) ,否则按照以下说明执行。 49 | 50 | 使用 [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube) 创建一个 Kubernetes 集群用于测试,或者使用 [IBM Cloud Container Service](https://github.com/IBM/container-journey-template#container-journey-template---creating-a-kubernetes-cluster) 创建一个 Kubernetes 集群以部署到云中。这里的代码会定期使用 Travis 针对[来自 IBM Cloud Container Service 的 Kubernetes 集群](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) 进行测试。 51 | 52 | 如果想使用 IBM Cloud Container Registry,首先需要[将映像上传](docs/use-bluemix-container-registry) 到 IBM Cloud Container Registry。 53 | 54 | ### 使用 DevOps Toolchain 从 IBM Cloud Container Service 部署到 Kubernetes 集群 55 | 如果想将 Gitlab 直接部署到 IBM Cloud,可单击下面的 Deploy to IBM Cloud 按钮,创建一个 [IBM Cloud DevOps 服务工具链和管道](https://console.ng.bluemix.net/docs/services/ContinuousDelivery/toolchains_about.html#toolchains_about) 来部署 Gitlab 示例,否则可跳到[步骤](#steps) 56 | 57 | [![创建工具链](https://github.com/IBM/container-journey-template/blob/master/images/button.png)](https://console.ng.bluemix.net/devops/setup/deploy/) 58 | 59 | 请按照[工具链操作说明](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new.md) 完成您的工具链和管道。 60 | 61 | #### 步骤 62 | 63 | 1.[使用 Kubernetes 创建服务和部署](#1-use-kubernetes-to-create-services-and-deployments-for-gitlab-redis-and-postgresql) 64 | 65 | - 1.1 [在容器中使用 PostgreSQL](#11-use-postgresql-in-container) 或 66 | 67 | - 1.2 [使用来自 IBM Cloud 的 PostgreSQL](#12-use-postgresql-from-bluemix) 68 | 69 | 2.[获取用于 GitLab 的外部 IP 和端口](#2-retrieve-external-ip-and-port-for-gitlab) 70 | 71 | 3.[GitLab 已准备就绪!使用 GitLab 托管您的存储库](#3-gitlab-is-ready-use-gitlab-to-host-your-repositories) 72 | 73 | 74 | #### 1.使用 Kubernetes 为 GitLab、Redis 和 PostgreSQL 创建服务并执行部署 75 | 76 | 运行 `kubectl` 命令确保您的 Kubernetes 集群可供访问。 77 | 78 | ```bash 79 | $ kubectl get nodes 80 | NAME STATUS AGE VERSION 81 | x.x.x.x Ready 17h v1.5.3-2+be7137fd3ad68f 82 | ``` 83 | 84 | > 备注:如果这一步失败,请参阅 [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube) 或 [IBM Cloud Container Service](https://console.ng.bluemix.net/docs/containers/cs_troubleshoot.html#cs_troubleshoot) 上的故障排除文档。 85 | 86 | ##### 1.1 在容器中使用 PostgreSQL 87 | 88 | 如果使用容器映像来运行 PostgreSQL,可对您的 Kubernetes 集群运行以下命令或运行快速入门脚本 `bash quickstart.sh`。 89 | 90 | ```bash 91 | $ kubectl create -f kubernetes/local-volumes.yaml 92 | $ kubectl create -f kubernetes/postgres.yaml 93 | $ kubectl create -f kubernetes/redis.yaml 94 | $ kubectl create -f kubernetes/gitlab.yaml 95 | ``` 96 | 97 | 创建所有这些服务和部署后,等待 3 到 5 分钟。可以在 Kubernetes UI 上检查部署状态。运行 kubectl proxy 并访问 URL 'http://127.0.0.1:8001/ui ',以检查 GitLab 容器何时准备就绪。 98 | 99 | ![Kubernetes 状态页面](images/kube_ui.png) 100 | 101 | 接下来[获取用于 GitLab 的外部 IP 和端口](#2-retrieve-external-ip-and-port-for-GitLab) 102 | 103 | ##### 1.2 使用来自 IBM Cloud 的 PostgreSQL 104 | 105 | 使用 IBM Cloud 目录或 bx 命令创建 Compose for PostgreSQL 的一个服务实例,并添加一组凭证。 106 | 107 | ```bash 108 | $ bx service create compose-for-postgresql Standard "Compose for PostgreSQL-GL" 109 | $ bx service key-create "Compose for PostgreSQL-GL" Credentials-1 110 | ``` 111 | 112 | 从 IBM Cloud 上的该服务的凭证对象获取连接字符串。 113 | 114 | ```bash 115 | $ bx service key-show "Compose for PostgreSQL-GL" "Credentials-1" | grep "postgres:" 116 | ``` 117 | 118 | ![Postgres 连接字符串示例](images/pg_credentials.png) 119 | 120 | 修改您的 ```kubernetes/gitlab-postgres-svc.yaml ``` 文件,将 COMPOSE_PG_PASSWORD 替换为密码,COMPOSE_PG_HOST 替换为主机名,COMPOSE_PG_PORT 替换为端口。 121 | 122 | 使用上面的示例后,```env:``` 节将类似于下面的清单。 123 | 124 | ```yaml 125 | env: 126 | - name: GITLAB_OMNIBUS_CONFIG 127 | value: | 128 | postgresql['enable'] = false 129 | gitlab_rails['db_username'] = "admin" 130 | gitlab_rails['db_password'] = "ETIDRKCGOEIGBMZA" 131 | gitlab_rails['db_host'] = "bluemix-sandbox-dal-9-portal.6.dblayer.com" 132 | gitlab_rails['db_port'] = "26576" 133 | gitlab_rails['db_database'] = "compose" 134 | gitlab_rails['db_adapter'] = 'postgresql' 135 | gitlab_rails['db_encoding'] = 'utf8' 136 | redis['enable'] = false 137 | gitlab_rails['redis_host'] = 'redis' 138 | gitlab_rails['redis_port'] = '6379' 139 | gitlab_rails['gitlab_shell_ssh_port'] = 30022 140 | external_url 'http://gitlab.example.com:30080' 141 | 142 | ``` 143 | 144 | 145 | 对您的 Kubernetes 集群运行以下命令或运行快速入门脚本 `bash quickstart-postgres-svc.sh`。 146 | 147 | ```bash 148 | $ kubectl create -f kubernetes/local-volumes.yaml 149 | $ kubectl create -f kubernetes/redis.yaml 150 | $ kubectl create -f kubernetes/gitlab-postgres-svc.yaml 151 | ``` 152 | 153 | 创建所有这些服务和部署后,等待 3 到 5 分钟。可以在 Kubernetes UI 上检查部署状态。运行 kubectl proxy 并访问 URL 'http://127.0.0.1:8001/ui ',以检查 GitLab 容器何时准备就绪。 154 | 155 | ![Kubernetes 状态页面](images/kube_ui_gr.png) 156 | 157 | ### 2.获取用于 GitLab 的外部 IP 和端口 158 | 159 | 几分钟后,运行以下命令来获取您的公共 IP 和 NodePort 编号。 160 | 161 | ```bash 162 | $ $ bx cs workers 163 | OK 164 | ID Public IP Private IP Machine Type State Status 165 | kube-hou02-pa817264f1244245d38c4de72fffd527ca-w1 169.47.241.22 10.10.10.148 free normal Ready 166 | $ kubectl get svc gitlab 167 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 168 | gitlab 10.10.10.148 80:30080/TCP,22:30022/TCP 2s 169 | ``` 170 | 171 | > 备注:30080 端口用于 gitlab UI,30022 端口用于 ssh。 172 | 173 | > 备注:gitlab 外部 URL 设置为 `gitlab.example.com`,将此 URL 添加到指向上面的 IP 地址的 hosts 文件中,以便使用 gitlab 期望的 URL。如果不能这么做,使用该 IP(在本例中为 169.47.241.22)应该没问题。 174 | 175 | > 备注:如果使用 Minikube 执行本地 Kubernetes 部署,可以使用 `minikube service list` 命令访问服务 IP 列表。 176 | 177 | 恭喜您。现在可以从 Web 浏览器使用链接 [http://gitlab.example.com:30080](http://gitlab.example.com:30080) 或 http://:30080 访问您的 gitlab 服务了。 178 | 179 | ### 3.GitLab 已准备就绪!使用 GitLab 托管您的存储库 180 | 181 | Gitlab 运行后,您可以[注册为新用户并创建一个项目](docs/using-gitlab.md)。 182 | 183 | ### 故障排除 184 | 185 | 如果一个 pod 未启动,请检查日志。 186 | ```bash 187 | kubectl get pods 188 | kubectl logs 189 | ``` 190 | 191 | ### 清理 192 | 193 | 要删除所有服务、部署和持久卷声明,可运行 194 | 195 | ```bash 196 | kubectl delete deployment,service,pvc -l app=gitlab 197 | ``` 198 | 199 | 要删除持久卷,可运行 200 | 201 | ```bash 202 | kubectl delete pv local-volume-1 local-volume-2 local-volume-3 203 | ``` 204 | 205 | 要删除您的 PostgreSQL 凭证并从 IBM Cloud 删除服务实例,可运行 206 | 207 | ```bash 208 | bx service key-delete "Compose for PostgreSQL-GL" Credentials-1 209 | bx service delete "Compose for PostgreSQL-GL" 210 | ``` 211 | 212 | # 许可证 213 | [Apache 2.0](LICENSE) 214 | -------------------------------------------------------------------------------- /README.ko.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample.svg?branch=master)](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample) 2 | 3 | # 쿠버네티스 클러스터에 GitLab 구축하기 4 | 5 | 본 프로젝트는 일반적인 멀티 컴포넌트 워크로드(여기에서는 GitLab)를 쿠버네티스 클러스터에 구축하는 방법을 소개합니다. Git 기반의 코드 트래킹 툴로 잘 알려져 있는 GitLab은 전형적인 멀티-티어 앱으로, 각 구성요소마다 각각의 컨터이너 기반으로 실행됩니다. 마이크로서비스 컨테이너들이 웹 티어와 상태/작업 내용 캐싱을 위한 Redis, 그리고 데이터베이스용으로 PostgreSQL에 이용됩니다. 6 | 7 | 다양한 GitLab 구성요소(NGINX, Ruby on Rails, Redis, PostgreSQL 등)들이 쿠버네티스 환경에 구성될 것입니다. 이 예제는 Bluemix의 Compose for PostgreSQL라는 관리형 데이터베이스로도 구성이 가능합니다. 8 | 9 | ![흐름도](images/gitlab_container_2.png) 10 | 11 | 1. 사용자가 웹 인터페이스를 통해, 또는 GitHub 저장소에 코드를 푸시하여 GitLab을 사용합니다. GitLab 컨테이너는 NGINX와 gitlab-workhorse(파일 다운로드 또는 Git 푸시/풀과 같은 대량의 HTTP 요청을 위한 리버시 프록시 역할을 하는) 뒤에서 메인 Ruby on Rails 애플리케이션을 실행합니다. GitLab은 HTTP/HTTPS를 통해 저장소를 제공함과 동시에, GitLab API를 활용하여 권한부여 및 접근권한을 함으로써 Git 오브젝트를 제공합니다. 12 | 13 | 2. 인증 및 권한부여 확인 후에, GitLab Rails 애플리케이션이 새로이 요청되는 작업, 작업 정보, 메타데이터 등을 비영구적 데이터베이스의 역할을 하는 Redis 작업 대기열로 전송합니다. 14 | 15 | 3. Git 저장소가 로컬 파일 시스템에 생성됩니다. 16 | 17 | 4. 사용자가 사용자, 역할, 병합 요청, 그룹 등을 생성하면, PostgreSQL에 모두 저장됩니다. 18 | 19 | 5. 사용자가 Git 쉘을 통하여 Git 저장소에 접근합니다. 20 | 21 | ## 포함된 구성요소 22 | - [GitLab](https://about.gitlab.com/) 23 | - [PostgreSQL](https://www.postgresql.org/) 24 | - [Redis](https://redis.io/) 25 | - [쿠버네티스 클러스터(Kubernetes Clusters)](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) 26 | - [Bluemix 컨테이너 서비스(Bluemix container service)](https://console.ng.bluemix.net/catalog/?taxonomyNavigation=apps&category=containers) 27 | - [Bluemix Compose for PostgreSQL](https://console.ng.bluemix.net/catalog/services/compose-for-postgresql) 28 | 29 | ## 목표 30 | 이 시나리오는 하기 작업들에 대한 가이드를 제공합니다. 31 | 32 | - 컨테이너 빌드 및 컨테이너 레지스트리에 빌드된 컨테이너 저장하기 33 | - 쿠버네티스 상에서 영구적 디스크를 정의하기 위해 로컬 PersistentVolume (PV) 생성하기 34 | - 쿠버네티스 pods 및 서비스를 사용해 컨테이너 구성하기 35 | - 쿠버네티스 애플리케이션 상에서 Bluemix 서비스 이용하기 36 | - 쿠버네티스에 분산형 GitLab 구성하기 37 | 38 | ## 구성 시나리오 39 | 40 | ### 도커(Docker)를 활용한 구성 41 | 42 | [도커를 활용한 Gitlab 구성(Deploy GitLab with Docker)](docs/deploy-with-docker.md)을 참고하십시오. 43 | 44 | ### 쿠버네티스 환경에 구성하기 45 | 46 | 로컬 환경에서 테스트를 위해서는 [미니큐브(Minikube)](https://kubernetes.io/docs/getting-started-guides/minikube)로, 클라우드 상에서는 [IBM Bluemix 컨테이너 서비스(IBM Bluemix Container Service](https://github.com/IBM/container-journey-template#container-journey-template---creating-a-kubernetes-cluster) 를 활용하여 쿠버네티스 클러스터를 생성하십시오. 본 예제의 코드는 Travis를 사용하여 [Bluemix 컨테이너 서비스의 쿠버네티스 클러스터(Kubernetes Cluster from Bluemix Container Service)](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) 상에서 정기적으로 테스트 됩니다. 47 | 48 | Bluemix 컨테이너 레지스트리(Bluemix Container Registry)를 이용하고자 하는 경우, Bluemix 컨테이너 레지스트리에 [이미지 업로드(Uploading the images)](docs/use-bluemix-container-registry)하여 시작할 수 있습니다. 49 | 50 | ### Bluemix 컨테이너 서비스의 쿠버네티스 클러스터 환경에 DevOps 툴체인 이용하여 구성하기 51 | Gitlab을 Bluemix 환경에 직접 구성하고자 한다면, 아래의 ‘Deploy to Bluemix’ 버튼을 클릭하여 Gitlab 예제 구성을 위한  [Bluemix DevOps s서비스 툴체인과 파이프라인](https://console.ng.bluemix.net/docs/services/ContinuousDelivery/toolchains_about.html#toolchains_about)을 생성하십시오. 그렇지 않은 경우 [단계](#단계)로 이동하십시오. 52 | 53 | [![Create Toolchain](https://github.com/IBM/container-journey-template/blob/master/images/button.png)](https://console.ng.bluemix.net/devops/setup/deploy/) 54 | 55 | [툴체인 가이드](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new.md)를 참고하여 툴체인과 파이프라인을 완성하십시오. 56 | 57 | #### 단계 58 | 59 | 1. [쿠버네티스를 사용하여 서비스 및 Deployment 생성](#1-use-kubernetes-to-create-services-and-deployments-for-gitlab-redis-and-postgresql) 하기 60 | - 1.1 [별도 PostgreSQL 컨테이너 구성하여 사용하기](#11-use-postgresql-in-container) 또는 61 | - 1.2 [Bluemix의 PostgreSQL 사용하기 (Bluemix Compose for PostgreSQL)](#12-use-postgresql-from-bluemix) 62 | 2. [GitLab접근을 위한 외부 ip 및 포트 확인하기](#2-retrieve-external-ip-and-port-for-gitlab) 63 | 3. [GitLab이 준비되었습니다! GitLab을 사용하여 저장소를 관리하십시오](#3-gitlab-is-ready-use-gitlab-to-host-your-repositories) 64 | 65 | #### 1. 쿠버네티스를 사용하여 GitLab, Redis, PostgreSQL용 서비스 및 Deployment생성 하기 66 | 67 | 쿠버네티스 클러스터가 `kubectl` 명령 실행을 통해 연결 가능한지 확인하십시오. 68 | 69 | ```bash 70 | $ kubectl get nodes 71 | NAME STATUS AGE VERSION 72 | x.x.x.x Ready 17h v1.5.3-2+be7137fd3ad68f 73 | ``` 74 | 75 | > 참고:이 단계에서 실패하는 경우, [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube) 또는 [IBM Bluemix Container Service](https://console.ng.bluemix.net/docs/containers/cs_troubleshoot.html#cs_troubleshoot)의 문제해결 문서를 참고하십시오. 76 | 77 | ##### 1.1 별도의 PostgreSQL 컨테이너 사용하기 78 | 79 | PostgreSQL를 위한 별도 컨테이너 이미지를 사용하고 있다면, 다음 명령들을 실행하거나 퀵스타트 스크립트 `bash quickstart.sh` 를 통해 쿠버네티스 클러스터 상에서 실행시킵니다. 80 | 81 | ```bash 82 | $ kubectl create -f kubernetes/local-volumes.yaml 83 | $ kubectl create -f kubernetes/postgres.yaml 84 | $ kubectl create -f kubernetes/redis.yaml 85 | $ kubectl create -f kubernetes/gitlab.yaml 86 | ``` 87 | 88 | 서비스와 deployment가 모두 생성한 후에는 3-5분 간 대기해야 합니다. 쿠버네티스 UI에서 배치 현황을 확인할 수 있습니다. 'kubectl proxy' 명령어를 실행 후, 브라우저 상에서 'http://127.0.0.1:8001/ui' 로 이동하면 GitLab 컨테이너가 언제 준비되는지 확인 가능합니다. 89 | 90 | ![Kubernetes Status Page](images/kube_ui.png) 91 | 92 | 그 다음 [GitLab용 외부 ip 및 포트를 확인하십시오.(2-retrieve-external-ip-and-port-for-GitLab) 93 | 94 | ##### 1.2 Bluemix의 PostgreSQL 사용하기 (Bluemix Compose for PostgreSQL) 95 | 96 | Bluemix 카탈로그나 bx 명령을 사용하여 Compose for PostgreSQL 의 서비스 인스턴스를 생성하고, 신임정보를 추가할 수 있습니다. 97 | 98 | ```bash 99 | $ bx service create compose-for-postgresql Standard "Compose for PostgreSQL-GL" 100 | $ bx service key-create "Compose for PostgreSQL-GL" Credentials-1 101 | ``` 102 | 103 | Bluemix에 위치한 서비스의 신임정보 오브젝트에서 연결되는 문자열을 검색하십시오. 104 | 105 | ```bash 106 | $ bx service key-show "Compose for PostgreSQL-GL" "Credentials-1" | grep "postgres:" 107 | ``` 108 | 109 | ![Postgres Connection String example](images/pg_credentials.png) 110 | 111 | ```kubernetes/gitlab-postgres-svc.yaml```파일을 수정하고, COMPOSE_PG_PASSWORD는 암호로, COMPOSE_PG_HOST는 호스트네임으로, COMPOSE_PG_PORT는 포트로 바꾸십시오 112 | 113 | 위 예의 사용 후, ```env:``` 섹션은 아래와 같이 보입니다. 114 | 115 | ```yaml 116 | env: 117 | - name: GITLAB_OMNIBUS_CONFIG 118 | value: | 119 | postgresql['enable'] = false 120 | gitlab_rails['db_username'] = "admin" 121 | gitlab_rails['db_password'] = "ETIDRKCGOEIGBMZA" 122 | gitlab_rails['db_host'] = "bluemix-sandbox-dal-9-portal.6.dblayer.com" 123 | gitlab_rails['db_port'] = "26576" 124 | gitlab_rails['db_database'] = "compose" 125 | gitlab_rails['db_adapter'] = 'postgresql' 126 | gitlab_rails['db_encoding'] = 'utf8' 127 | redis['enable'] = false 128 | gitlab_rails['redis_host'] = 'redis' 129 | gitlab_rails['redis_port'] = '6379' 130 | gitlab_rails['gitlab_shell_ssh_port'] = 30022 131 | external_url 'http://gitlab.example.com:30080' 132 | 133 | ``` 134 | 135 | 136 | 다음 명령들을 실행하거나 쿠버네티스 클러스터로 퀵스타트 스크립트 `bash quickstart-postgres-svc.sh`를 실행하십시오. 137 | 138 | ```bash 139 | $ kubectl create -f kubernetes/local-volumes.yaml 140 | $ kubectl create -f kubernetes/redis.yaml 141 | $ kubectl create -f kubernetes/gitlab-postgres-svc.yaml 142 | ``` 143 | 144 | 서비스와 배치를 모두 생성한 후에는 3-5분 간 대기해야 합니다. 쿠버네티스 UI에서 배치 현황을 확인할 수 있습니다. 'kubectl proxy'를 실행하여 URL 'http://127.0.0.1:8001/ui' 로 이동하면 GitLab 컨테이너가 언제 준비되는지 확인 가능합니다. 145 | 146 | ![Kubernetes Status Page](images/kube_ui_gr.png) 147 | 148 | ### 2. GitLab외부 접속 ip 및 포트 확인하기 149 | 150 | 몇 분 후에 다음 명령을 실행하여 외부 IP와 NodePort 번호를 확인하십시오. 151 | 152 | ```bash 153 | $ kubectl get nodes 154 | NAME STATUS AGE 155 | 169.47.241.22 Ready 23h 156 | $ kubectl get svc gitlab 157 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 158 | gitlab 10.10.10.148 80:30080/TCP,22:30022/TCP 2s 159 | ``` 160 | 161 | > 참고: 30080 포트는 gitlab UI에 사용되고, 30022 포트는 ssh에 사용됩니다. 162 | 163 | > 참고: gitlab 외부 url은 `gitlab.example.com` 으로 설정됩니다. 이 url이 상기 IP 주소를 가리키도록 호스트 파일에 추가하면 gitlab이 예상하는 url을 통해 사용할 수 있습니다. 이것이 불가능할 경우, IP 주소(이 예에서는 169.47.241.22)를 사용하면 됩니다. 164 | 165 | > 참고: 만약 Minikube를 이용하여 로컬환경에서 쿠버네티스를 구성하는 경우, `minikube service list` 명령을 통해 서비스들에 대한 IP 주소를 확인할 수 있습니다. 166 | 167 | 축하합니다. 이제, 링크 [http://gitlab.example.com:30080](http://gitlab.example.com:30080) 또는 http://:30080 을 이용하여 웹 브라우저에서 gitlab 서비스에 액세스할 수 있습니다. 168 | ### 3. GitLab이 준비되었습니다! GitLab을 사용하여 저장소를 관리하십시오 169 | 170 | Gitlab이 실행되고 있으므로, [신규 사용자로 등록하고 프로젝트를 생성할 수 있습니다.](docs/using-gitlab.md). 171 | 172 | ### 문제 해결 173 | 174 | pods가 시작되지 않는다면, 로그를 확인해보십시오. 175 | ```bash 176 | kubectl get pods 177 | kubectl logs 178 | ``` 179 | 180 | ### 정리 181 | 182 | 서비스, deployment, 생성된 볼륨 등을 모두 삭제하고자 하는 경우, 다음 명령을 실행하십시오. 183 | 184 | ```bash 185 | kubectl delete deployment,service,pvc -l app=gitlab 186 | ``` 187 | 188 | PersistentVolume(PV)을 삭제하는 명령: 189 | 190 | ```bash 191 | kubectl delete pv local-volume-1 local-volume-2 local-volume-3 192 | ``` 193 | 194 | PostgreSQL 신임정보를 삭제하는 명령 및 Bluemix에서 서비스 인스턴스를 제거하는 명령: 195 | 196 | ```bash 197 | bx service key-delete "Compose for PostgreSQL-GL" Credentials-1 198 | bx service delete "Compose for PostgreSQL-GL" 199 | ``` 200 | 201 | # 라이센스 202 | [Apache 2.0](LICENSE) 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample.svg?branch=master)](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample) 2 | 3 | # GitLab deployment on Kubernetes Cluster 4 | 5 | *Read this in other languages: [한국어](README.ko.md)、[中国](README-cn.md) .* 6 | 7 | This project shows how a common multi-component workload, in this case GitLab, can be deployed on Kubernetes Cluster. GitLab is famous for its Git-based and code-tracking tool. GitLab represents a typical multi-tier app and each component will have their own container(s). The microservice containers will be for the web tier, the state/job database with Redis and PostgreSQL as the database. 8 | 9 | By using different GitLab components (NGINX, Ruby on Rails, Redis, PostgreSQL, and more), you can deploy it to Kubernetes. This example is also deployable using [Databases for PostgreSQL in IBM Cloud as the database](docs/bluemix-postgres.md). 10 | 11 | ![Flow](images/gitlab_container_2.png) 12 | 13 | 1. The user interacts with GitLab via the web interface or by pushing code to a GitHub repository. The GitLab container runs the main Ruby on Rails application behind NGINX and gitlab-workhorse, which is a reverse proxy for large HTTP requests like file downloads and Git push/pull. While serving repositories over HTTP/HTTPS, GitLab utilizes the GitLab API to resolve authorization and access and serves Git objects. 14 | 15 | 2. After authentication and authorization, the GitLab Rails application puts the incoming jobs, job information, and metadata on the Redis job queue that acts as a non-persistent database. 16 | 17 | 3. Repositories are created in a local file system. 18 | 19 | 4. The user creates users, roles, merge requests, groups, and more—all are then stored in PostgreSQL. 20 | 21 | 5. The user accesses the repository by going through the Git shell. 22 | 23 | ## Included Components 24 | - [GitLab](https://about.gitlab.com/) 25 | - [PostgreSQL](https://www.postgresql.org/) 26 | - [Redis](https://redis.io/) 27 | - [Minio](https://github.com/minio/minio) 28 | - [Kubernetes Clusters](https://cloud.ibm.com/docs/containers/cs_ov.html#cs_ov) 29 | - [IBM Cloud Kubernetes Service](https://cloud.ibm.com/catalog?taxonomyNavigation=apps&category=containers) 30 | 31 | # Prerequisites 32 | 33 | 34 | 35 | Create a Kubernetes cluster with either [Minikube](https://kubernetes.io/docs/setup/minikube/) for local testing, or with [IBM Cloud Kubernetes Service](https://cloud.ibm.com/docs/containers/cs_tutorials.html#cs_cluster_tutorial) to deploy in cloud. The code here is regularly tested against [Kubernetes Cluster from IBM Cloud Kubernetes Service](https://cloud.ibm.com/docs/containers/cs_ov.html#cs_ov) using Travis. 36 | 37 | [Helm](https://helm.sh/) to install GitLab's Cloud Native charts. 38 | 39 | # Steps 40 | 41 | 1. [Clone the repo](#1-clone-the-repo) 42 | 2. [Create IBM Cloud Kubernetes Service](#2-create-ibm-cloud-kubernetes-service) 43 | 3. [Install Helm](#3-install-helm) 44 | 4. [Configure GitLab and Install](#4-configure-gitlab-and-install) 45 | 5. [Launch GitLab](#5-launch-gitlab) 46 | 47 | ### 1. Clone the repo 48 | 49 | Clone the repo and go in the cloned directory 50 | ``` 51 | $ git clone https://github.com/IBM/Kubernetes-container-service-GitLab-sample/ 52 | ``` 53 | 54 | ### 2. Create IBM Cloud Kubernetes Service 55 | 56 | Create an IBM Cloud Kubernetes Service if you don't already have one: 57 | 58 | * [IBM Cloud Kubernetes Service](https://cloud.ibm.com/containers-kubernetes/catalog/cluster) 59 | 60 | ### 3. Install Helm 61 | 62 | If you don't have the Helm client in your machine, you can find one in the [official releases page](https://github.com/helm/helm/releases). 63 | 64 | To install Helm in your Kubernetes Cluster, do: 65 | 66 | ``` 67 | $ helm init 68 | ``` 69 | 70 | Add the official gitlab repo: 71 | 72 | ``` 73 | $ helm repo add gitlab https://charts.gitlab.io/ 74 | $ helm repo update 75 | ``` 76 | 77 | To verify installation of Helm in your cluster: 78 | 79 | ``` 80 | $ helm version 81 | 82 | Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"} 83 | Server: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"} 84 | ``` 85 | 86 | > For more info in installing helm, you can find the official documentation [here](https://docs.helm.sh/using_helm/#installing-helm). The helm version that you install should be the same version or a previous version to the version of the cluster (i.e. the Server version in `helm version`). If the helm version is newer than the cluster, the command may not work as expected. 87 | 88 | ### 4. Configure GitLab and Install 89 | 90 | You can find the official helm chart repo for Cloud Native GitLab deployment [here](https://gitlab.com/charts/gitlab). This can guide you in configuring your own deployment for production use. 91 | 92 | A sample configuration `config.yaml` in this repo can help you get started with GitLab in IKS. This yaml file is configured to use the provided ingress controller with IKS. The components (Gitaly, Postgres, Redis, Minio) will not use any persistent storage for now. 93 | 94 | Modify `config.yaml` file to use your own Ingress Subdomain, certificate, and IP. 95 | 96 | ``` 97 | $ bx cs cluster-get 98 | 99 | ## You should look for these values 100 | ## ... 101 | ## Ingress Subdomain: anthony-dev.us-south.containers.appdomain.cloud 102 | ## Ingress Secret: anthony-dev 103 | ## ... 104 | ``` 105 | 106 | To get the ALB (Application Load Balancer) IP address of your cluster: 107 | 108 | ``` 109 | $ bx cs albs --cluster 110 | 111 | ## Get the IP Address from the public ALB 112 | ## ALB ID Enabled Status Type ALB IP Zone 113 | ## private-...-alb1 false disabled private - - 114 | ## public-...-alb1 true enabled public 169.XX.XX.XX dal13 115 | ``` 116 | 117 | You can now fill in your own values of `INGERSS_SUBDOMAIN`, `INGRESS_SECRET`, and `ALB_IP` in `config.yaml` 118 | 119 | Install GitLab by doing: 120 | 121 | ``` 122 | $ helm upgrade --install gitlab gitlab/gitlab -f config.yaml 123 | ``` 124 | 125 | ### 5. Launch GitLab 126 | 127 | Installing GitLab can take minutes to setup. You can check the status of your deployment: 128 | 129 | ``` 130 | $ kubectl get pods 131 | 132 | NAME READY STATUS RESTARTS AGE 133 | gitlab-gitaly-0 1/1 Running 0 3m 134 | gitlab-gitlab-runner-7554ff7c9d-2rt7x 0/1 Running 4 3m 135 | gitlab-gitlab-shell-78b8677b59-9z9m2 1/1 Running 0 3m 136 | gitlab-gitlab-shell-78b8677b59-hssqc 1/1 Running 0 2m 137 | gitlab-migrations.1-74xqt 0/1 Completed 0 3m 138 | gitlab-minio-7b67585cf5-tc4gh 1/1 Running 0 3m 139 | gitlab-minio-create-buckets.1-bdbhk 0/1 Completed 0 3m 140 | gitlab-postgresql-7756f9c75f-pzvlj 1/1 Running 0 3m 141 | gitlab-redis-554dc46b4c-jlkps 2/2 Running 0 3m 142 | gitlab-registry-75cdd8cc6d-n6fx6 1/1 Running 0 2m 143 | gitlab-registry-75cdd8cc6d-nz9sq 1/1 Running 0 3m 144 | gitlab-sidekiq-all-in-1-5865f7f999-wvg6c 1/1 Running 0 3m 145 | gitlab-task-runner-d84b7b9b9-9mc9k 1/1 Running 0 3m 146 | gitlab-unicorn-596cbf98cc-kqrsr 2/2 Running 0 3m 147 | gitlab-unicorn-596cbf98cc-mjbtn 2/2 Running 0 2m 148 | ``` 149 | 150 | If all your pods are now running, you can now go to your GitLab installation by visiting `https://gitlab.` 151 | 152 | Now that Gitlab is running you can [register as a new user and create a project](docs/using-gitlab.md). 153 | 154 | To try GitLab with persistent storage, you can explore `config-persistent.yaml` and use that instead of `config.yaml`. This will use dynamic storage provisioning that's provided with IKS. 155 | 156 | You can learn how to expose the port `22` [here](docs/ssh-port-ingress.md) with the ingress controller to clone repositories using SSH. 157 | 158 | # Troubleshooting 159 | 160 | If a pod doesn't start examine the logs. 161 | ```bash 162 | kubectl get pods 163 | kubectl logs 164 | ``` 165 | 166 | # Cleanup 167 | 168 | To delete your GitLab installation: 169 | 170 | ```bash 171 | $ helm delete gitlab --purge 172 | ``` 173 | 174 | # License 175 | 176 | This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer [Certificate of Origin, Version 1.1](https://developercertificate.org/) (“DCO”) and the [Apache Software License, Version 2](LICENSE). 177 | 178 | ASL FAQ link: https://www.apache.org/foundation/license-faq.html#WhatDoesItMEAN 179 | 180 | 181 | -------------------------------------------------------------------------------- /README-pt.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample.svg?branch=master)](https://travis-ci.org/IBM/Kubernetes-container-service-GitLab-sample) 2 | 3 | # Implementação do GitLab no cluster Kubernetes 4 | 5 | *Ler em outros idiomas: [한국어](README.ko.md).* 6 | 7 | Este projeto mostra como uma carga de trabalho comum com vários componentes (no caso, o GitLab) pode ser implementada no cluster Kubernetes. O GitLab é famoso pela ferramenta de acompanhamento de código com base em Git. O GitLab representa um aplicativo típico multicamada; cada componente terá seus próprios contêineres. Os contêineres de microsserviços serão para a camada da web, enquanto o banco de dados de estado/tarefa é com Redis e PostgreSQL como banco de dados. 8 | 9 | Utilizando diferentes componentes do GitLab (NGINX, Ruby on Rails, Redis, PostgreSQL e muito mais), é possível implementá-lo no Kubernetes. Este exemplo também pode ser implementado com Compose for PostgreSQL no Bluemix como banco de dados. 10 | 11 | ![Flow](images/gitlab_container_2.png) 12 | 1. O usuário interage com o GitLab pela interface da web ou enviando um código por push para um repositório do GitHub. O contêiner do GitLab executa o aplicativo principal Ruby on Rails atrás do NGINX e do cavalo de batalha do GitLab, que é um proxy reverso para grandes solicitações de HTTP, como downloads de arquivos e push/pull de Git. Enquanto atende repositórios por HTTP/HTTPS, o GitLab utiliza a API GitLab para resolver a autorização e o acesso, além de atender objetos Git. 13 | 2. Após a autenticação e a autorização, o aplicativo GitLab Rails coloca as tarefas recebidas, as informações das tarefas e os metadados na fila de tarefas do Redis, que funciona como um banco de dados não persistente. 14 | 3. Os repositórios são criados em um sistema de arquivos local. 15 | 4. O usuário cria usuários, funções, solicitações de mesclagem, grupos e muito mais. Em seguida, tudo é armazenado em PostgreSQL. 16 | 5. Para acessar o repositório, o usuário entra por meio do shell Git. 17 | 18 | ## Componentes inclusos 19 | - [GitLab](https://about.gitlab.com/) 20 | - [PostgreSQL](https://www.postgresql.org/) 21 | - [Redis](https://redis.io/) 22 | - [Clusters Kubernetes](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) 23 | - [Bluemix Container Service](https://console.ng.bluemix.net/catalog/?taxonomyNavigation=apps&category=containers) 24 | - [Bluemix Compose for PostgreSQL](https://console.ng.bluemix.net/catalog/services/compose-for-postgresql) 25 | 26 | ## Objetivos 27 | Este cenário fornece instruções e aprendizado para as seguintes tarefas: 28 | - Desenvolver contêineres e armazená-los no registro de contêineres 29 | - Usar o Kubernetes para criar volumes persistentes locais a fim de definir discos persistentes 30 | - Implementar contêineres usando pods e serviços do Kubernetes 31 | - Usar o serviço do Bluemix em aplicativos Kubernetes 32 | - Implementar um GitLab distribuído no Kubernetes ## Cenários de implementação 33 | 34 | ### Implementar usando Docker 35 | Consulte [Implementando o GitLab com o Docker](docs/deploy-with-docker.md) 36 | 37 | ### Implementar no Kubernetes 38 | Crie um cluster Kubernetes com [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube) para testes locais ou com [IBM Bluemix Container Service](https://github.com/IBM/container-journey-template#container-journey-template---creating-a-kubernetes-cluster) para implementar na cloud. 39 | 40 | Aqui, o código é testado regularmente com relação ao [Cluster Kubernetes do Bluemix Container Service](https://console.ng.bluemix.net/docs/containers/cs_ov.html#cs_ov) usando o Travis. 41 | 42 | Se quiser usar o Bluemix Container Registry, comece [Fazendo o upload das imagens](docs/use-bluemix-container-registry) no Bluemix Container Registry. 43 | ### Implementar usando a cadeia de ferramentas do DevOps no cluster Kubernetes a partir do Bluemix Container Service 44 | Se quiser implementar o GitLab diretamente no Bluemix, clique no botão 'Deploy to Bluemix' abaixo para criar uma [cadeia de ferramentas de serviços do Bluemix DevOps e um canal](https://console.ng.bluemix.net/docs/services/ContinuousDelivery/toolchains_about.html#toolchains_about) para implementação da amostra do GitLab ou avance para [Etapas](#steps) 45 | 46 | [![Create Toolchain](https://github.com/IBM/container-journey-template/blob/master/images/button.png)](https://console.ng.bluemix.net/devops/setup/deploy/) 47 | 48 | Siga as [instruções da cadeia de ferramentas](https://github.com/IBM/container-journey-template/blob/master/Toolchain_Instructions_new.md) para concluir a cadeia de ferramentas e o canal. 49 | 50 | #### Etapas 51 | 1. [Usar o Kubernetes para criar serviços e implementações](#1-use-kubernetes-to-create-services-and-deployments-for-gitlab-redis-and-postgresql) 52 | - 1.1 [Usar o PostgreSQL no contêiner](#11-use-postgresql-in-container) ou 53 | - 1.2 [Usar o PostgreSQL a partir do Bluemix](#12-use-postgresql-from-bluemix) 54 | 2. [Recuperar IP externo e porta para o GitLab](#2-retrieve-external-ip-and-port-for-gitlab) 55 | 3. [O GitLab está pronto! Usar o GitLab para hospedar seus repositórios](#3-gitlab-is-ready-use-gitlab-to-host-your-repositories) 56 | 57 | #### 1. Usar o Kubernetes para criar serviços e implementações para GitLab, Redis e PostgreSQL 58 | 59 | Para conferir se seu cluster Kubernetes pode ser acessado, execute o comando `kubectl`. 60 | ```bash 61 | $ kubectl get nodes NAME STATUS AGE VERSION x.x.x.x Ready 17h v1.5.3-2+be7137fd3ad68f 62 | ``` 63 | > Observação: em caso de falha nesta etapa, consulte os documentos de resolução de problemas no [Minikube](https://kubernetes.io/docs/getting-started-guides/minikube) ou no [IBM Bluemix Container Service](https://console.ng.bluemix.net/docs/containers/cs_troubleshoot.html#cs_troubleshoot). 64 | 65 | ##### 1.1 Usar o PostgreSQL em contêiner 66 | 67 | Se estiver usando uma imagem de contêiner para executar o PostgreSQL, execute os comandos a seguir ou execute o script de iniciação rápida `./scripts/quickstart.sh` com seu cluster Kubernetes. 68 | 69 | ```bash 70 | $ kubectl create -f kubernetes/local-volumes.yaml 71 | $ kubectl create -f kubernetes/postgres.yaml 72 | $ kubectl create -f kubernetes/redis.yaml 73 | $ kubectl create -f kubernetes/gitlab.yaml 74 | ``` 75 | Depois de criar todos os serviços e implementações, aguarde entre três e cinco minutos. É possível verificar o status da implementação na interface com o usuário do Kubernetes. Execute 'kubectl proxy' e acesse a URL 'http://127.0.0.1:8001/ui' para verificar quando o contêiner do GitLab ficará pronto. 76 | 77 | ![Kubernetes Status Page](images/kube_ui.png) 78 | 79 | A seguir, [recupere o IP externo e a porta para o GitLab](#2-retrieve-external-ip-and-port-for-GitLab) 80 | 81 | ##### 1.2 Usar o PostgreSQL a partir do Bluemix 82 | Use o catálogo do Bluemix ou o comando bx para criar uma instância de serviço do Compose for PostgreSQL e incluir um conjunto de credenciais. 83 | ```bash 84 | $ bx service create compose-for-postgresql Standard "Compose for PostgreSQL-GL" 85 | $ bx service key-create "Compose for PostgreSQL-GL" Credentials-1 86 | ``` 87 | Recupere a cadeia de caractere de conexão do objeto de credenciais para o serviço no Bluemix. 88 | ```bash 89 | $ bx service key-show "Compose for PostgreSQL-GL" "Credentials-1" | grep "postgres:" 90 | ``` 91 | ![Postgres Connection String example](images/pg_credentials.png) 92 | 93 | Modifique seu arquivo ```kubernetes/gitlab-postgres-svc.yaml``` e substitua COMPOSE_PG_PASSWORD pela senha, COMPOSE_PG_HOST pelo nome do host e COMPOSE_PG_PORT pela porta. 94 | 95 | Usando o exemplo acima, a seção ```env:``` terá esta aparência. 96 | 97 | ```yaml 98 | env: 99 | - name: GITLAB_OMNIBUS_CONFIG 100 | value: | 101 | postgresql['enable'] = false 102 | gitlab_rails['db_username'] = "admin" 103 | gitlab_rails['db_password'] = "ETIDRKCGOEIGBMZA" 104 | gitlab_rails['db_host'] = "bluemix-sandbox-dal-9-portal.6.dblayer.com" 105 | gitlab_rails['db_port'] = "26576" 106 | gitlab_rails['db_database'] = "compose" 107 | gitlab_rails['db_adapter'] = 'postgresql' 108 | gitlab_rails['db_encoding'] = 'utf8' 109 | redis['enable'] = false 110 | gitlab_rails['redis_host'] = 'redis' 111 | gitlab_rails['redis_port'] = '6379' 112 | gitlab_rails['gitlab_shell_ssh_port'] = 30022 113 | external_url 'http://gitlab.example.com:30080' 114 | ``` 115 | 116 | Execute os comandos a seguir ou execute o script de iniciação rápida `./scripts/quickstart-postgres-svc.sh` com seu cluster Kubernetes. 117 | 118 | ```bash 119 | $ kubectl create -f kubernetes/local-volumes.yaml 120 | $ kubectl create -f kubernetes/redis.yaml 121 | $ kubectl create -f kubernetes/gitlab-postgres-svc.yaml 122 | ``` 123 | Depois de criar todos os serviços e implementações, aguarde entre três e cinco minutos. É possível verificar o status da implementação na interface com o usuário do Kubernetes. Execute 'kubectl proxy' e acesse a URL 'http://127.0.0.1:8001/ui' para verificar quando o contêiner do GitLab ficará pronto. 124 | 125 | ![Kubernetes Status Page](images/kube_ui_gr.png) 126 | 127 | ### 2. Recuperar o IP externo e a porta para o GitLab 128 | 129 | Depois de alguns minutos, execute os comandos a seguir para obter o IP público e o número da NodePort. 130 | ```bash 131 | $ $ bx cs workers 132 | OK ID Public IP Private IP Machine Type State Status 133 | kube-hou02-pa817264f1244245d38c4de72fffd527ca-w1 169.47.241.22 10.10.10.148 free normal Ready 134 | $ kubectl get svc gitlab 135 | NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE 136 | gitlab 10.10.10.148 80:30080/TCP,22:30022/TCP 2s 137 | ``` 138 | > Observação: a porta 30080 é para a IU do GitLab; a porta 30022 é para ssh. 139 | 140 | > Observação: a URL externa do GitLab foi definida como `gitlab.example.com`. Inclua no arquivo de hosts que aponta para seu endereço IP de cima, a fim de usar a URL esperada pelo GitLab. Caso não consiga fazer isso, o uso do IP (neste exemplo, 169.47.241.22) deve funcionar. 141 | 142 | > Observação: se estiver usando o Minikube para implementação local no Kubernetes, você poderá acessar a lista de IPs de serviço com o comando `minikube service list`. 143 | 144 | Parabéns. Agora você pode usar o link [http://gitlab.example.com:30080](http://gitlab.example.com:30080) ou http://:30080 para acessar o serviço do GitLab a partir do seu navegador da web. 145 | 146 | ### 3. O GitLab está pronto! Usar o GitLab para hospedar seus repositórios 147 | 148 | Agora que o GitLab está em execução, é possível [se inscrever como novo usuário e criar um projeto](docs/using-gitlab.md). 149 | 150 | ##Resolução de problemas 151 | 152 | Se um pod não for iniciado, examine os logs. 153 | ```bash 154 | kubectl get pods kubectl logs 155 | ``` 156 | 157 | 158 | ## Limpeza 159 | Para excluir todos os seus serviços, implementações e solicitação de volume persistente, execute 160 | ```bash 161 | kubectl delete deployment,service,pvc -l app=gitlab 162 | ``` 163 | Para excluir o volume persistente, execute 164 | ```bash 165 | kubectl delete pv local-volume-1 local-volume-2 local-volume-3 166 | ``` 167 | Para excluir as credenciais do PostgreSQL e remover a instância de serviço do Bluemix, execute 168 | ```bash 169 | bx service key-delete "Compose for PostgreSQL-GL" Credentials-1 170 | bx service delete "Compose for PostgreSQL-GL" 171 | ``` 172 | # Licença 173 | [Apache 2.0](LICENÇA) 174 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /.bluemix/toolchain.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 35 | 36 | background 37 | 38 | 39 | 40 | Layer 1 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | ISSUE TRACKER 239 | GitHub 240 | THINK 241 | CODE 242 | DELIVER 243 | RUN 244 | REPOSITORY 245 | GitHub 246 | PIPELINE 247 | BLUEMIX 248 | 249 | 250 | --------------------------------------------------------------------------------