Con unos simples pasos lograremos hacer que nuestras apps Node.js se inicien en cada arranque de nuestro servidor:
- Logueate en tu servidor y accede a la carpeta /etc/init.d
> $ cd /etc/init.d
| <!doctype html> | |
| <html> | |
| <head> | |
| <!-- Run in full-screen mode. --> | |
| <meta name="apple-mobile-web-app-capable" content="yes"> | |
| <!-- Make the status bar black with white text. --> | |
| <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| (function($){ | |
| $.fn.Focus = function(){ | |
| $(this).focus(); | |
| $(this).attr('autofocus',''); | |
| } | |
| $(function(){ |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://www.npmjs.org/install.sh | sh |
Con este pequeño código haremos un autodespliegue de nuestro repositorio en nuestro servidor. Debemos tener instalando Node.js con Npm (Instalar nodejs y npm), también es necesario GIT (Instalar Git) previamente. Luego podemos seguir con las instruciones.
Instruciones:
| ############################################# | |
| # Push de la rama actual | |
| git push origin $rama_actual | |
| ############################################# | |
| # Volver a un commit anterior, descartando los cambios | |
| git reset --HARD $SHA1 | |
| ############################################# | |
| # Ver y descargar Ramas remotas |