DEV Community

Cover image for Continuous Deploy in CircleCI to shared host πŸš€
4 2

Continuous Deploy in CircleCI to shared host πŸš€

CircleCI is a powerfull tool for continuous integration and continuous Deploy. Using docker to run builds in a clean and totaly customable container.
CircleCI integrates with GitHub and Bitbucket. Every time you commit code, CircleCI create a build.

If you interest in know more, please visit circleci.com.

So, in this post I show you how you can deploy to FTP using CircleCI.

After you create your account and link that with your Github or/and BitBucket, the steps is very simple, and I'm not abord this theme here.

CircleCI use yml file to configure how you integration is work's.
The file must be in the .circleci in your root project.

In this case, I'm use a php docker image with node. Then in command Im install git-ftp.
In the very first commit, you need pass git ftp init instad git ftp push, after that, you can change to git ftp push otherwise you receive an error.

Very first commit:

git ftp init --user "YOUR_FTP_USE" --passwd "YOUR_FTP_PASS" "ftp://youdomain.com/public_html/"
Enter fullscreen mode Exit fullscreen mode

Others commit:

git ftp push --user "YOUR_FTP_USE" --passwd "YOUR_FTP_PASS" "ftp://youdomain.com/public_html/"
Enter fullscreen mode Exit fullscreen mode

In deploy field you can set how branches you want deploy:

- deploy:
    filters:
      branches:
        only: master
Enter fullscreen mode Exit fullscreen mode

Complete yml file:

version: 2
jobs:
  deploy:
    docker:
      - image: circleci/php:7.1-node-browsers

    steps:
      - checkout

      - run: 
          name: Deploy Master Branch
          command: |
            sudo apt-get update
            sudo apt-get -qq install git-ftp
            echo "Deploying project ..."
            echo $(git status)
            echo "Deploying to my ftp"
            git ftp push --user "YOUR_FTP_USER" --passwd "YOUR_FTP_PASS" "ftp://youdomain.com/public_html/"

workflows:
  version: 2
  just-deploy:
    jobs:
      - deploy:
          filters:
            branches:
              only: master
Enter fullscreen mode Exit fullscreen mode

If you like this post, or need more information please comment bellow and I'm try to help you.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay