Skip to content

Commit 34493d1

Browse files
authored
Proj one example catalog (#285)
* Add CI examples from classic Ported all yaml examples and go lang examples from Classic to example-catalog bucket * Update nav and home yamls Added example topics to home and nav yamls * Updates * Update example-catalog structure * Update nav.yml * Update home and nav yamls * Add images for examples * Update CD examples Fix xrefs for CD example topics * Update ci-example topics Updated x-refs, sub-groups for ci-examples * Update ci example topics Updated xrefs for ci examples * Update ci example topics Updated xrefs and groups * Update nav.yml * Update ci examples * Update cd examples Added missing images and made content edits * Update ci example topics Fixed x-refs and missing images * Update finals et of ci example topics Fixed x-refs and made content edits * Add placeholder topic for Gitops examples
1 parent c6fde6e commit 34493d1

File tree

169 files changed

+10929
-12
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+10929
-12
lines changed

_data/home-content.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11

22

3+
- title: Example catalog
4+
icon: images/home-icons/tutorial.svg
5+
url: ''
6+
links:
7+
- title: CI/CD examples for pipelines
8+
localurl: /docs/example-catalog/examples/
9+
- title: CI examples
10+
localurl: /docs/example-catalog/ci-examples
11+
- title: CD examples
12+
localurl: /docs/example-catalog/cd-examples
13+
- title: GitOps examples
14+
localurl: /docs/example-catalog/gitops-examples
15+
16+
17+
18+
319

420
- title: Deployments
521
icon: images/home-icons/deployment.svg

_data/nav.yml

Lines changed: 122 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,120 @@
11

2+
3+
4+
5+
- title: Example catalog
6+
url: "/example-catalog"
7+
pages:
8+
- title: "CI/CD examples for pipelines"
9+
url: "/examples"
10+
- title: "CI examples"
11+
url: "/ci-examples"
12+
sub-pages:
13+
- title: Check out Git repositories
14+
url: "/git-checkout"
15+
- title: Custom Git commmands
16+
url: "/git-checkout-custom"
17+
- title: Non-Git checkouts
18+
url: "/non-git-checkout"
19+
- title: Use Git Hash in CI
20+
url: "/get-short-sha-id-and-use-it-in-a-ci-process"
21+
- title: Build an Image with the Dockerfile in root directory
22+
url: "/build-an-image-with-the-dockerfile-in-root-directory"
23+
- title: Build an Images specifying Dockerfile Location
24+
url: "/build-an-image-specify-dockerfile-location"
25+
- title: Build an Image from a different Git repository
26+
url: "/build-an-image-from-a-different-git-repository"
27+
- title: Build and push an Image
28+
url: "/build-and-push-an-image"
29+
- title: Build an Image with build arguments
30+
url: "/build-an-image-with-build-arguments"
31+
- title: Share data between steps
32+
url: "/shared-volumes-between-builds"
33+
- title: Upload/download from Google Storage buckets
34+
url: "/uploading-or-downloading-from-gs"
35+
- title: Call other pipelines
36+
url: "/call-child-pipelines"
37+
- title: Run unit tests
38+
url: "/run-unit-tests"
39+
- title: Run integration tests
40+
url: "/run-integration-tests"
41+
- title: Fan-in/fan-out with unit tests
42+
url: "/fan-in-fan-out"
43+
- title: Codecov coverage reports
44+
url: "/codecov-testing"
45+
- title: Coveralls coverage reports
46+
url: "/coveralls-testing"
47+
- title: Codacy coverage reports
48+
url: "/codacy-testing"
49+
- title: Run integration tests with Mongo
50+
url: "/integration-tests-with-mongo"
51+
- title: Run integration tests with MySQL
52+
url: "/integration-tests-with-mysql"
53+
- title: Run integration tests with PostgreSQL
54+
url: "/integration-tests-with-postgres"
55+
- title: Run integration tests with Redis
56+
url: "/integration-tests-with-redis"
57+
- title: Populate a database with existing data
58+
url: "/populate-a-database-with-existing-data"
59+
- title: Share volumes in composition steps
60+
url: "/shared-volumes-of-service-from-composition-step-for-other-yml-steps"
61+
- title: Import data to MongoDB
62+
url: "/import-data-to-mongodb"
63+
- title: Vault Secrets in the Pipeline
64+
url: "/vault-secrets-in-the-pipeline"
65+
- title: Decrypt with Mozilla SOPS
66+
url: "/decryption-with-mozilla-sops"
67+
- title: GitOps secrets
68+
url: "/gitops-secrets"
69+
- title: Launch Composition
70+
url: "/launch-composition"
71+
- title: Use Docker compose
72+
url: "/launching-a-composition-and-defining-a-service-environment-variables-using-a-file"
73+
- title: Send notification to Slack
74+
url: "/sending-the-notification-to-slack"
75+
- title: Send notification to Jira
76+
url: "/sending-the-notification-to-jira"
77+
- title: "CD examples"
78+
url: "/cd-examples"
79+
sub-pages:
80+
- title: Import data to MongoDB
81+
url: "/import-data-to-mongodb"
82+
- title: NodeJS + Angular2 + MongoDB
83+
url: "/nodejs-angular2-mongodb"
84+
- title: Secure a Docker Container Using HTTP Basic Auth
85+
url: "/secure-a-docker-container-using-http-basic-auth"
86+
- title: Spring Boot + Kafka + Zookeeper
87+
url: "/spring-boot-kafka-zookeeper"
88+
- title: Web terminal
89+
url: "/web-terminal"
90+
- title: Trigger a K8s Deployment from a DockerHub Push Event
91+
url: "/trigger-a-k8s-deployment-from-docker-registry"
92+
- title: Deploy to VM
93+
url: "/packer-gcloud"
94+
- title: Deploy to a VM via FTP
95+
url: "/transferring-php-ftp"
96+
- title: Deploy to Tomcat using SCP
97+
url: "/deploy-to-tomcat-via-scp"
98+
- title: Deploy with Helm
99+
url: "/helm"
100+
- title: Deploy with Terraform
101+
url: "/terraform"
102+
- title: Deploy with Pulumi
103+
url: "/pulumi"
104+
- title: Deploy to Nomad
105+
url: "/nomad"
106+
- title: Deploy to Heroku
107+
url: "/deploy-to-heroku"
108+
- title: Use kubectl as part of Freestyle step
109+
url: "/use-kubectl-as-part-of-freestyle-step"
110+
- title: Deploy with Kustomize
111+
url: "/deploy-with-kustomize"
112+
- title: Deploy to Docker Swarm
113+
url: "/docker-swarm"
114+
- title: Amazon ECS/Fargate
115+
url: "/amazon-ecs"
116+
- title: Elastic Beanstalk
117+
url: "/elastic-beanstalk"
2118
- title: Deployments
3119
url: "/deployments"
4120
pages:
@@ -179,6 +295,7 @@
179295
url: "/administration"
180296
pages:
181297
- title: Account & user management
298+
url: /account-user-management
182299
sub-pages:
183300
- title: Create a Codefresh account
184301
url: "/create-codefresh-account"
@@ -204,6 +321,10 @@
204321
- title: Single Sign-On
205322
url: /single-sign-on
206323
pages:
324+
- title: SSO Overview
325+
url: /sso-overview
326+
- title: Common configuration
327+
url: /team-sync
207328
- title: OpenID Connect
208329
url: /oidc
209330
sub-pages:
@@ -230,8 +351,7 @@
230351
url: /saml-pingid
231352
- title: LDAP
232353
url: /ldap
233-
- title: Common configuration
234-
url: /team-sync
354+
235355

236356

237357
- title: Reference

_docs/administration/account-user-management/access-control.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ toc: true
1212

1313
---
1414
<!-- needs fine tuning for GitOps as well; all x-refs have to be updated-->
15-
Codefresh provides several complementary ways for access control within an organization:
15+
Codefresh provides seral complementary ways for access control within an organization:
1616

1717
* **Role-based access**: [Role-based access](#users-and-administrators), restricts access to parts of the Codefresh UI intended for account administrators. For example, only an account administrator should be able to change integrations with [git providers]({{site.baseurl}}/docs/integrations/git-providers/) and [cloud services]({{site.baseurl}}/docs/deployments/kubernetes/add-kubernetes-cluster/).
1818

@@ -51,10 +51,10 @@ The table below lists the functionality available for role-based access.
5151
|[External Helm repositories]({{site.baseurl}}/docs/new-helm/add-helm-repository/) | `Admin`|
5252
|[Cloud provider settings]({{site.baseurl}}/docs/deployments/kubernetes/add-kubernetes-cluster/) | `Admin`|
5353
|[Cloud storage settings]({{site.baseurl}}/docs/testing/test-reports/#connecting-your-storage-account) | `Admin`|
54-
|[Shared configuration]({{site.baseurl}}/docs/configure-ci-cd-pipeline/shared-configuration/) | `Admin`|
54+
|[Shared configuration]({{site.baseurl}}/docs/pipelines/shared-configuration/) | `Admin`|
5555
|[API token generation]({{site.baseurl}}/docs/integrations/codefresh-api/#authentication-instructions) | `Admin`|
5656
|[SSO Settings]({{site.baseurl}}/docs/administration/single-sign-on/) | `Admin`|
57-
|[Runtime environment selection]({{site.baseurl}}/docs/configure-ci-cd-pipeline/pipelines/#pipeline-settings) | `Admin`|
57+
|[Runtime environment selection]({{site.baseurl}}/docs/pipelines/pipelines/#pipeline-settings) | `Admin`|
5858
|[Slack settings]({{site.baseurl}}/docs/integrations/notifications/slack-integration/) | `Admin`|
5959
|[Audit logs]({{site.baseurl}}/docs/administration/audit-logs/) | `Admin`|
6060
|ABAC for Kubernetes clusters | `Admin`|
@@ -184,14 +184,14 @@ For pipelines:
184184
* `Update` - see and edit allowed pipelines only (including tagging them).
185185
* `Delete` - can delete allowed pipelines only.
186186
* `Run` - can run allowed pipelines only.
187-
* `Approve` - resume pipelines that are waiting for manual [approval]({{site.baseurl}}/docs/codefresh-yaml/steps/approval/).
188-
* `Debug` - allow the usage of the [pipeline debugger]({{site.baseurl}}/docs/configure-ci-cd-pipeline/debugging-pipelines/).
187+
* `Approve` - resume pipelines that are waiting for manual [approval]({{site.baseurl}}/docs/pipelines/steps/approval/).
188+
* `Debug` - allow the usage of the [pipeline debugger]({{site.baseurl}}/docs/pipelines/debugging-pipelines/).
189189

190190

191191

192192
## Git-repository access restrictions
193193

194-
By default, users can load pipeline definitions when [creating a pipeline]({{site.baseurl}}/docs/configure-ci-cd-pipeline/pipelines/), from the inline editor, or any private or public Git repository.
194+
By default, users can load pipeline definitions when [creating a pipeline]({{site.baseurl}}/docs/pipelines/pipelines/), from the inline editor, or any private or public Git repository.
195195

196196
You can change the default behavior to restrict loading CI pipeline definitions from specific Git repositories or completely disable loading the definitions from all Git repositories.
197197

_docs/administration/user-self-management/user-settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ max-width="100%"
7474
7575
When you connect your [Git provider]({{site.baseurl}}/docs/integrations/git-providers/) during sign-up, you may choose to let Codefresh access only your public Git repositories.
7676
77-
To allow Codefresh to also add [Git triggers]({{site.baseurl}}/docs/configure-ci-cd-pipeline/triggers/git-triggers/) on private repositories you need to explicitly enable it in this section.
77+
To allow Codefresh to also add [Git triggers]({{site.baseurl}}/docs/pipelines/triggers/git-triggers/) on private repositories you need to explicitly enable it in this section.
7878
7979
Note that options available highly depend on what Git provider you are using with Codefresh. -->
8080

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
---
2+
title: "Amazon ECS/Fargate"
3+
description: "Use Codefresh to deploy Docker containers to ECS/Fargate"
4+
group: example-catalog
5+
sub_group: cd-examples
6+
redirect_from:
7+
- /docs/amazon-ecs/
8+
- /docs/deploy-your-containers/
9+
- /docs/deploy-your-containers/amazon-ecs/
10+
toc: true
11+
---
12+
Codefresh can deploy to any ECS or Fargate cluster created in Amazon.
13+
14+
{% include image.html
15+
lightbox="true"
16+
file="/images/examples/amazon-ecs/ecs-pipeline-deployment.png"
17+
url="/images/examples/amazon-ecs/ecs-pipeline-deployment.png"
18+
alt="Deploying to Amazon ECS"
19+
caption="Deploying to Amazon ECS"
20+
max-width="100%"
21+
%}
22+
23+
## Prerequisites
24+
25+
26+
1. Configure an ECS (or Fargate) Cluster with at least one running instance.
27+
1. Configure an ECS Service and Task Definition with a reference to **the image that you are going to build and push.** See [the official amazon docs](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html) for more details.
28+
1. Connect your [ECR to Codefresh]({{site.baseurl}}/docs/docker-registries/external-docker-registries/amazon-ec2-container-registry/) so that it can be used by name in Codefresh pipelines.
29+
1. Verify you have AWS Credentials (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`), with the following privileges:
30+
31+
`JSON`
32+
{% highlight json %}
33+
{% raw %}
34+
{
35+
"Version": "2012-10-17",
36+
"Statement": [
37+
{
38+
"Sid": "Stmt1479146904000",
39+
"Effect": "Allow",
40+
"Action": [
41+
"ecs:DescribeServices",
42+
"ecs:DescribeTaskDefinition",
43+
"ecs:DescribeTasks",
44+
"ecs:ListClusters",
45+
"ecs:ListServices",
46+
"ecs:ListTasks",
47+
"ecs:RegisterTaskDefinition",
48+
"ecs:UpdateService"
49+
],
50+
"Resource": [
51+
"*"
52+
]
53+
}
54+
]
55+
}
56+
{% endraw %}
57+
{% endhighlight %}
58+
59+
60+
61+
## Create a CI/CD pipeline for ECS/Fargate
62+
63+
Here is the complete pipeline:
64+
65+
`codefresh.yml`
66+
{% highlight yaml %}
67+
{% raw %}
68+
version: '1.0'
69+
stages:
70+
- "clone"
71+
- "build"
72+
- "deploy"
73+
steps:
74+
main_clone:
75+
type: "git-clone"
76+
description: "Cloning main repository..."
77+
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
78+
revision: "${{CF_BRANCH}}"
79+
stage: "clone"
80+
git: github
81+
BuildingDockerImage:
82+
stage: "build"
83+
title: Building Docker Image
84+
type: build
85+
image_name: ${{IMAGE}}
86+
tag: '${{CF_SHORT_REVISION}}'
87+
dockerfile: Dockerfile.multistage
88+
Push:
89+
title: "Pushing image to ECR"
90+
stage: "deploy"
91+
type: "push"
92+
tag: '${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}'
93+
registry: "ecr"
94+
candidate: "${{BuildingDockerImage}}"
95+
DeployToFargate:
96+
stage: "deploy"
97+
image: codefreshplugins/cf-deploy-ecs
98+
commands:
99+
- cfecs-update ${{REGION}} ${{ECS_CLUSTER_NAME}} ${{ECS_SERVICE_NAME}} --image-name ${{IMAGE_PREFIX}}/${{IMAGE}} --image-tag '${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}'
100+
environment:
101+
- AWS_ACCESS_KEY_ID=${{AWS_ACCESS_KEY_ID}}
102+
- AWS_SECRET_ACCESS_KEY=${{AWS_SECRET_ACCESS_KEY}}
103+
104+
{% endraw %}
105+
{% endhighlight %}
106+
107+
This pipeline does the following:
108+
109+
1. Clones the source code with a [Git clone step]({{site.baseurl}}/docs/pipelines/steps/git-clone/)
110+
1. Uses a [build step]({{site.baseurl}}/docs/pipelines/steps/build/) to create a Docker image
111+
1. Uses a [push step]({{site.baseurl}}/docs/cpipelines/steps/push/) to push the docker image to ECR. The registry was previously [connected in Codefresh]({{site.baseurl}}/docs/docker-registries/external-docker-registries/) with the `ecr` identifier.
112+
1. Runs `codefreshplugins/cf-deploy-ecs` to perform the actual deployment
113+
114+
115+
The pipeline needs [environment variables]({{site.baseurl}}/docs/pipelines/pipelines/#pipeline-settings) that hold all the required parameters.
116+
117+
{% include image.html
118+
lightbox="true"
119+
file="/images/examples/amazon-ecs/ecs-variables.png"
120+
url="/images/examples/amazon-ecs/ecs-variables.png"
121+
alt="ECS environment variables"
122+
caption="ECS environment variables"
123+
max-width="80%"
124+
%}
125+
126+
127+
128+
129+
Note that the **`--image-name`** and **`--image-tag`** pair should comprise the **full name** of the image that was pushed to the registry (including the registry name) in order to be correctly referred by the corresponding Task Definition.
130+
131+
132+
133+
## Deployment Flow
134+
135+
The `codefreshplugins/cf-deploy-ecs` step performs the following:
136+
137+
138+
1. Gets the ECS service by specified `aws-region`, `ecs-cluster`, and `service-names`.
139+
1. Creates a new revision from the current task definition of the service. If `--image-name` and `--image-tag` are provided, it replaces the image tag.
140+
1. Runs the `update-service` command with the new task definition revision.
141+
1. Waits for the deployment to complete.
142+
* Deployment is successfully completed if `runningCount == desiredCount` for PRIMARY deployment - see `aws ecs describe-services`
143+
* The `cfecs-update` command exits with a timeout error if after --timeout (default = 900s) `runningCount` does not equal `desiredCount`
144+
* The `cfecs-update` exits with an error if --max-failed (default = 2) or more ECS tasks were stopped with error for the task definition that you are deploying. ECS continuously retries failed tasks.
145+
146+
You can also find the same step in the form of a [Codefresh plugin](https://codefresh.io/steps/step/ecs-deploy).
147+
148+
## Related articles
149+
[CI/CD pipeline examples]({{site.baseurl}}/docs/example-catalog/examples/#cd-examples)
150+
[Codefresh YAML]({{site.baseurl}}/docs/pipelines/what-is-the-codefresh-yaml/)
151+
[Steps in pipelines]({{site.baseurl}}/docs/pipelines/steps/)
152+
[Creating pipelines]({{site.baseurl}}/docs/pipelines/pipelines/)
153+
[External Registries]({{site.baseurl}}/docs/integration/docker-registries/)
154+
155+

0 commit comments

Comments
 (0)