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
16 changes: 16 additions & 0 deletions _data/home-content.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@


- title: Example catalog
icon: images/home-icons/tutorial.svg
url: ''
links:
- title: CI/CD examples for pipelines
localurl: /docs/example-catalog/examples/
- title: CI examples
localurl: /docs/example-catalog/ci-examples
- title: CD examples
localurl: /docs/example-catalog/cd-examples
- title: GitOps examples
localurl: /docs/example-catalog/gitops-examples





- title: Deployments
icon: images/home-icons/deployment.svg
Expand Down
124 changes: 122 additions & 2 deletions _data/nav.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,120 @@




- title: Example catalog
url: "/example-catalog"
pages:
- title: "CI/CD examples for pipelines"
url: "/examples"
- title: "CI examples"
url: "/ci-examples"
sub-pages:
- title: Check out Git repositories
url: "/git-checkout"
- title: Custom Git commmands
url: "/git-checkout-custom"
- title: Non-Git checkouts
url: "/non-git-checkout"
- title: Use Git Hash in CI
url: "/get-short-sha-id-and-use-it-in-a-ci-process"
- title: Build an Image with the Dockerfile in root directory
url: "/build-an-image-with-the-dockerfile-in-root-directory"
- title: Build an Images specifying Dockerfile Location
url: "/build-an-image-specify-dockerfile-location"
- title: Build an Image from a different Git repository
url: "/build-an-image-from-a-different-git-repository"
- title: Build and push an Image
url: "/build-and-push-an-image"
- title: Build an Image with build arguments
url: "/build-an-image-with-build-arguments"
- title: Share data between steps
url: "/shared-volumes-between-builds"
- title: Upload/download from Google Storage buckets
url: "/uploading-or-downloading-from-gs"
- title: Call other pipelines
url: "/call-child-pipelines"
- title: Run unit tests
url: "/run-unit-tests"
- title: Run integration tests
url: "/run-integration-tests"
- title: Fan-in/fan-out with unit tests
url: "/fan-in-fan-out"
- title: Codecov coverage reports
url: "/codecov-testing"
- title: Coveralls coverage reports
url: "/coveralls-testing"
- title: Codacy coverage reports
url: "/codacy-testing"
- title: Run integration tests with Mongo
url: "/integration-tests-with-mongo"
- title: Run integration tests with MySQL
url: "/integration-tests-with-mysql"
- title: Run integration tests with PostgreSQL
url: "/integration-tests-with-postgres"
- title: Run integration tests with Redis
url: "/integration-tests-with-redis"
- title: Populate a database with existing data
url: "/populate-a-database-with-existing-data"
- title: Share volumes in composition steps
url: "/shared-volumes-of-service-from-composition-step-for-other-yml-steps"
- title: Import data to MongoDB
url: "/import-data-to-mongodb"
- title: Vault Secrets in the Pipeline
url: "/vault-secrets-in-the-pipeline"
- title: Decrypt with Mozilla SOPS
url: "/decryption-with-mozilla-sops"
- title: GitOps secrets
url: "/gitops-secrets"
- title: Launch Composition
url: "/launch-composition"
- title: Use Docker compose
url: "/launching-a-composition-and-defining-a-service-environment-variables-using-a-file"
- title: Send notification to Slack
url: "/sending-the-notification-to-slack"
- title: Send notification to Jira
url: "/sending-the-notification-to-jira"
- title: "CD examples"
url: "/cd-examples"
sub-pages:
- title: Import data to MongoDB
url: "/import-data-to-mongodb"
- title: NodeJS + Angular2 + MongoDB
url: "/nodejs-angular2-mongodb"
- title: Secure a Docker Container Using HTTP Basic Auth
url: "/secure-a-docker-container-using-http-basic-auth"
- title: Spring Boot + Kafka + Zookeeper
url: "/spring-boot-kafka-zookeeper"
- title: Web terminal
url: "/web-terminal"
- title: Trigger a K8s Deployment from a DockerHub Push Event
url: "/trigger-a-k8s-deployment-from-docker-registry"
- title: Deploy to VM
url: "/packer-gcloud"
- title: Deploy to a VM via FTP
url: "/transferring-php-ftp"
- title: Deploy to Tomcat using SCP
url: "/deploy-to-tomcat-via-scp"
- title: Deploy with Helm
url: "/helm"
- title: Deploy with Terraform
url: "/terraform"
- title: Deploy with Pulumi
url: "/pulumi"
- title: Deploy to Nomad
url: "/nomad"
- title: Deploy to Heroku
url: "/deploy-to-heroku"
- title: Use kubectl as part of Freestyle step
url: "/use-kubectl-as-part-of-freestyle-step"
- title: Deploy with Kustomize
url: "/deploy-with-kustomize"
- title: Deploy to Docker Swarm
url: "/docker-swarm"
- title: Amazon ECS/Fargate
url: "/amazon-ecs"
- title: Elastic Beanstalk
url: "/elastic-beanstalk"
- title: Deployments
url: "/deployments"
pages:
Expand Down Expand Up @@ -179,6 +295,7 @@
url: "/administration"
pages:
- title: Account & user management
url: /account-user-management
sub-pages:
- title: Create a Codefresh account
url: "/create-codefresh-account"
Expand All @@ -204,6 +321,10 @@
- title: Single Sign-On
url: /single-sign-on
pages:
- title: SSO Overview
url: /sso-overview
- title: Common configuration
url: /team-sync
- title: OpenID Connect
url: /oidc
sub-pages:
Expand All @@ -230,8 +351,7 @@
url: /saml-pingid
- title: LDAP
url: /ldap
- title: Common configuration
url: /team-sync



- title: Reference
Expand Down
12 changes: 6 additions & 6 deletions _docs/administration/account-user-management/access-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ toc: true

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

* **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/).

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



## Git-repository access restrictions

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.
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.

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.

Expand Down
2 changes: 1 addition & 1 deletion _docs/administration/user-self-management/user-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ max-width="100%"

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.

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.
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.

Note that options available highly depend on what Git provider you are using with Codefresh. -->

Expand Down
155 changes: 155 additions & 0 deletions _docs/example-catalog/cd-examples/amazon-ecs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
---
title: "Amazon ECS/Fargate"
description: "Use Codefresh to deploy Docker containers to ECS/Fargate"
group: example-catalog
sub_group: cd-examples
redirect_from:
- /docs/amazon-ecs/
- /docs/deploy-your-containers/
- /docs/deploy-your-containers/amazon-ecs/
toc: true
---
Codefresh can deploy to any ECS or Fargate cluster created in Amazon.

{% include image.html
lightbox="true"
file="/images/examples/amazon-ecs/ecs-pipeline-deployment.png"
url="/images/examples/amazon-ecs/ecs-pipeline-deployment.png"
alt="Deploying to Amazon ECS"
caption="Deploying to Amazon ECS"
max-width="100%"
%}

## Prerequisites


1. Configure an ECS (or Fargate) Cluster with at least one running instance.
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.
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.
1. Verify you have AWS Credentials (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`), with the following privileges:

`JSON`
{% highlight json %}
{% raw %}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1479146904000",
"Effect": "Allow",
"Action": [
"ecs:DescribeServices",
"ecs:DescribeTaskDefinition",
"ecs:DescribeTasks",
"ecs:ListClusters",
"ecs:ListServices",
"ecs:ListTasks",
"ecs:RegisterTaskDefinition",
"ecs:UpdateService"
],
"Resource": [
"*"
]
}
]
}
{% endraw %}
{% endhighlight %}



## Create a CI/CD pipeline for ECS/Fargate

Here is the complete pipeline:

`codefresh.yml`
{% highlight yaml %}
{% raw %}
version: '1.0'
stages:
- "clone"
- "build"
- "deploy"
steps:
main_clone:
type: "git-clone"
description: "Cloning main repository..."
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
revision: "${{CF_BRANCH}}"
stage: "clone"
git: github
BuildingDockerImage:
stage: "build"
title: Building Docker Image
type: build
image_name: ${{IMAGE}}
tag: '${{CF_SHORT_REVISION}}'
dockerfile: Dockerfile.multistage
Push:
title: "Pushing image to ECR"
stage: "deploy"
type: "push"
tag: '${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}'
registry: "ecr"
candidate: "${{BuildingDockerImage}}"
DeployToFargate:
stage: "deploy"
image: codefreshplugins/cf-deploy-ecs
commands:
- cfecs-update ${{REGION}} ${{ECS_CLUSTER_NAME}} ${{ECS_SERVICE_NAME}} --image-name ${{IMAGE_PREFIX}}/${{IMAGE}} --image-tag '${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}'
environment:
- AWS_ACCESS_KEY_ID=${{AWS_ACCESS_KEY_ID}}
- AWS_SECRET_ACCESS_KEY=${{AWS_SECRET_ACCESS_KEY}}

{% endraw %}
{% endhighlight %}

This pipeline does the following:

1. Clones the source code with a [Git clone step]({{site.baseurl}}/docs/pipelines/steps/git-clone/)
1. Uses a [build step]({{site.baseurl}}/docs/pipelines/steps/build/) to create a Docker image
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.
1. Runs `codefreshplugins/cf-deploy-ecs` to perform the actual deployment


The pipeline needs [environment variables]({{site.baseurl}}/docs/pipelines/pipelines/#pipeline-settings) that hold all the required parameters.

{% include image.html
lightbox="true"
file="/images/examples/amazon-ecs/ecs-variables.png"
url="/images/examples/amazon-ecs/ecs-variables.png"
alt="ECS environment variables"
caption="ECS environment variables"
max-width="80%"
%}




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.



## Deployment Flow

The `codefreshplugins/cf-deploy-ecs` step performs the following:


1. Gets the ECS service by specified `aws-region`, `ecs-cluster`, and `service-names`.
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.
1. Runs the `update-service` command with the new task definition revision.
1. Waits for the deployment to complete.
* Deployment is successfully completed if `runningCount == desiredCount` for PRIMARY deployment - see `aws ecs describe-services`
* The `cfecs-update` command exits with a timeout error if after --timeout (default = 900s) `runningCount` does not equal `desiredCount`
* 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.

You can also find the same step in the form of a [Codefresh plugin](https://codefresh.io/steps/step/ecs-deploy).

## Related articles
[CI/CD pipeline examples]({{site.baseurl}}/docs/example-catalog/examples/#cd-examples)
[Codefresh YAML]({{site.baseurl}}/docs/pipelines/what-is-the-codefresh-yaml/)
[Steps in pipelines]({{site.baseurl}}/docs/pipelines/steps/)
[Creating pipelines]({{site.baseurl}}/docs/pipelines/pipelines/)
[External Registries]({{site.baseurl}}/docs/integration/docker-registries/)


Loading