Revisions
-
sanand0 revised this gist
Jun 28, 2014 . 2 changed files with 48 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ # Gitlab 5.1: https://github.com/gitlabhq/gitlabhq/blob/5-1-stable/doc/install/installation.md # Set up an AWS EC2 Ubuntu 12.04 LTS Server. # Use ap-southeast-1b: spot pricing is smoother @@ -52,19 +52,11 @@ echo mysql-server mysql-server/root_password_again password $password | sudo deb sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev # Login to MySQL mysql -u root -p <<EOF CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; CREATE DATABASE IF NOT EXISTS \`gitlabhq_production\` DEFAULT CHARACTER SET \`utf8\` COLLATE \`utf8_unicode_ci\`; GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON \`gitlabhq_production\`.* TO 'gitlab'@'localhost'; EOF # Try connecting to the new database with the new user sudo -u git -H mysql -u gitlab -p -D gitlabhq_production @@ -126,7 +118,7 @@ sudo -u git -H bundle install --deployment --without development test postgres sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # Download the init script (will be /etc/init.d/gitlab): sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/init.d/gitlab sudo chmod +x /etc/init.d/gitlab # Make GitLab start on boot: @@ -157,11 +149,11 @@ sudo service gitlab start # ------------ sudo apt-get -y install nginx sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/5-1-stable/nginx/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab sudo sed -i 's/YOUR_SERVER_IP/'`wget -qO- http://instance-data/latest/meta-data/local-ipv4`'/' /etc/nginx/sites-available/gitlab sudo sed -i 's/YOUR_SERVER_FQDN/ec2-54-251-228-123.ap-southeast-1.compute.amazonaws.com/' /etc/nginx/sites-available/gitlab sudo service nginx restart @@ -171,14 +163,6 @@ echo "Host localhost StrictHostKeyChecking no UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config # In case gitlab crashes, you may need to delete # /home/git/gitlab/tmp/sockets/gitlab.socket before restarting it. # After restarting, the first request takes a long time. Relax. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ # Gitlab 7.0: # Set up an AWS EC2 Ubuntu 14.04 LTS Server. # Use ap-southeast-1b: spot pricing is smoother. Use an odd high value like $11 # m3.medium with web-server security group (SSH, SMTP, HTTP/S) # Storage: 60GB SSD that *does not delete on termination* # Tag as Gitlab 7 # Log in as ubuntu@ sudo apt-get -y update sudo apt-get -y upgrade wget https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab_7.0.0-omnibus-1_amd64.deb sudo apt-get install openssh-server # 'Internet Site' # System mail name: gitlab. Do not use gramener.com # Ensure that /etc/postfix/main.cf does not have gramener.com sudo apt-get install postfix sudo dpkg -i gitlab_7.0.0-omnibus-1_amd64.deb # Edit the configuration file to add your hostname sudo edit /etc/gitlab/gitlab.rb # Install and start Gitlab sudo gitlab-ctl reconfigure # Browse to the hostname and login # Username: root # Password: 5iveL!fe # See https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md # To connect to the PostgreSQL database sudo -u gitlab-psql /opt/gitlab/embedded/bin/psql -d gitlabhq_production -
sanand0 revised this gist
Jun 1, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ sudo apt-get -y update sudo apt-get -y upgrade # Install the required packages. # For Postfix, select options: Internet > gitlab. Ensure that /etc/postfix/main.cf does not have gramener.com sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server postfix checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev # Install Ruby -
sanand0 revised this gist
Jun 1, 2013 . 1 changed file with 20 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ # Gitlab 5.1: https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md # Set up an AWS EC2 Ubuntu 12.04 LTS Server. # Use ap-southeast-1b: spot pricing is smoother # Log in as ubuntu@ sudo apt-get -y update @@ -41,16 +41,13 @@ sudo su -l git -c "cd /home/git/gitlab-shell && ./bin/install" # MySQL # ----- password=somerandompassword echo mysql-server mysql-server/root_password password $password | sudo debconf-set-selections echo mysql-server mysql-server/root_password_again password $password | sudo debconf-set-selections # To reset password # sudo dpkg-reconfigure mysql-server-5.5 # Install the database packages sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev @@ -63,8 +60,8 @@ mysql -u root -p # Create the GitLab production database mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; # Grant the GitLab user necessary permissions on the table. mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; # Quit the database session mysql> \q @@ -118,7 +115,7 @@ sudo -u git -H cp config/puma.rb.example config/puma.rb # Mysql sudo -u git cp config/database.yml.mysql config/database.yml sudo -u git sed -i "s/username:.*/username: gitlab/" config/database.yml sudo -u git sed -i "s/password:.*/password: $password/" config/database.yml sudo gem install charlock_holmes --version '0.6.9' @@ -173,3 +170,15 @@ sudo service nginx restart echo "Host localhost StrictHostKeyChecking no UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config # Backup cd ~git/gitlab # If you get this: mysqldump: Got error: 1044: Access denied for user 'gitlab'@'localhost' to database 'gitlabhq_production' when using LOCK TABLES # Then use: mysql> GRANT LOCK TABLES ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; sudo -u git -H rake RAILS_ENV=production gitlab:backup:create # Restore. Make sure the filename only contains the timestamp, not the _gitlab_backup.tar sudo -u git -H rake RAILS_ENV=production gitlab:backup:restore BACKUP=/home/gitlab/gitlab/tmp/backups/20130125_11h35_1359131740 -
sanand0 revised this gist
May 17, 2013 . 1 changed file with 28 additions and 13 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,14 @@ # Gitlab setup # Based on https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md # Set up an AWS EC2 Ubuntu 12.04 LTS Server. # Log in as ubuntu@ sudo apt-get -y update sudo apt-get -y upgrade # Install the required packages. # For Postfix, select options: Internet > gramener.com sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server postfix checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev # Install Ruby @@ -28,7 +31,7 @@ sudo adduser --disabled-login --gecos 'GitLab' git # Clone gitlab shell and set up the config file sudo su -l git -c "cd /home/git && git clone https://github.com/gitlabhq/gitlab-shell.git" sudo su -l git -c "cd /home/git/gitlab-shell && git checkout v1.3.0 && cp config.yml.example config.yml" # Edit config and replace gitlab_url # with something like 'http://domain.com/' @@ -42,7 +45,7 @@ userPassword=somerandompassword echo mysql-server mysql-server/root_password password $userPassword | sudo debconf-set-selections echo mysql-server mysql-server/root_password_again password $userPassword | sudo debconf-set-selections # To reset password # sudo dpkg-reconfigure mysql-server-5.5 sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev @@ -79,7 +82,7 @@ sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab cd /home/git/gitlab # Checkout to stable release sudo -u git -H git checkout 5-1-stable # Copy the example GitLab config @@ -99,15 +102,18 @@ sudo chmod -R u+rwX tmp/ # Create directory for satellites sudo -u git -H mkdir /home/git/gitlab-satellites # Create directories for sockets/pids and make sure GitLab can write to them sudo -u git -H mkdir tmp/pids/ sudo -u git -H mkdir tmp/sockets/ sudo chmod -R u+rwX tmp/pids/ sudo chmod -R u+rwX tmp/sockets/ # Create public/uploads directory otherwise backup will fail sudo -u git -H mkdir public/uploads sudo chmod -R u+rwX public/uploads # Copy the example Puma config sudo -u git -H cp config/puma.rb.example config/puma.rb # Mysql sudo -u git cp config/database.yml.mysql config/database.yml @@ -119,16 +125,25 @@ sudo gem install charlock_holmes --version '0.6.9' # For MySQL (note, the option says "without") sudo -u git -H bundle install --deployment --without development test postgres # Initialise Database and Activate Advanced Features sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # Download the init script (will be /etc/init.d/gitlab): sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlabhq/master/lib/support/init.d/gitlab sudo chmod +x /etc/init.d/gitlab # Make GitLab start on boot: sudo update-rc.d gitlab defaults 21 # Git configured for git user? ... no # Try fixing it: sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.email "gitlab@gramener.com" # Run Sidekiq sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV=production # Check if GitLab and its environment are configured correctly: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production @@ -145,11 +160,11 @@ sudo service gitlab start # ------------ sudo apt-get -y install nginx sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlabhq/master/lib/support/nginx/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab sudo sed -i 's/YOUR_SERVER_IP/'`wget -qO- http://instance-data/latest/meta-data/local-ipv4`'/' /etc/nginx/sites-available/gitlab sudo sed -i 's/YOUR_SERVER_FQDN/ec2-175-41-180-155.ap-southeast-1.compute.amazonaws.com/' /etc/nginx/sites-available/gitlab sudo service nginx restart -
sanand0 renamed this gist
Apr 17, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
sanand0 created this gist
Apr 17, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,160 @@ # Gitlab setup # Set up an AWS EC2 Ubuntu 12.04 LTS Server. Then... sudo apt-get -y update sudo apt-get -y upgrade # Install the required packages. # For Postfix, set send mail from "gramener.com" sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server postfix checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev # Install Ruby # ------------ mkdir /tmp/ruby && cd /tmp/ruby curl --progress http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz | tar xz cd ruby-1.9.3-p327 ./configure make sudo make install # Install the bundler gem sudo gem install bundler # Gitlab Shell # ------------ # Create a git user for gitlab sudo adduser --disabled-login --gecos 'GitLab' git # Clone gitlab shell and set up the config file sudo su -l git -c "cd /home/git && git clone https://github.com/gitlabhq/gitlab-shell.git" sudo su -l git -c "cd /home/git/gitlab-shell && cp config.yml.example config.yml" # Edit config and replace gitlab_url # with something like 'http://domain.com/' sudo su -l git -c 'cd /home/git/gitlab-shell && sed -i "s/localhost/git.gramener.com/" config.yml' sudo su -l git -c "cd /home/git/gitlab-shell && ./bin/install" # MySQL # ----- userPassword=somerandompassword echo mysql-server mysql-server/root_password password $userPassword | sudo debconf-set-selections echo mysql-server mysql-server/root_password_again password $userPassword | sudo debconf-set-selections # Reset password # sudo dpkg-reconfigure mysql-server-5.5 sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev # Install the database packages sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev # Login to MySQL mysql -u root -p # Create a user for GitLab. (change $password to a real password) mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; # Create the GitLab production database mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; # Grant the GitLab user necessary permissopns on the table. mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; # Quit the database session mysql> \q # Try connecting to the new database with the new user sudo -u git -H mysql -u gitlab -p -D gitlabhq_production # We'll install GitLab into home directory of the user "git" cd /home/git # Clone GitLab repository sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab # Go to gitlab dir cd /home/git/gitlab # Checkout to stable release sudo -u git -H git checkout 5-0-stable # Copy the example GitLab config sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml # Make sure to change "localhost" to the fully-qualified domain name of your # host serving GitLab where necessary sudo -u git -H sed -i "s/localhost/git.gramener.com/" config/gitlab.yml sudo -u git -H sed -i "s/@git.gramener.com/@gramener.com/" config/gitlab.yml # Make sure GitLab can write to the log/ and tmp/ directories sudo chown -R git log/ sudo chown -R git tmp/ sudo chmod -R u+rwX log/ sudo chmod -R u+rwX tmp/ # Create directory for satellites sudo -u git -H mkdir /home/git/gitlab-satellites # Create directory for pids and make sure GitLab can write to it sudo -u git -H mkdir tmp/pids/ sudo chmod -R u+rwX tmp/pids/ # Copy the example Unicorn config sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb # Set timeout to 300s. https://github.com/gitlabhq/gitlabhq/issues/2668 sudo sed -i "s/timeout.*/timeout 300/" config/unicorn.rb # Mysql sudo -u git cp config/database.yml.mysql config/database.yml sudo -u git sed -i "s/username:.*/username: gitlab/" config/database.yml sudo -u git sed -i "s/password:.*/password: $userPassword/" config/database.yml sudo gem install charlock_holmes --version '0.6.9' # For MySQL (note, the option says "without") sudo -u git -H bundle install --deployment --without development test postgres sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # Download the init script (will be /etc/init.d/gitlab): sudo curl --output /etc/init.d/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/init.d/gitlab sudo chmod +x /etc/init.d/gitlab # Make GitLab start on boot: sudo update-rc.d gitlab defaults 21 # Check if GitLab and its environment are configured correctly: sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production # To make sure you didn't miss anything run a more thorough check with: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production # Start the service sudo service gitlab start # # or # sudo /etc/init.d/gitlab restart # Set up nginx # ------------ sudo apt-get -y install nginx sudo curl --output /etc/nginx/sites-available/gitlab https://raw.github.com/gitlabhq/gitlab-recipes/master/nginx/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab sudo sed -i 's/YOUR_SERVER_IP/'`wget -qO- http://instance-data/latest/meta-data/local-ipv4`'/' /etc/nginx/sites-available/gitlab sudo sed -i 's/YOUR_SERVER_FQDN/ec2-54-251-87-249.ap-southeast-1.compute.amazonaws.com/' /etc/nginx/sites-available/gitlab sudo service nginx restart # Prevent fingerprint prompt for localhost. echo "Host localhost StrictHostKeyChecking no UserKnownHostsFile=/dev/null" | sudo tee -a /etc/ssh/ssh_config