d8888b. .d888b. d8888b. d8888b. d88888b d8888b. db .d88b. db db
88 `8D VP `8D 88 `8D 88 `8D 88' 88 `8D 88 .8P Y8. `8b d8'
88oodD' odD' 88oodD' 88 88 88ooooo 88oodD' 88 88 88 `8bd8'
88~~~ .88' 88~~~ C8888D 88 88 88~~~~~ 88~~~ 88 88 88 88
88 j88. 88 88 .8D 88. 88 88booo. `8b d8' 88
88 888888D 88 Y8888D' Y88888P 88 Y88888P `Y88P' YP
Node service running on the remote machine helps you to run ci/cd command from your local machine.
Github actions, Jenkins all those ci/cd tools are very great and production-ready, but as a small individual project builder using those solutions requires a lot of configuration and is not much convenient to use.
The p2p-deploy runs a server application on your server and listens for any ci/cd commands requested from the client. The connection between client and server is p2p and secured with strong password encryption. Its displays the output of the commands in realtime on your local machine.
$ npm i -g p2p-deploy
pm2: For continuous running the service, you can use nohup or create a service file too.
$ sudo p2p-deploy keygen
sudo is required for writing on a file.
$ p2p-deploy start
p2p-deploy setup
It will ask host url and access key where the server application is running. It will generate 'p2pd.config.js' file. Modify its content as you need.
p2p-deploy deploy
p2p-deploy help
Step 1: Install the application on the remote machine
Step 2: Generate an access key. Run 'sudo p2p-deploy keygen' , note the key, its required in step 5
Step 3: Run 'p2p-deploy start' it will start the service on port 7861, you need to open that port
Step 3.1: (Optional) run 'curl http://severip:port' that will give a connection error if something went wrong else will say 'Hello from p2p deploy service!'
Step 4: Install it in your local machine, recommended installing as global dependency
Step 5: Run 'p2p-deploy setup' on local machine (on the repro path) that will ask you an access key and generate 'p2pd.config.js' file. Modify its content as you need.(like change server IP, and port, commands, base directory)
Step 6: Run 'p2p-deploy deploy' to deploy the updates.
Step 7: Run 'p2p-deploy help' to know more commands.
cd
and sudo
command is not allowed for security reasons.
- Clone the repro in the base path file on the server first time
- Keep logged in in git (so that it didn't ask for a password when running git pull if you use git commands)
- Install pm2 on your system
Note
Don't make your access key public as that is used to generate secure encrypted message that is decoded by server to run Add the '*.key' file in your gitignore