To develop in a practice way I was trying different options for scripting in RouterOS.
Right now I'm using:
- Visual Studio Code as my main editor
- Mikrotik RouterOS script extension for coloring and code snipets
- ftp-sync extension (don't use the ftp-sync-improved, it doesn't work with mikrotik)
A very useful feature to config is to add ssh key to your mikrotik admin user, so you can use the ftp-sync extension with SCP protocol and can login trought the Visual Studio Code terminal. Check Mikrotik documentation about ssh access.
My ftp-sync config uploads the .rsc file as soon as I save it, and then I can run it with /import script-name.rsc
from the terminal connected to Mikrotik.
{
"remotePath": "./",
"host": "192.168.1.1",
"username": "admin",
"password": null,
"port": 22,
"secure": false,
"protocol": "scp",
"uploadOnSave": true,
"passive": false,
"debug": true,
"privateKeyPath": "/PATH/TO/MY/HOME/.ssh/id_rsa",
"passphrase": null,
"agent": null,
"allow": [
"\\.rsc"
],
"ignore": [
"\\.vscode",
"\\.git",
"\\.DS_Store",
"doc",
"images"
],
"generatedFiles": {
"extensionsToInclude": [],
"path": ""
},
"detailedSyncSummary": true
}
When the script is ready to be published, just push it to github and install/update with $ScriptInstallUpdate
function as described in the README.md.
Share your development tips or setup in the discussions
Notes:
- ftp-sync extension seems a bit buggy extension. Basic functions works, but may be other functions don't work or stop working and you have to close VSCode window and start again.