trešdiena, 2014. gada 3. septembris

My deployment configuration files for node/express angularjs fullstack project.

As documentation for myself. I wanted easy way to deploy my angularjs-fullstack (https://github.com/DaftMonk/generator-angular-fullstack) application to any ssh host.

Serverside

For deployment and app to work we need node installed. For starting (and keep running :) ) serverside I use upstart and forever (node app). Here goes configuration (stored at /etc/init/node-upstart-script.conf):

# /etc/init/node-upstart-script.conf
description "yourapp web application"
author "Gints Polis "

start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown

script
    export NODE_ENV=production

    cd /var/yourapp/current/
    exec sudo -u deploy_user NODE_ENV=production FACEBOOK_ID=your_fb_id DOMAIN=http://your_full_host_name_with_port FACEBOOK_SECRET=your_facebook_secret forever start -l "/var/log/node/yourapp.log" -a server/app.js >> /var/log/node/yourapp.log 2>&1
end script

This way you can start (enable sudo for this command to application user)

sudo start node-upstart-script

and stop your app:

forever stopall

Buildmachine

For ssh deploy I use project https://github.com/dasuchin/grunt-ssh-deploy. They lately implemented post and pre scripts to use after ssh deployments.
When this is added to your project you have to put deployment enviroment in Grunt.js file:

    environments: {
      staging: {
        options: {
          host: 'your_hostname',
          username: 'deploy_user',
          port: 22,
          password: grunt.option('password'),
          privateKey: grunt.option('keyfile') ? require('fs').readFileSync(grunt.option('keyfile')) : undefined,
          deploy_path: '/var/yourapp',
          local_path: 'dist',
          current_symlink: 'current',
          debug: true,
          run_before: 'forever stopall',
          run_after: 'cd /var/yourapp/current && npm install && sudo start node-upstart-script'
        }
      }
    },

After this you can deploy your project by issuing:

grunt ssh_deploy:staging --keyfile=/path/to/your/key/file

sestdiena, 2014. gada 14. jūnijs

How to get full size picture from Facebook GRAPH api.

This is how. You do it by FSQL request like:

SELECT pic_cover  FROM event WHERE eid=675219855873735

otrdiena, 2014. gada 27. maijs

If you use yoeman and want to install font-awesome with grunt, you probably had stuck with message - "font-awesome was not injected in your file". To get around this issue install fonts by:
bower install components-font-awesome --save
Thanks goes to this link.

pirmdiena, 2014. gada 17. marts

Mans jaunais Windows consoles aizstājējs.

Ilgu laiku esmu bijis uzticīgs http://sourceforge.net/projects/console/ lietotājs.
Tagad atklāju sev http://sourceforge.net/projects/conemu/ vairāk fīču un mazāk bugu. Iesaku.


svētdiena, 2014. gada 16. marts

Vakardien sev atklāju - KeyStore Explorer

Izrādās šis ir baigi labais toolis lai strādātu ar Java keystore.

http://keystore-explorer.sourceforge.net/

trešdiena, 2014. gada 29. janvāris

Play with Windows command line

Today I decided to automate my desktop operations. I would like to start apps just by typing short names of it. One of the many shortcuts I made was shortcut "ji" to open in chrome my JIRA main page I use day by day. That was done by making ji.cmd file in path like this:

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" chrome:\\newtab _your_jira_link_

So after this to start jira I just have to type ji in console... nice :)