svps

πŸš€ A simple CLI tool to automate the setup and pre-settings of your Ubuntu VPS

Usage no npm install needed!

<script type="module">
  import svps from 'https://cdn.skypack.dev/svps';
</script>

README

SVPS - Auto Mount VPS

πŸš€ A simple CLI tool to automate the setup and pre-settings of your Ubuntu VPS

Install

   npm i svps

Initializing the Environment

   npx svps || npx svps init
  • This will create the default configuration files:

       [ '.svpsrc.js', '.domains.json', '.cronjobs.sh', 'index.html' ]
    
  • Edit .svpsrc.js with the SSH access and your settings


Mounting VPS

   npx svps mount

Setps:

  1. Fixes common conflicts on Ubuntu
  2. Runs common apt commands
  3. Sets the most common Firewall settings
  4. Installs Apache2 and forbids access to the default html directory
  5. Installs vsftpd with users setted in .svpsrc.js
  6. Prepares the Virtual Host and abilite Rewrite
  7. Installs PHP with the version setted in .svpsrc.js
  8. Installs Node.js with the version and global modules setted in .svpsrc.js
  9. Installs MySQL and creates the databases and users setted in .svpsrc.js
  10. Adds cronjobs setted on the file specified in .svpsrc.js
  11. Reruns common apt commands
  12. Executes your personal sh commands specified in .svpsrc.js
  13. Restart VPS

Notes:

  • All steps are optional: You can enable or disable any step in .svpsrc.js
  • You are free to disable all the steps and create your own module of sh commands Λ£β€ΏΛ£
    • See APPEND_COMMANDS in .svpsrc.js
  • The entire remote process is displayed on console in real time
  • This may take a long time depending on your VPS plan

Adding Virutal Hosts

   npx svps set domains
  • Gets listed domains in .domains.json or a HTTP GET Request JSON setted in .svpsrc.js
  • Sets the Virtual Host for each domain and www CNAME
  • Creates each domain directories with a default index.(html|php) setted in .svpsrc.js
    • The domains previously set up or repeated in the list will be ignored

For Node.js:

  • The proxy is already auto-configured to route all local ports to 80, then just add the domains with local port in .domains.json:

       [
          ...,
          "mysite.com:3000",
          // πŸ“ mysite.com/app.js
          // πŸ“ mysite.com/public_html/index.html
    
          "mycname.mysite.com:3001",
          // πŸ“ mycname.mysite.com/app.js
          // πŸ“ mycname.mysite.com/public_html/index.html
    
          "myothersite.com:3002",
          // πŸ“ myothersite.com/app.js
          // πŸ“ myothersite.com/public_html/index.html
       ]
    
    • Don't repeat local ports!

For PHP:

  • Just add the domains in .domains.json:

       [
          ...,
          "mysite.com",
          // πŸ“ mysite.com/public_html/index.html
    
          "mycname.mysite.com",
          // πŸ“ mycname.mysite.com/public_html/index.html
    
          "myothersite.com",
          // πŸ“ myothersite.com/public_html/index.html
       ]
    

Notes:

  • Both PHP and NodeJS can work together πŸ‘¨β€πŸ‘¨β€πŸ‘§β€πŸ‘¦
  • All automatically generated files are disposable

Important

  • This package is designed for pre-built VPS (Ubuntu >=18.04)
  • The VPS user needs to be the root or a super user
  • Don't run this package on a VPS that is already in production❗

Compatibility

macOS Linux Windows node npm


License

License


Credits

| Contributors | GitHub | |-|-| | Author | wellwelwel |