diff --git a/content/guides/ruby/_index.md b/content/guides/ruby/_index.md index a83da12e1258..5652dc7fe5b2 100644 --- a/content/guides/ruby/_index.md +++ b/content/guides/ruby/_index.md @@ -12,6 +12,7 @@ aliases: - /language/ruby/ - /guides/language/ruby/ languages: [ruby] +tags: [frameworks] params: time: 20 minutes --- @@ -19,8 +20,8 @@ params: The Ruby language-specific guide teaches you how to containerize a Ruby on Rails application using Docker. In this guide, you’ll learn how to: - Containerize and run a Ruby on Rails application +- Configure a GitHub Actions workflow to build and push a Docker image to Docker Hub - Set up a local environment to develop a Ruby on Rails application using containers -- Configure a CI/CD pipeline for a containerized Ruby on Rails application using GitHub Actions - Deploy your containerized Ruby on Rails application locally to Kubernetes to test and debug your deployment Start by containerizing an existing Ruby on Rails application. diff --git a/content/guides/ruby/configure-ci-cd.md b/content/guides/ruby/configure-ci-cd.md deleted file mode 100644 index b4a440519b7b..000000000000 --- a/content/guides/ruby/configure-ci-cd.md +++ /dev/null @@ -1,132 +0,0 @@ ---- -title: Configure CI/CD for your Ruby on Rails application -linkTitle: Configure CI/CD -weight: 40 -keywords: ci/cd, github actions, ruby, flask -description: Learn how to configure CI/CD using GitHub Actions for your Ruby on Rails application. -aliases: - - /language/ruby/configure-ci-cd/ - - /guides/language/ruby/configure-ci-cd/ ---- - -## Prerequisites - -Complete all the previous sections of this guide, starting with [Containerize a Ruby on Rails application](containerize.md). You must have a [GitHub](https://github.com/signup) account and a [Docker](https://hub.docker.com/signup) account to complete this section. - -## Overview - -In this section, you'll learn how to set up and use GitHub Actions to build and test your Docker image as well as push it to Docker Hub. You will complete the following steps: - -1. Create a new repository on GitHub. -2. Define the GitHub Actions workflow. -3. Run the workflow. - -## Step one: Create the repository - -Create a GitHub repository, configure the Docker Hub credentials, and push your source code. - -1. [Create a new repository](https://github.com/new) on GitHub. - -2. Open the repository **Settings**, and go to **Secrets and variables** > - **Actions**. - -3. Create a new **Repository variable** named `DOCKER_USERNAME` and your Docker ID as value. - -4. Create a new [Personal Access Token (PAT)](/manuals/security/for-developers/access-tokens.md#create-an-access-token) for Docker Hub. You can name this token `docker-tutorial`. Make sure access permissions include Read and Write. - -5. Add the PAT as a **Repository secret** in your GitHub repository, with the name - `DOCKERHUB_TOKEN`. - -6. In your local repository on your machine, run the following command to change - the origin to the repository you just created. Make sure you change - `your-username` to your GitHub username and `your-repository` to the name of - the repository you created. - - ```console - $ git remote set-url origin https://github.com/your-username/your-repository.git - ``` - -7. Run the following commands to stage, commit, and push your local repository to GitHub. - - ```console - $ git add -A - $ git commit -m "my commit" - $ git push -u origin main - ``` - -## Step two: Set up the workflow - -Set up your GitHub Actions workflow for building, testing, and pushing the image -to Docker Hub. - -1. Go to your repository on GitHub and then select the **Actions** tab. - -2. Select **set up a workflow yourself**. - - This takes you to a page for creating a new GitHub actions workflow file in - your repository, under `.github/workflows/main.yml` by default. - -3. In the editor window, copy and paste the following YAML configuration. - - ```yaml - name: ci - - on: - push: - branches: - - main - - jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ vars.DOCKER_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push - uses: docker/build-push-action@v6 - with: - push: true - tags: ${{ vars.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest - ``` - - For more information about the YAML syntax for `docker/build-push-action`, - refer to the [GitHub Action README](https://github.com/docker/build-push-action/blob/master/README.md). - -## Step three: Run the workflow - -Save the workflow file and run the job. - -1. Select **Commit changes...** and push the changes to the `main` branch. - - After pushing the commit, the workflow starts automatically. - -2. Go to the **Actions** tab. It displays the workflow. - - Selecting the workflow shows you the breakdown of all the steps. - -3. When the workflow is complete, go to your - [repositories on Docker Hub](https://hub.docker.com/repositories). - - If you see the new repository in that list, it means the GitHub Actions - successfully pushed the image to Docker Hub. - -## Summary - -In this section, you learned how to set up a GitHub Actions workflow for your Ruby on Rails application. - -Related information: - -- [Introduction to GitHub Actions](/guides/gha.md) -- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) -- [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) - -## Next steps - -Next, learn how you can locally test and debug your workloads on Kubernetes before deploying. diff --git a/content/guides/ruby/configure-github-actions.md b/content/guides/ruby/configure-github-actions.md new file mode 100644 index 000000000000..a4d28d9f5016 --- /dev/null +++ b/content/guides/ruby/configure-github-actions.md @@ -0,0 +1,111 @@ +--- +title: Automate your builds with GitHub Actions +linkTitle: Automate your builds with GitHub Actions +weight: 20 +keywords: ci/cd, github actions, ruby, flask +description: Learn how to configure CI/CD using GitHub Actions for your Ruby on Rails application. +aliases: + - /language/ruby/configure-ci-cd/ + - /guides/language/ruby/configure-ci-cd/ + - /guides/ruby/configure-ci-cd/ +--- + +## Prerequisites + +Complete all the previous sections of this guide, starting with [Containerize a Ruby on Rails application](containerize.md). You must have a [GitHub](https://github.com/signup) account and a [Docker](https://hub.docker.com/signup) account to complete this section. + +If you didn't create a [GitHub repository](https://github.com/new) for your project yet, it is time to do it. After creating the repository, don't forget to [add a remote](https://docs.github.com/en/get-started/getting-started-with-git/managing-remote-repositories) and ensure you can commit and [push your code](https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository#about-git-push) to GitHub. + +1. In your project's GitHub repository, open **Settings**, and go to **Secrets and variables** > **Actions**. + +2. Under the **Variables** tab, create a new **Repository variable** named `DOCKER_USERNAME` and your Docker ID as a value. + +3. Create a new [Personal Access Token (PAT)](/manuals/security/for-developers/access-tokens.md#create-an-access-token) for Docker Hub. You can name this token `docker-tutorial`. Make sure access permissions include Read and Write. + +4. Add the PAT as a **Repository secret** in your GitHub repository, with the name + `DOCKERHUB_TOKEN`. + +## Overview + +GitHub Actions is a CI/CD (Continuous Integration and Continuous Deployment) automation tool built into GitHub. It allows you to define custom workflows for building, testing, and deploying your code when specific events occur (e.g., pushing code, creating a pull request, etc.). A workflow is a YAML-based automation script that defines a sequence of steps to be executed when triggered. Workflows are stored in the `.github/workflows/` directory of a repository. + +In this section, you'll learn how to set up and use GitHub Actions to build your Docker image as well as push it to Docker Hub. You will complete the following steps: + +1. Define the GitHub Actions workflow. +2. Run the workflow. + +## 1. Define the GitHub Actions workflow + +You can create a GitHub Actions workflow by creating a YAML file in the `.github/workflows/` directory of your repository. To do this use your favorite text editor or the GitHub web interface. The following steps show you how to create a workflow file using the GitHub web interface. + +If you prefer to use the GitHub web interface, follow these steps: + +1. Go to your repository on GitHub and then select the **Actions** tab. + +2. Select **set up a workflow yourself**. + + This takes you to a page for creating a new GitHub Actions workflow file in + your repository. By default, the file is created under `.github/workflows/main.yml`, let's change it name to `build.yml`. + +If you prefer to use your text editor, create a new file named `build.yml` in the `.github/workflows/` directory of your repository. + +Add the following content to the file: + +```yaml +name: Build and push Docker image + +on: + push: + branches: + - main + +jobs: + build_and_push: + runs-on: ubuntu-latest + steps: + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ vars.DOCKER_USERNAME }}/${{ github.event.repository.name }}:latest +``` + +Each GitHub Actions workflow includes one or several jobs. Each job consists of steps. Each step can either run a set of commands or use already [existing actions](https://github.com/marketplace?type=actions). The action above has three steps: + +1. [**Login to Docker Hub**](https://github.com/docker/login-action): Action logs in to Docker Hub using the Docker ID and Personal Access Token (PAT) you created earlier. + +2. [**Set up Docker Buildx**](https://github.com/docker/setup-buildx-action): Action sets up Docker [Buildx](https://github.com/docker/buildx), a CLI plugin that extends the capabilities of the Docker CLI. + +3. [**Build and push**](https://github.com/docker/build-push-action): Action builds and pushes the Docker image to Docker Hub. The `tags` parameter specifies the image name and tag. The `latest` tag is used in this example. + +## 2. Run the workflow + +Let's commit the changes, push them to the `main` branch. In the workflow above, the trigger is set to `push` events on the `main` branch. This means that the workflow will run every time you push changes to the `main` branch. You can find more information about the workflow triggers [here](https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows). + +Go to the **Actions** tab of you GitHub repository. It displays the workflow. Selecting the workflow shows you the breakdown of all the steps. + +When the workflow is complete, go to your [repositories on Docker Hub](https://hub.docker.com/repositories). If you see the new repository in that list, it means the GitHub Actions workflow successfully pushed the image to Docker Hub. + +## Summary + +In this section, you learned how to set up a GitHub Actions workflow for your Ruby on Rails application. + +Related information: + +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) + +## Next steps + +In the next section, you'll learn how you can develop your application using containers. + diff --git a/content/guides/ruby/containerize.md b/content/guides/ruby/containerize.md index ed87769c0516..18fbd21eef71 100644 --- a/content/guides/ruby/containerize.md +++ b/content/guides/ruby/containerize.md @@ -24,7 +24,7 @@ Starting from Rails 7.1 [Docker is supported out of the box](https://guides.ruby If you have an existing Rails application, you will need to create the Docker assets manually. Unfortunately `docker init` command does not yet support Rails. This means that if you are working with Rails, you'll need to copy Dockerfile and other related configurations manually from the examples below. -## Initialize Docker assets +## 1. Initialize Docker assets Rails 7.1 generates multistage Dockerfile out of the box, below is an example of such file generated from a Rails template. @@ -232,7 +232,7 @@ To learn more about the files, see the following: - [compose.yaml](/reference/compose-file/_index.md) - [docker-entrypoint](/reference/dockerfile/#entrypoint) -## Run the application +## 2. Run the application To run the application, run the following command in a terminal inside the application's directory. @@ -244,7 +244,7 @@ Open a browser and view the application at [http://localhost:3000](http://localh In the terminal, press `ctrl`+`c` to stop the application. -### Run the application in the background +## 3. Run the application in the background You can run the application detached from the terminal by adding the `-d` option. Inside the `docker-ruby-on-rails` directory, run the following command @@ -278,5 +278,4 @@ Related information: ## Next steps -In the next section, you'll learn how you can develop your application using -containers. +In the next section, you'll take a look at how to set up a CI/CD pipeline using GitHub Actions. \ No newline at end of file diff --git a/content/guides/ruby/deploy.md b/content/guides/ruby/deploy.md index d86ef14bd22c..91d511d2d03d 100644 --- a/content/guides/ruby/deploy.md +++ b/content/guides/ruby/deploy.md @@ -24,7 +24,7 @@ In your `docker-ruby-on-rails` directory, create a file named `docker-ruby-on-rails-kubernetes.yaml`. Open the file in an IDE or text editor and add the following contents. Replace `DOCKER_USERNAME/REPO_NAME` with your Docker username and the name of the repository that you created in [Configure CI/CD for -your Ruby on Rails application](configure-ci-cd.md). +your Ruby on Rails application](configure-github-actions.md). ```yaml apiVersion: apps/v1 @@ -68,7 +68,7 @@ In this Kubernetes YAML file, there are two objects, separated by the `---`: you'll get just one replica, or copy of your pod. That pod, which is described under `template`, has just one container in it. The container is created from the image built by GitHub Actions in [Configure CI/CD for - your Ruby on Rails application](configure-ci-cd.md). + your Ruby on Rails application](configure-github-actions.md). - A NodePort service, which will route traffic from port 30001 on your host to port 8001 inside the pods it routes to, allowing you to reach your app from the network. diff --git a/content/guides/ruby/develop.md b/content/guides/ruby/develop.md index 4e67a9e4c01d..7b7b94b4729f 100644 --- a/content/guides/ruby/develop.md +++ b/content/guides/ruby/develop.md @@ -1,7 +1,7 @@ --- title: Use containers for Ruby on Rails development linkTitle: Develop your app -weight: 20 +weight: 40 keywords: ruby, local, development description: Learn how to develop your Ruby on Rails application locally. aliases: @@ -200,4 +200,4 @@ Related information: ## Next steps -In the next section, you'll take a look at how to set up a CI/CD pipeline using GitHub Actions. +In the next section, you'll learn how you can locally test and debug your workloads on Kubernetes before deploying. diff --git a/content/manuals/accounts/_index.md b/content/manuals/accounts/_index.md index 65797233c44a..383593e8755e 100644 --- a/content/manuals/accounts/_index.md +++ b/content/manuals/accounts/_index.md @@ -27,6 +27,10 @@ grid: description: Add an extra layer of authentication to your Docker account. link: /security/for-developers/2fa/ icon: phonelink_lock +- title: Deactivate an account + description: Learn how to deactivate a Docker user account. + link: /accounts/deactivate-user-account/ + icon: disabled_by_default --- You can create a Docker account to secure a Docker ID, which is a username for your account that lets you access Docker products. You can use your Docker account to sign in to Docker products like Docker Hub, Docker Desktop, or Docker Scout. You can centrally manage your [Docker account settings](https://app.docker.com/settings), as well as account security features, in [Docker Home](https://app.docker.com). diff --git a/content/manuals/accounts/manage-account.md b/content/manuals/accounts/manage-account.md index 0372d3f54a9e..02684e50f77b 100644 --- a/content/manuals/accounts/manage-account.md +++ b/content/manuals/accounts/manage-account.md @@ -5,41 +5,49 @@ description: Learn how to manage settings for your Docker account. keywords: accounts, docker ID, account settings, account management, docker home --- -You can centrally manage the settings for your Docker account using Docker Home. Here you can also take administrative actions for your account and manage your account security. +You can centrally manage your Docker account settings using Docker Home. Here +you can also take administrative actions for your account and manage your +account security. > [!TIP] > -> If your account is associated with an organization that enforces single sign-on (SSO), you may not have permissions to update your account settings. You must contact your administrator to update your settings. +> If your account is associated with an organization that enforces single +> sign-on (SSO), you may not have permissions to update your account settings. +> You must contact your administrator to update your settings. ## Update general settings 1. Sign in to your [Docker account](https://app.docker.com/login). -2. In Docker Home, select your avatar in the top-right corner to open the drop-down. +2. In Docker Home, select your avatar in the top-right corner to open the +drop-down. 3. Select **Account settings**. -From the Account Center page, you can take any of the following actions. +From the Account settings page, you can take any of the following actions. ### Update account information -To update your account information, select the arrow icon. You can edit the following settings here: +Account information is visible on your account profile in Docker Hub. You can +update the following account information: - Full name - Company - Location - Website -- Gravatar email: To add an avatar to your Docker account, create a [Gravatar account](https://gravatar.com/) and create your avatar. Next, add your Gravatar email to your Docker account settings. It may take some time for your avatar to update in Docker. - -This information is visible on your account profile in Docker Hub. +- Gravatar email: To add an avatar to your Docker account, create a +[Gravatar account](https://gravatar.com/) and create your avatar. Next, add your +Gravatar email to your Docker account settings. It may take some time for your +avatar to update in Docker. Make your changes here, then select **Save** to save your settings. ### Update email address -To update your email address, select **Email**. +To update your email address, select **Email**: 1. Enter your new email address. 2. Enter your password to confirm the change. -3. Select **Send verification email** to send a verification email to your new email address. +3. Select **Send verification email** to send a verification email to your new +email address. Once you verify your email address, your account information will update. @@ -48,21 +56,37 @@ Once you verify your email address, your account information will update. You can change your password by initiating a password reset via email. To change your password, select **Password** and then **Reset password**. - Follow the instructions in the password reset email. ## Manage security settings To update your two-factor authentication (2FA) settings, select **2FA**. -For information on two-factor authentication (2FA) for your account, see [Enable two-factor authentication](../security/for-developers/2fa/_index.md) to get started. +For information on two-factor authentication (2FA) for your account, see +[Enable two-factor authentication](../security/for-developers/2fa/_index.md) +to get started. To manage personal access tokens, select **Personal access tokens**. -For information on personal access tokens, see [Create and manage access tokens](../security/for-developers/access-tokens.md). +For information on personal access tokens, see +[Create and manage access tokens](../security/for-developers/access-tokens.md). + +## Manage connected accounts + +You can unlink Google or GitHub accounts that are linked to your Docker account +using the Account settings page: + +1. Select **Connected accounts**. +2. Select **Disconnect** on your connected account. +3. To fully unlink your Docker account, you must also unlink Docker from Google +or GitHub. See Google or GitHub's documentation for more information: + - [Manage connections between your Google Account and third-parties](https://support.google.com/accounts/answer/13533235?hl=en) + - [Reviewing and revoking authorization of GitHub Apps](https://docs.github.com/en/apps/using-github-apps/reviewing-and-revoking-authorization-of-github-apps) ## Account management To convert your account into an organization, select **Convert**. -For more information on converting your account, see [Convert an account into an organization](../admin/organization/convert-account.md). +For more information on converting your account, see +[Convert an account into an organization](../admin/organization/convert-account.md). To deactivate your account, select **Deactivate**. -For information on deactivating your account, see [Deactivating a user account](./deactivate-user-account.md). +For information on deactivating your account, see +[Deactivating a user account](./deactivate-user-account.md).