Go to your project folder and create sync-config.yaml first:
ngi-sync init
After that you will have :
xxx_sync-config.yaml or sync-config.yaml (if start from empty project) :This is a config file for connecting to the server. Rename it to sync-config.yaml
Then open the file, and edit some config to connecting to your server
project_name:Yourprojectnameusername:rootprivateKey:C:/Users/donny/.ssh/openssh_nopassword.keyhost:127.0.0.2port:22localPath:D:/workspaces/sampleremotePath:/root/workspaces/sample_projectignores: []downloads: []single_sync: []trigger_permission:unlink_folder:trueunlink:truechange:trueadd:truedirect_access:config_file:""ssh_configs:-Host:sample_project_connectionHostName:=hostUser:=usernamePort:=portRequestTty:forceIdentityFile:=privateKeyStrictHostKeyChecking:noRemoteCommand:cd=remotePath&&bash-lServerAliveInterval:300ServerAliveCountMax:2ssh_commands:# This command for use create folder project on server first-access_name:Createfolderonservercommand:ssh-v-oRemoteCommand=nonesample_project_connection-tmkdir=remotePath# This command for enter to the server and go to project folder-access_name:EntertoServercommand:ssh-v-oRemoteCommand=nonesample_project_connection
With this config we have ssh_command that we use to connect to the server
ssh_commands:# This command for use create folder project on server first-access_name:Createfolderonservercommand:ssh-v-oRemoteCommand=nonesample_project_connection-tmkdir=remotePath# This command for enter to the server and go to project folder-access_name:EntertoServercommand:ssh-vsample_project_connection
D:\workspaces\sample>ngi-syncYouarein:D:\workspaces\sampleInitializeBootstrapIsDone![ undefined, undefined ]? Direct Access List : (Press<enter>tosubmit)> Create folder on serverEntertoServerconsole::OpenConsoledevsync::OpenDevsyncdevsync2::OpenDevsync2clean::Gitcleanup:gitadd--renormalize.&&gitresetRestart
Here the following rules:
Submit the first command because we need to create a folder first on the server.
Run ngi-sync again and submit the devsync2 command devsync :: Open Devsync. And next choose the first option safe_sync :: DevSync Basic .... It will start synchronizing our code to the server project folder continuously.
D:\workspaces\sample>ngi-syncYouarein:D:\workspaces\sampleInitializeBootstrapIsDone![ undefined, undefined ]? Direct Access List : devsync2 :: Open Devsync2? Enter again ⎆:⫸Initializing...extra_commandnull? Devsync Mode : (Usearrowkeys)> safe_sync :: DevSync Basic Safe Syncronise-Triggerbyeditfile:)safe_sync_non_force::DevSyncBasicwithnonforcefile-Triggerbyeditfile:). Ignored file not activated except pull sync-Caution:Thismodewilltakealongtimeindexingthefile.andneedmoreconsumeRAMsafe_pull_sync::devsyncPullSyncronise-Thisfeatureonlydownloadbyyourbasetemplate(Moveupanddowntorevealmorechoices)
Create file hello_word.js on our local side with this body and save it
console.log("Hello world")
When you create and update the hello_world.js It will sync to the server directly and keep it running.
Open new command prompt or terminal and Run ngi-sync again and choose recent project folder just open before, if you are not right place project folder.
Ok that's a basic use for sync our code to the server. And next we will learn a advanced sync our code to the server. For now better we learn which every option on sync-config.yaml