diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-12-23 20:59:17 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-12-23 21:02:14 +0200 |
commit | 3b37ff77b0c7d7613657b9514e7350c444f79bb0 (patch) | |
tree | 866928fd1b4c69595437256359605f5601d10e46 | |
parent | e704e440ee06c2e29845fdb8b428556cfe347665 (diff) | |
download | gitlab-ci-3b37ff77b0c7d7613657b9514e7350c444f79bb0.tar.gz |
Improve installation docs. Create own user for ci. User rvm instead of native ruby. Use nginx and init.d scripts
-rw-r--r-- | README.md | 110 | ||||
-rw-r--r-- | doc/README_FOR_APP | 2 | ||||
-rw-r--r-- | doc/installation.md | 128 |
3 files changed, 129 insertions, 111 deletions
@@ -16,112 +16,4 @@ We officially support (recent versions of) these Linux distributions: __We recommend to use server with at least 756MB RAM for gitlab-ci instance.__ -# Setup: - -## 1. Required packages: - - sudo apt-get update - sudo apt-get upgrade - - sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev openssh-server git-core libyaml-dev postfix libpq-dev - sudo apt-get install redis-server - -## 2. Install Ruby - - wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz - tar xfvz ruby-1.9.3-p194.tar.gz - cd ruby-1.9.3-p194 - ./configure - make - sudo make install - - -## 3. Prepare MySQL - - sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev - - # Login to MySQL - $ mysql -u root -p - - # Create the GitLab CI database - mysql> CREATE DATABASE IF NOT EXISTS `gitlab_ci_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; - - # Create the MySQL User change $password to a real password - mysql> CREATE USER 'gitlab_ci'@'localhost' IDENTIFIED BY '$password'; - - # Grant proper permissions to the MySQL User - mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlab_ci_production`.* TO 'gitlab_ci'@'localhost'; - -## 4. Get code - - git clone https://github.com/gitlabhq/gitlab-ci.git - - -## 5. Setup application - - - # Install dependencies - # - sudo gem install bundler - bundle - - # Copy mysql db config - # - # make sure to update username/password in config/database.yml - # - cp config/database.yml.mysql config/database.yml - - # Setup DB - # - bundle exec rake db:setup RAILS_ENV=production - - -## 6. Run - - # For development - bundle exec foreman start -p 3000 - - # For production - bundle exec thin start -p 3000 -d -e production - bundle exec rake environment resque:work RAILS_ENV=production PIDFILE=./resque.pid BACKGROUND=yes QUEUE=runner - - -## 7. Login - - admin@local.host # email - 5iveL!fe # password - -## 8. Nginx - - -Setup nginx - - sudo apt-get install nginx - sudo vim /etc/nginx/sites-enabled/gitlab_ci - - -Add config - - upstream gitlab_ci { - server 127.0.0.1:3000; - } - - server { - listen 80; - server_name ci.gitlabhq.com; - - root /home/gitlab_ci/gitlab-ci/public; - try_files $uri $uri/index.html $uri.html @gitlab_ci; - - location @gitlab_ci { - # auth_basic "Private Zone"; - # auth_basic_user_file htpasswd; - - proxy_set_header Host $host:$server_port; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Sendfile-Type X-Accel-Redirect; - - proxy_pass http://gitlab_ci; - } - } - +Check out doc/installation.md for setup instructions diff --git a/doc/README_FOR_APP b/doc/README_FOR_APP deleted file mode 100644 index fe41f5c..0000000 --- a/doc/README_FOR_APP +++ /dev/null @@ -1,2 +0,0 @@ -Use this README file to introduce your application and point to useful places in the API for learning more. -Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. diff --git a/doc/installation.md b/doc/installation.md new file mode 100644 index 0000000..785edeb --- /dev/null +++ b/doc/installation.md @@ -0,0 +1,128 @@ +# Setup: + +Create a user for GitLab: + + sudo adduser --disabled-login --gecos 'GitLab CI' gitlab_ci + + +## 1. Required packages: + + sudo apt-get update + sudo apt-get upgrade + + sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev openssh-server git-core libyaml-dev postfix libpq-dev + sudo apt-get install redis-server + +## 2. Install Ruby (RVM) for gitlab_ci + + sudo su gitlab_ci + + \curl -L https://get.rvm.io | bash -s stable --ruby + + + +## 3. Prepare MySQL + + sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev + + # Login to MySQL + $ mysql -u root -p + + # Create the GitLab CI database + mysql> CREATE DATABASE IF NOT EXISTS `gitlab_ci_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; + + # Create the MySQL User change $password to a real password + mysql> CREATE USER 'gitlab_ci'@'localhost' IDENTIFIED BY '$password'; + + # Grant proper permissions to the MySQL User + mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlab_ci_production`.* TO 'gitlab_ci'@'localhost'; + +## 4. Get code + + cd /home/gitlab_ci/ + + sudo -u gitlab_ci -H git clone https://github.com/gitlabhq/gitlab-ci.git + + +## 5. Setup application + + cd gitlab_ci + + # Install dependencies + # + sudo -u gitlab_ci -H gem install bundler + + sudo -u gitlab_ci -H bundle + + # Copy mysql db config + # + # make sure to update username/password in config/database.yml + # + sudo -u gitlab_ci -H cp config/database.yml.mysql config/database.yml + + # Setup DB + # + sudo -u gitlab_ci -H bundle exec rake db:setup RAILS_ENV=production + + +## 6. Install Init Script + +Download the init script (will be /etc/init.d/gitlab_ci): + + sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/gitlab-ci/init.d/gitlab_ci -P /etc/init.d/ + sudo chmod +x /etc/init.d/gitlab_ci + +Make GitLab start on boot: + + sudo update-rc.d gitlab_ci defaults 21 + + +Start your GitLab instance: + + sudo service gitlab_ci start + # or + sudo /etc/init.d/gitlab_ci restart + + +# 7. Nginx + +**Note:** +If you can't or don't want to use Nginx as your web server, have a look at the +"Advanced Setup Tips" section. + +## Installation + sudo apt-get install nginx + +## Site Configuration + +Download an example site config: + + sudo wget https://raw.github.com/gitlabhq/gitlab-recipes/master/gitlab-ci/nginx/gitlab_ci -P /etc/nginx/sites-available/ + sudo ln -s /etc/nginx/sites-available/gitlab_ci /etc/nginx/sites-enabled/gitlab_ci + +Make sure to edit the config file to match your setup: + + # Change **YOUR_SERVER_IP** and **YOUR_SERVER_FQDN** + # to the IP address and fully-qualified domain name + # of your host serving GitLab CI + sudo vim /etc/nginx/sites-enabled/gitlab_ci + +## Restart + + sudo /etc/init.d/nginx restart + + +# Done! + + +Visit YOUR_SERVER for your first GitLab CI login. +The setup has created an admin account for you. You can use it to log in: + + admin@local.host + 5iveL!fe + +**Important Note:** +Please go over to your profile page and immediately chage the password, so +nobody can access your GitLab CI by using this login information later on. + +**Enjoy!** |