Giter VIP home page Giter VIP logo

rploy's Introduction

rploy 🚚

Minimal rsync deployment

Usage

npm i rploy -D

Add source and destination options to your package.json:

{
  "rploy": {
    "source": "public/",
    "destination": "user@ip:/var/www/public/"
  }
}

Alternatively, you can create an rploy.config.js file in your document root:

module.exports = {
  source: 'public/',
  destination: "user@ip:/var/www/public/"
}

Deploy:

npx rploy

Config

rploy wraps node-rsync, so you can pass any relevant options to configure flags, progress, excludes, etc. Here is an example:

{
  "rploy": {
    "source": "public/",
    "destination": "user@ip:/var/www/public/",
    "exclude": [
      ".DS_Store",
      "Icon",
      "node_modules",
      ".git"
    ],
    "progress": true
  }
}

Branches

When deploying git repositories, rploy offers a branches option, which provides a way to be explicit about a destination for each branch:

{
  "rploy": {
    "source": "public/",
    "branches": {
      "master": "user@ip:/var/www/prod/public/",
      "dev": "user@ip:/var/www/dev/public/"
    }
  }
}

You will now be notified of your current working branch and the destination:


This provides an easy way to prevent issues like accidentally deploying your staging branch to production. It will always check your working branch and look for a deploy context. You can even pass node-rsync options into each branch, to get even more granular:

{
  "rploy": {
    "source": "public/",
    "branches": {
      "master": {
        "destination": "user@ip:/var/www/prod/public/",
        "exclude": [
          "readme.md"
        ]
      },
      "dev": {
        "destination": "user@ip:/var/www/dev/public/",
        "delete": false
      }
    }
  }
}

Tips

  • I recommend adding your ssh key to the server you are deploying to, for easy passwordless auth.
  • Use a lifecycle script to build assets before a deploy:
{
  "scripts": {
    "build": "parcel src/index.js",
    "deploy": "npx rploy",
    "predeploy": "npm run build"
  },
  "rploy": {
    "source": "public/",
    "destination": "user@ip:/var/www/public/"
  }
}

Why?

I’ve been using a similar little bash script to deploy things with rsync for a while. Figured should finally package this up since there somehow still seems to be a lack of simple deployment tools for “websites.” This brings some of the ease of deploying to platforms like netlify or vercel, but without any ecosystem. Works great with traditional php projects, like kirby. git-based deployment is also cool, but sometimes it’s nice to have them decoupled, to quickly deploy to staging during dev, for example.

Provided as-is, but hopefully you find it useful! 🥂

rploy's People

Contributors

dependabot[bot] avatar iskrisis avatar jongacnik avatar moevbiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

svx iskrisis moevbiz

rploy's Issues

Contributions

Hi! Great little project i have made essentially the same thing https://github.com/floriankarsten/kirby3-mix-build-kit/blob/next/deploy.js but yours is much nicer and i would love to switch to something public. I have few things this doesn't handle are you OK with possible PRs?

My main problem is working with content folder in kirby. I deploy without content but i would also need to pull content from site and in very rare occasions push content back to a site.

Maybe there is minimal way that would just switch configuration based on argument.

Something like

{
  "rploy": {
    "source": "public/",
    "destination": "user@ip:/var/www/public/",
    "configurations": {
      "getcontent": {
        // your config from here
        "source": "user@ip:/var/www/public/content",
        "destination": "public/content",
      }
    }
  }
}

that would enable npx rploy getcontent

Btw i had no idea about lifecycle scripts pretty great thanks!

Allow `rploy.config.json` file

I sometimes find it a bit messy to have long configurations (in my case a lot of excludes and some includes) in the package.json. A seperate json file as an alternaive would be great. Rploy could check if a file called rploy.config.json exists and as a fallback use the package.json.

What do you think?
I would be happy to open a PR if you are interested in this feature.

Follow symlinks

Currently rsync won't follow symlinks.

Adding -L flag would be nice.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.