Git iterate live

From Origami_Wiki
Jump to navigation Jump to search

The following commands are executed in Iterate staging server for setting up the application in Git.



1. Installed git in the server.

   $apt-get update 
$apt-get install git

2. Switched to the iterftp user and created a new ssh key pair.

   $su iterftp 
$ssh-keygen -t rsa
(and finish the wizard with default values)
Copy the contents of id_rsa.pub to the ssh keys section in github.

3. Cloned the repo into a new folder in the server.

   $cd /var/www/docroot/ 
$git init
$git remote add origin git@github.com:IterateAI/IterateWeb.git
$git remote set-url origin git@github.com:IterateAI/IterateWeb.git
$git clone git@github.com:IterateAI/IterateWeb.git

4. Created the "tmp" folder and its subfolders within the "app" folder.
5. Copied the database.php file from current installation to the new one.
6. Copied the "webroot/config_constant.php" file from the current installation to new one.
7. Copied the .htaccess files from the document root, "app" folder and "webroot" folder into the corresponding folders in the new setup.
8. Edited the apache virtualhost and changed the document root to point to the new installation.
9. Restarted apache.



Now, for pulling the latest changes to the server, follow the steps below.
ssh root@216.70.112.197
Provide password, login and do the following commands.
su iterftp
cd /var/www/docroot/IterateWeb/
git pull
That's it. All latest updates should be available in server now.



The following steps are performed in the production server.
1. su iteruser
Note that the home directory of this user is : /var/www/html/
2. Now create a ssh key for the user.

ssh-keygen -t rsa 

(Do not provide any passphrase)
The key files should be created in /var/www/html/ by default.
3. Now clone the repo to "/var/www", so that we can rename it to "html" later.

git init 
git remote add origin git@github.com:IterateAI/IterateWeb.git
git remote set-url origin git@github.com:IterateAI/IterateWeb.git
git clone

4. There will be a folder called "IterateWeb" in www folder now. Rename this folder to "html" (Before that, rename the current html to something else)

mv html html-bak 
mv IterateWeb html

5. Copy the ssh key folder to current "html" folder.

cd /var/www/html-bak/ 
cp -r .ssh /var/www/html/

6. Created the "tmp" folder and its subfolders within the "app" folder.
7. Copied the database.php file from current installation to the new one.
8. Copied the "webroot/config_constant.php" file from the current installation to new one.
9. Copied the .htaccess files from the document root, "app" folder and "webroot" folder into the corresponding folders in the new setup.



Now for pulling the latest changes to the server, follow these steps:
1. su iteruser
2. cd /var/www/html/
3. git pull
That's it. All changes should be up to date now.



If there are conflicts when pulling in the server, we can use the following commands to resolve (depending on the exact conflict error) Best to check git documentation before executing.

git fetch 
git reset --hard origin/master