Deploying a Wordpress Site over SSH

Hi everyone! I’m very new to circleci and so far what i’m trying to do is to simply deploy the code from github to my server, don’t need to build anything. I looked up test config example in the docs and modified it:

version: 2
      enabled: true
      - run:
          name: Deploy Over SSH
          command: |
            ssh "<remote deploy command>"

  version: 2
      - deploy:
              only: master

With this config my workflow is not failing (which is good i guess), but not deploying either. It looks like it can connect to the server. However I cannot figure out how do I specify path to the folder where I want to deploy to. Also, not quite sure what is “”. Thank you!

Could you provide some more info on what exactly you are trying to deploy?

Here is an example of a project that SSH’s into a server and runs some deployment commands (in this case running docker-compose). Depending on your specific situation the approach will be similar but the details will vary.

1 Like

I’m trying to deploy wordpress site to the ubuntu server. Sorry, my expertise in devops is very low. I’ve used for deploying code for a long time, and over there I just specify the destination where to deploy and it works. I see that with circleci it’s more complicated, but I still would love to figure it out.

Deploying a wordpress site typically means moving the new files on top of the old ones. I would recommend using rsync. You can see an example in that link that I sent you.


Just replace those variables with your own.

PATH_TO_WORDPRESS_DIRECTORY_ON_CI – should be the path to where your wordpress files are in CI.

PROD_SERVER – should be something like ubuntu@ (username@IP_ADDRESS)

PATH_TO_WORDPRESS_DIRECTORY_ONSERVER - should be the path to where your wordpres files are on the server.

The only thing to make sure is that the user that you are logging into the server with over SSH has permissions to write to the directory where you are uploading your wordpress files to.

1 Like

Thank you Lev, rsync indeed worked. But I’m still having issues, again, because of lack of the knowledge of CI. I don’t quite understand what PATH_TO_WORDPRESS_DIRECTORY_ON_CI would be for me. I tried to ssh into the box while workflow is running, but I didn’t see the files from my repo overthere. I obviously missing something. This is the article that inspired me to use circleci -, and deployment config looks pretty straightforward there…

Your project is probably located at ~/project or just ./ so try to reference the present working directory with just the period slash.

rsync -e "ssh -o StrictHostKeyChecking=no" -avz ./ $PROD_SERVER:$PATH_TO_WORDPRESS_DIRECTORY_ONSERVER

It looks to me that ~/project or ./ is empty. Jobs runs successfully, but no files getting copied over. Am I missing some building steps that have to be made prior rsync deployment?

Can you share your entire config here?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.