Commit 9b4ec1d6 authored by ogom's avatar ogom

Implemented mysql

parent 41944dce
......@@ -3,14 +3,14 @@ GitLab Cookbook
Chef to install The GitLab.
* GitLab: 5.2.1
* GitLab: 5.3.0
* GitLab Shell: 1.5.0
* Ruby: 1.9.3
* Redis: 2.6.13
* Git: 1.7.12
* Nginx: 1.1.19
* PostgreSQL: 9.1.9
* MySQL ... Not implemented yet
* MySQL: 5.5.31
## Requirements
......@@ -116,12 +116,19 @@ Example of node config.
"postgres": "psqlpass"
}
},
"mysql": {
"server_root_password": "rootpass",
"server_repl_password": "replpass",
"server_debian_password": "debianpass"
},
"gitlab": {
"host": "example.com",
"url": "http://example.com/",
"email_from": "gitlab@example.com",
"support_email": "support@example.com",
"database_password": "datapass"
"database_adapter": "postgresql",
"database_password": "datapass",
"bundle_without": "development test mysql"
},
"run_list":[
"postfix",
......@@ -131,6 +138,18 @@ Example of node config.
}
```
Database use mysql.
```json
{
"gitlab": {
"database_adapter": "mysql",
"database_password": "datapass",
"bundle_without": "development test postgres"
}
}
```
## Done!
......
......@@ -81,8 +81,15 @@ Vagrant.configure("2") do |config|
:postgres => "psqlpass"
}
},
:mysql => {
:server_root_password => "rootpass",
:server_repl_password => "replpass",
:server_debian_password => "debianpass"
},
:gitlab => {
:database_password => "datapass"
:database_adapter => "postgresql",
:database_password => "datapass",
:bundle_without => "development test mysql"
}
}
chef.run_list = [
......
......@@ -17,7 +17,7 @@ default['gitlab']['shell_path'] = "/home/git/gitlab-shell"
# GitLab hq
default['gitlab']['repository'] = "git://github.com/gitlabhq/gitlabhq.git"
default['gitlab']['revision'] = "v5.2.1"
default['gitlab']['revision'] = "v5.3.0"
default['gitlab']['path'] = "/home/git/gitlab"
# GitLab shell config
......@@ -36,6 +36,6 @@ default['gitlab']['port'] = "80"
default['gitlab']['email_from'] = "gitlab@localhost"
default['gitlab']['support_email'] = "support@localhost"
# Gems
default['gitlab']['bundle_install'] = "bundle install --path=.bundle --deployment --without development test mysql"
default['gitlab']['bundle_install'] = "bundle install --path=.bundle --deployment"
default['gitlab']['bundle_without'] = "development test"
......@@ -35,12 +35,19 @@ Vagrant.configure("2") do |config|
:postgres => "psqlpass"
}
},
:mysql => {
:server_root_password => "rootpass",
:server_repl_password => "replpass",
:server_debian_password => "debianpass"
},
:gitlab => {
:host => "example.com",
:url => "http://example.com/",
:email_from => "gitlab@example.com",
:support_email => "support@example.com",
:database_password => "datapass"
:database_adapter => "postgresql",
:database_password => "datapass",
:bundle_without => "development test mysql"
}
}
chef.run_list = [
......
......@@ -4,12 +4,12 @@ maintainer_email 'ogom@outlook.com'
license 'MIT'
description 'Installs/Configures GitLab'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.2'
version '0.2.0'
recipe "gitlab::initial", "Setting the initial"
recipe "gitlab::install", "Installation"
%w{redisio ruby_build postgresql database postfix}.each do |dep|
%w{redisio ruby_build postgresql mysql database postfix}.each do |dep|
depends dep
end
......
#
# Cookbook Name:: gitlab
# Recipe:: database_mysql
#
mysql = node['mysql']
gitlab = node['gitlab']
# 5.Database
include_recipe "mysql::server"
include_recipe "database::mysql"
mysql_connexion = {
:host => 'localhost',
:username => 'root',
:password => mysql['server_root_password']
}
## Create a user for GitLab.
mysql_database_user gitlab['user'] do
connection mysql_connexion
password gitlab['database_password']
action :create
end
## Create the GitLab production database & grant all privileges on database
mysql_database "gitlabhq_production" do
connection mysql_connexion
action :create
end
mysql_database_user gitlab['user'] do
connection mysql_connexion
password gitlab['database_password']
database_name "gitlabhq_production"
host 'localhost'
privileges [:select, :update, :insert, :delete, :create, :drop, :index, :alter]
action :grant
end
#
# Cookbook Name:: gitlab
# Recipe:: database
# Recipe:: database_postgresql
#
postgresql = node['postgresql']
......
......@@ -78,7 +78,10 @@ end
### Configure Git global settings for git user, useful when editing via web
bash "git config" do
code 'git config --global user.name "GitLab" && git config --global user.email "gitlab@localhost"'
code <<-EOS
git config --global user.name "GitLab"
git config --global user.email "#{gitlab['user']}@#{gitlab['host']}"
EOS
user gitlab['user']
group gitlab['group']
environment('HOME' => gitlab['home'])
......@@ -86,10 +89,11 @@ end
## Configure GitLab DB settings
template File.join(gitlab['path'], "config", "database.yml") do
source "database.yml.erb"
source "database.yml.#{gitlab['database_adapter']}.erb"
user gitlab['user']
group gitlab['group']
variables({
:user => gitlab['user'],
:password => gitlab['database_password']
})
end
......@@ -108,7 +112,7 @@ template File.join(gitlab['home'], ".gemrc") do
end
execute "bundle install" do
command "sudo -u #{gitlab['user']} -H #{gitlab['bundle_install']}"
command "sudo -u #{gitlab['user']} -H #{gitlab['bundle_install']} --without #{gitlab['bundle_without']}"
cwd gitlab['path']
action :nothing
end
......
......@@ -3,7 +3,9 @@
# Recipe:: install
#
gitlab = node['gitlab']
include_recipe "gitlab::gitlab_shell"
include_recipe "gitlab::database"
include_recipe "gitlab::database_#{gitlab['database_adapter']}"
include_recipe "gitlab::gitlab"
include_recipe "gitlab::nginx"
#
# PRODUCTION
#
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 10
username: <%= @user %>
password: <%= @password %>
# host: localhost
# socket: /tmp/mysql.sock
#
# Development specific
#
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_development
pool: 5
username: root
password: <%= @password %>
# socket: /tmp/mysql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test: &test
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_test
pool: 5
username: root
password: <%= @password %>
# socket: /tmp/mysql.sock
......@@ -6,7 +6,7 @@ production:
encoding: unicode
database: gitlabhq_production
pool: 5
username: git
username: <%= @user %>
password: <%= @password %>
# host: localhost
# port: 5432
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment