Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ workspace:
base: /go
path: src/github.com/src-d/code-annotation

branches: [master, staging, release/*]
branches: [master, staging]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have you removed release/*?

@dpordomingo dpordomingo Mar 21, 2018

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was copied from Landing .drone.yml, that run tests, and triggers the deploy;
In Landing (and blog and talks), tests are also run on release/* branches.
If we want to reproduce ☝️ this behavior, it should be done in .travis.yml file
(because in CAT tests are run from Travis instead of from Drone) but it is out of the scope of this PR (and we didn't consider it yet for this app)

Does it answer your question @rporres ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure! :)


# ANCHORS

Expand All @@ -27,6 +27,14 @@ docker_image: &docker_image
dockerfile: Dockerfile
debug: true

helm_deploy: &helm_deploy
image: quay.io/ipedrazas/drone-helm
skip_tls_verify: true
chart: ./helm-charts/code-annotation
release: code-annotation
tiller_ns: kube-system
wait: true

# PIPELINE STEPS

pipeline:
Expand All @@ -36,7 +44,7 @@ pipeline:
debug: true


# deployment to staging environment
# deployment to staging environment when staging is pushed

build_stg:
<<: *build
Expand All @@ -53,20 +61,17 @@ pipeline:
event: [push]

helm_deploy_stg:
image: quay.io/ipedrazas/drone-helm
skip_tls_verify: true
chart: ./helm-charts/code-annotation
release: code-annotation
<<: *helm_deploy
prefix: STG
secrets: [ STG_API_SERVER, STG_KUBERNETES_TOKEN ]
values: ingress.globalStaticIpName=code-annotation-staging,ingress.hostname=code-annotation-staging.srcd.run,image.tag=commit-${DRONE_COMMIT_SHA:0:7},secretName=code-annotation-drone-workaround
tiller_ns: kube-system
wait: true
values: ingress.globalStaticIpName=code-annotation-staging,ingress.hostname=code-annotation-staging.srcd.run,image.tag=commit-${DRONE_COMMIT_SHA:0:7},deployment.gaTrackingID=UA-109494282-2,secretName=code-annotation-drone-workaround
when:
branch: [staging]
event: [push]

# push build artifacts to GitHub release
# deployment to Production environment when a new tag is created; it will also:
# - push to GitHub release, the compiled binaries,
# - push to DockerHub, the docker image

build_release:
<<: *build
Expand All @@ -87,3 +92,11 @@ pipeline:
files: build/*.tar.gz
when:
event: [tag]

helm_deploy_release_prod:
<<: *helm_deploy
prefix: PROD
secrets: [ PROD_API_SERVER, PROD_KUBERNETES_TOKEN ]
values: ingress.globalStaticIpName=code-annotation-production,ingress.hostname=code-annotation.sourced.tech,image.tag=${DRONE_TAG},deployment.gaTrackingID=UA-109494282-2,secretName=code-annotation-drone-workaround
when:
event: [tag]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ CAT_OAUTH_RESTRICT_ACCESS=org:my-organization
CAT_OAUTH_RESTRICT_REQUESTER_ACCESS=team:123456
```

## Deployment

This site is deployed in `production` and in `staging` following our [web application deployment workflow](https://github.com/src-d/guide/blob/master/engineering/continuous-delivery.md)

@bzz bzz Mar 21, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something important - we should think (and document it as well) that it's not a web site or a service, it's an application. This has consequences on many levels, including the way structure the release, package&distribute artifacts, monitor it, etc.

Ofcourse as a web application, it can be deployed by different people in different scenarios on different environments (and that's what we aiming for), but I think it's worth highlighting it here and making a clear distinction between general expectations and sourced-specific things.

How about

  • changing the title from Deployment -> source{d} internal deployment
  • changing site -> application
  • production and staging sourced{d} environments

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copied the code from Blog and Landing but yes: your proposals are even better and they could be also applied there.
I'll proceed with your suggestions before merging, Thanks!


## Contributing

[Contributions](https://github.com/src-d/code-annotation/issues) are more than welcome, if you are interested please take a look to our [Contributing Guidelines](CONTRIBUTING.md). You have more information on how to run it locally for [development purposes here](CONTRIBUTING.md#Development).
Expand Down
2 changes: 1 addition & 1 deletion helm-charts/code-annotation/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ spec:
name: {{ $secretName }}
key: jwt_signing_key
- name: CAT_GA_TRACKING_ID
value: "{{ .Values.deployment.gaTrackingID }}"
value: "{{ required "gaTrackingID is required" .Values.deployment.gaTrackingID }}"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two different ways to write it:

wrapping the value with quotes:

image: "{{ .Values.image.repository }}:{{ required "Image tag is required" .Values.image.tag }}"

leaving the value without wrapper quotes:

- host: {{ required "Hostname is missing" .Values.ingress.hostname }}

@rporres should I use one style for this CAT_GA_TRACKING_ID env value?

@rporres rporres Mar 21, 2018

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All env variables must be strings, so they must be quoted to avoid YAML interpreting as numbers

ports:
- containerPort: {{ .Values.service.codeAnnotation.internalPort }}
volumeMounts:
Expand Down
4 changes: 2 additions & 2 deletions helm-charts/code-annotation/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ image:
pullPolicy: IfNotPresent
deployment:
internalDatabasePath: "/var/code-annotation"
gaTrackingID: "UA-109494282-2"
# gaTrackingID must be received as a parameter
authorization:
restrictAccessGroup: "org:src-d"
restrictRequesterGroup: ""
Expand All @@ -28,7 +28,7 @@ ingress:
kubernetes.io/ingress.class: gce
tls: true
# below values are required
# hostname: "code-annotation-staging.srcd.run"
# hostname: "code-annotation.sourced.tech"
# globalStaticIpName: "code-annotation-ip"

# Provide with 'helm install', and do NOT change it when doing 'helm upgrade'
Expand Down