This is just a simple and basic script that uses Bash and Rsync to deploy Flightdeck projects (or any project)... generally Flightdeck projects are just static files so there are many other options but this is a simple just a simple solution.
We are making a few assumptions about your local and remote server.
- You know what SSH is and that you have a key configured for your remote server.
- This isn't a deal breaker but you will need to enter your remote server password, if no key is available.
- You have
rsync
installed on your local.
To install this in your project you can run the following:
wget https://raw.githubusercontent.com/flight-deck/Flightdeck-Liftoff/master/.liftoffrc && chmod +x .liftoffrc
βοΈ What this does
So the above command uses wget
to download, just the .liftoffrc
file into the current working directory.
From there we run chmod +x
on the downloaded .liftoffrc
file to make it executable for the shell.
There are a few variables that need to be configured inside of the .liftoffrc
file before you can use it.
You will need to configure your server information and your destination path.
- We added four (4) primary variables to make it easier to manage. -
$USER
,$REMOTE
,$REMOTE_PATH
,$EXCLUDE
- If you plan to use a multi server configuration - ie: Production and Stage Servers - you will need to edit two (2) additional variables. -
$REMOTE2
and$REMOTE_PATH2
The $EXCLUDE
variable is used for excluding files and directories that you do not want to be included in the deployment to your remote server. - see RSYNC docs for more details, if you are curious about it.
An example:
EXCLUDE=(
'node_modules/'
'package-lock.json'
'yarn.lock'
'.liftoffrc'
)
There are two (2) parameters, to execute the script.
./.liftoffrc ready
- Will execute adry-run
to observe the payload that is ready for "liftoff" (deploy) to the remote server. Think of this as a prelaunch check β ../liftoffrc ready go
- Will execute an actual push (deploy) of the payload to the remote server.- Launch the payload π° into orbit πͺ
There is no NPM package to install for Liftoff π but you can take advantage of NPM scripts inside of your package.json
Add the following to your package.json
"scripts": {
"deploy:test": "./.liftoffrc ready",
"deploy:live": "./.liftoffrc ready go",
}
Now you can run
npm run deploy:test
OR npm run deploy:live
or
yarn deploy:test
OR yarn deploy:live