Wednesday, May 11, 2016

GIT create new branch

If you like the method in the link you've posted, have a look at Git Flow.

It's a set of scripts he created for that workflow.

But to answer your question:
$ git checkout -b myFeature dev
Creates MyFeature branch off dev. Do your work and then
$ git commit -am "Your message"
Now merge your changes to dev without a fast-forward
$ git checkout dev
$ git merge --no-ff myFeature

Now push changes to the server
$ git push origin dev
$ git push origin myFeature
Refs http://stackoverflow.com/questions/4470523/git-create-a-branch-from-another-branch

Thursday, December 11, 2014

SSH

$ ssh-keygen -t rsa -C "your_email@example.com"
# Creates a new ssh key, using the provided email as a label
# Generating public/private rsa key pair.
Enter file in which to save the key (/home/you/.ssh/id_rsa):
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]

Embedding password into key file
$ openssl rsa < id_rsa > id_rsa_withpass
Enter pass phrase:************
writing RSA key

useradd tai
passwd -u -f tai
usermod -g wheel tai
mkdir /home/tai/.ssh
mv authorized_keys /home/tai/.ssh/
chown tai:tai /home/tai/.ssh
chown tai:tai /home/tai/.ssh/authorized_keys
chmod 700 /home/tai/.ssh
chmod 600 /home/tai/.ssh/authorized_keys
sudo visudo

Tuesday, September 30, 2014

Virtualhost for Apache 2.4

VirtualHost *:80>
        DocumentRoot /your_path
        ServerName domain.local.com
        # ErrorLog /var/log/apache2/error.log
        <Directory /your_path>
                Options All +Indexes +FollowSymLinks
                 AllowOverride All
                 Order allow,deny
                 Allow from all
                 Require local
        </Directory>
</VirtualHost>

Sunday, July 13, 2014

Install Apache + PHP + Mysql

Update your respository before installing these
$ sudo apt-get update

Install Apache
$ sudo apt-get install apache2

Install PHP
$ sudo apt-get install php5

Install Apache
$ sudo apt-get install mysql-server

Install phpmyadmin
$ sudo apt-get install phpmyadmin

Wednesday, May 7, 2014

Basic GIT commands

clone a new project from a repository on Server
$ git clone //server_path

Show the information on repository in local
$ git remote show origin

Show the branch information
$ git branch

Show list of the configuration
$ git config -l

Switch to a branch
$ git checkout <branch_name>

Push to another branch on Server
$ git push origin local_branch:server_branch

Update latest commit
$ git pull

Edit latest comment
$ git commit --amend -m "New commit message"

Show all version
$ git log

Show current version
$ git show

Delete latest commit
$ git reset --soft 'HEAD^'

Revert latest commit
$ git reset --hard HEAD

Fix error "The following untracked working tree files would be overwritten by merge"
Use -n or --dry-run to preview the damage you'll do.
$ git clean -n
$ git clear -n <file_path> To create a "feature branch" from the dev branch $ git checkout -b myfeature dev Delete a branch $ git branch -d myfeature

Wednesday, January 1, 2014

How to: Ruby on Rails + Ubuntu + Apache with Passenger

Now you can use gem to install Rails:

sudo gem install rails


Install Phusion Passenger (an Apache module that lets you run Rails apps easily):

sudo gem install passenger

sudo passenger-install-apache2-module


The passenger-install-apache2-module script will guide you through what you need to do to get Passenger working. It should tell you to copy these lines into your /etc/apache2/apache2.conf:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2/ext/apache2/mod_passenger.so

PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.2

PassengerRuby /usr/bin/ruby1.8


Create a file in /etc/apache2/sites-available/ for your site (something like 'irorio.local.jp') and insert this:
<VirtualHost *:80>
        alias /iapps /home/taind/svn/branch/irorio/irorio-api/public
        ServerName irorio.local.jp
        DocumentRoot /home/taind/svn/branch/irorio/irorio
        DirectoryIndex index.php
        SetEnv APPLICATION_ENV development
        <Directory /home/taind/svn/branch/irorio/irori>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        <Location /iapps>
                PassengerBaseURI /iapps
                PassengerAppRoot /home/taind/svn/branch/irorio/irorio-api
        </Location>
        <Directory /home/taind/svn/branch/irorio/irorio-api/public>
                Options -MultiViews
                Allow from all
        </Directory>
        RailsEnv development
        #RailsBaseURI /iapps
</VirtualHost>

Sunday, November 3, 2013

How To Create a SSL Certificate on nginx for Ubuntu 12.04

Step One—Create a Directory for the Certificate
The SSL certificate has 2 parts main parts: the certificate itself and the public key. To make all of the relevant files easy to access, we should create a directory to store them in:
sudo mkdir /etc/nginx/ssl

We will perform the next few steps within the directory:
cd /etc/nginx/ssl


Step Two—Create the Server Key and Certificate Signing Request
Start by creating the private server key. During this process, you will be asked to enter a specific passphrase. Be sure to note this phrase carefully, if you forget it or lose it, you will not be able to access the certificate.
sudo openssl genrsa -des3 -out server.key 1024

Follow up by creating a certificate signing request:
sudo openssl req -new -key server.key -out server.csr

This command will prompt terminal to display a lists of fields that need to be filled in.

The most important line is "Common Name". Enter your official domain name here or, if you don't have one yet, your site's IP address. Leave the challenge password and optional company name blank.

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New York
Locality Name (eg, city) []:NYC
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Awesome Inc
Organizational Unit Name (eg, section) []:Dept of Merriment
Common Name (e.g. server FQDN or YOUR name) []:example.com                 
Email Address []:webmaster@awesomeinc.com


Step Three—Remove the Passphrase
We are almost finished creating the certificate. However, it would serve us to remove the passphrase. Although having the passphrase in place does provide heightened security, the issue starts when one tries to reload nginx. In the event that nginx crashes or needs to reboot, you will always have to re-enter your passphrase to get your entire web server back online.


Use this command to remove the password:
sudo cp server.key server.key.org

sudo openssl rsa -in server.key.org -out server.key


Step Four— Sign your SSL Certificate
Your certificate is all but done, and you just have to sign it.


Keep in mind that you can specify how long the certificate should remain valid by changing the 365 to the number of days you prefer. As it stands this certificate will expire after one year.
sudo openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

You are now done making your certificate.

Step Five—Set Up the Certificate

Now we have all of the required components of the finished certificate.The next thing to do is to set up the virtual hosts to display the new certificate.
Let's create new file with the same default text and layout as the standard virtual host file. You can replace "example" in the command with whatever name you prefer:
sudo nano /etc/nginx/sites-available/example

Scroll down to the bottom of the file and find the section that begins with this:
# HTTPS server
server {
  listen 443;
  server_name example.com;

  root /usr/share/nginx/www;
  index index.html index.htm;
  
  ssl on;
  ssl_certificate /etc/nginx/ssl/server.crt;
  ssl_certificate_key /etc/nginx/ssl/server.key;
}
sudo service nginx restart

Refs https://www.digitalocean.com/community/articles/how-to-create-a-ssl-certificate-on-nginx-for-ubuntu-12-04