commit
2d2ffc6f5c
|
@ -1,4 +1,5 @@
|
||||||
env:
|
env:
|
||||||
|
- DB=postgresql
|
||||||
- DB=mysql
|
- DB=mysql
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get install libicu-dev -y
|
- sudo apt-get install libicu-dev -y
|
||||||
|
@ -11,6 +12,7 @@ rvm:
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
services:
|
services:
|
||||||
- mysql
|
- mysql
|
||||||
|
- postgresql
|
||||||
before_script:
|
before_script:
|
||||||
- "cp config/database.yml.$DB config/database.yml"
|
- "cp config/database.yml.$DB config/database.yml"
|
||||||
- "cp config/gitlab.yml.example config/gitlab.yml"
|
- "cp config/gitlab.yml.example config/gitlab.yml"
|
||||||
|
|
5
Gemfile
5
Gemfile
|
@ -11,8 +11,9 @@ end
|
||||||
gem "rails", "3.2.8"
|
gem "rails", "3.2.8"
|
||||||
|
|
||||||
# Supported DBs
|
# Supported DBs
|
||||||
gem "sqlite3"
|
gem "sqlite3", :group => :sqlite
|
||||||
gem "mysql2"
|
gem "mysql2", :group => :mysql
|
||||||
|
gem "pg", :group => :postgres
|
||||||
|
|
||||||
# Auth
|
# Auth
|
||||||
gem "devise", "~> 2.1.0"
|
gem "devise", "~> 2.1.0"
|
||||||
|
|
|
@ -245,6 +245,7 @@ GEM
|
||||||
multi_json (~> 1.3)
|
multi_json (~> 1.3)
|
||||||
omniauth-oauth (~> 1.0)
|
omniauth-oauth (~> 1.0)
|
||||||
orm_adapter (0.3.0)
|
orm_adapter (0.3.0)
|
||||||
|
pg (0.14.0)
|
||||||
polyglot (0.3.3)
|
polyglot (0.3.3)
|
||||||
posix-spawn (0.3.6)
|
posix-spawn (0.3.6)
|
||||||
pry (0.9.9.6)
|
pry (0.9.9.6)
|
||||||
|
@ -441,6 +442,7 @@ DEPENDENCIES
|
||||||
omniauth-google-oauth2
|
omniauth-google-oauth2
|
||||||
omniauth-ldap!
|
omniauth-ldap!
|
||||||
omniauth-twitter
|
omniauth-twitter
|
||||||
|
pg
|
||||||
pry
|
pry
|
||||||
pygments.rb (= 0.3.1)
|
pygments.rb (= 0.3.1)
|
||||||
rack-mini-profiler
|
rack-mini-profiler
|
||||||
|
|
48
config/database.yml.postgresql
Normal file
48
config/database.yml.postgresql
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#
|
||||||
|
# PRODUCTION
|
||||||
|
#
|
||||||
|
production:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: gitlabhq_production
|
||||||
|
pool: 5
|
||||||
|
username: postgres
|
||||||
|
password:
|
||||||
|
# host: localhost
|
||||||
|
# socket: /tmp/postgresql.sock
|
||||||
|
|
||||||
|
#
|
||||||
|
# Development specific
|
||||||
|
#
|
||||||
|
development:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: gitlabhq_development
|
||||||
|
pool: 5
|
||||||
|
username: postgres
|
||||||
|
password:
|
||||||
|
# socket: /tmp/postgresql.sock
|
||||||
|
|
||||||
|
#
|
||||||
|
# Staging specific
|
||||||
|
#
|
||||||
|
staging:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: gitlabhq_staging
|
||||||
|
pool: 5
|
||||||
|
username: postgres
|
||||||
|
password:
|
||||||
|
# socket: /tmp/postgresql.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: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
database: gitlabhq_test
|
||||||
|
pool: 5
|
||||||
|
username: postgres
|
||||||
|
password:
|
||||||
|
# socket: /tmp/postgresql.sock
|
26
config/initializers/postgresql_limit_fix.rb
Normal file
26
config/initializers/postgresql_limit_fix.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
if defined?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
||||||
|
class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
||||||
|
class TableDefinition
|
||||||
|
def text(*args)
|
||||||
|
options = args.extract_options!
|
||||||
|
options.delete(:limit)
|
||||||
|
column_names = args
|
||||||
|
type = :text
|
||||||
|
column_names.each { |name| column(name, type, options) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_column_with_limit_filter(table_name, column_name, type, options = {})
|
||||||
|
options.delete(:limit) if type == :text
|
||||||
|
add_column_without_limit_filter(table_name, column_name, type, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
def change_column_with_limit_filter(table_name, column_name, type, options = {})
|
||||||
|
options.delete(:limit) if type == :text
|
||||||
|
change_column_without_limit_filter(table_name, column_name, type, options)
|
||||||
|
end
|
||||||
|
|
||||||
|
alias_method_chain :add_column, :limit_filter
|
||||||
|
alias_method_chain :change_column, :limit_filter
|
||||||
|
end
|
||||||
|
end
|
15
db/migrate/20121009205010_postgres_create_integer_cast.rb
Normal file
15
db/migrate/20121009205010_postgres_create_integer_cast.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class PostgresCreateIntegerCast < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
execute <<-SQL
|
||||||
|
CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;
|
||||||
|
SQL
|
||||||
|
rescue ActiveRecord::StatementInvalid
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
execute <<-SQL
|
||||||
|
DROP CAST (integer AS text);
|
||||||
|
SQL
|
||||||
|
rescue ActiveRecord::StatementInvalid
|
||||||
|
end
|
||||||
|
end
|
|
@ -75,6 +75,9 @@ Now install the required packages:
|
||||||
# If you want to use MySQL:
|
# If you want to use MySQL:
|
||||||
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
|
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
|
||||||
|
|
||||||
|
# If you want to use PostgreSQL:
|
||||||
|
sudo apt-get install -y postgresql-9.2 postgresql-server-dev-9.2
|
||||||
|
|
||||||
# 2. Install Ruby
|
# 2. Install Ruby
|
||||||
|
|
||||||
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
|
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
|
||||||
|
@ -188,9 +191,45 @@ and ensure you have followed all of the above steps carefully.
|
||||||
# Exit MySQL Server and copy the example config, make sure to update username/password in config/database.yml
|
# Exit MySQL Server and copy the example config, make sure to update username/password in config/database.yml
|
||||||
sudo -u gitlab cp config/database.yml.example config/database.yml
|
sudo -u gitlab cp config/database.yml.example config/database.yml
|
||||||
|
|
||||||
|
# Or
|
||||||
|
# PostgreSQL
|
||||||
|
# Install PostgreSQL as directed in Step #1
|
||||||
|
|
||||||
|
# Connect to database server
|
||||||
|
sudo -u postgres psql -d template1
|
||||||
|
|
||||||
|
# Add a user called gitlab. Change $password to a real password
|
||||||
|
template1=# CREATE USER gitlab WITH PASSWORD '$password';
|
||||||
|
|
||||||
|
# Create the GitLab production database
|
||||||
|
template1=# CREATE DATABASE IF NOT EXISTS gitlabhq_production;
|
||||||
|
|
||||||
|
# Grant all privileges on database
|
||||||
|
template1=# GRANT ALL PRIVILEGES ON DATABASE gitlabhq_production to gitlab;
|
||||||
|
|
||||||
|
# Quit from PostgreSQL server
|
||||||
|
template1=# \q
|
||||||
|
|
||||||
|
# Try connect to new database
|
||||||
|
$ su - gitlab
|
||||||
|
$ psql -d gitlabhq_production -U gitlab
|
||||||
|
|
||||||
|
# Exit PostgreSQL Server and copy the example config, make sure to update username/password in config/database.yml
|
||||||
|
sudo -u gitlab cp config/database.yml.postgres config/database.yml
|
||||||
|
|
||||||
|
# If you need create development, test, staging or another database
|
||||||
|
# Repeate some steps with actual commands
|
||||||
|
|
||||||
#### Install gems
|
#### Install gems
|
||||||
|
|
||||||
sudo -u gitlab -H bundle install --without development test --deployment
|
# Please, check Gemfile before run bundle install
|
||||||
|
# Select database gem, wich you will use
|
||||||
|
# or run to setup gems with mysql usage
|
||||||
|
sudo -u gitlab -H bundle install --without development test sqlite postgres --deployment
|
||||||
|
# or postgres
|
||||||
|
sudo -u gitlab -H bundle install --without development test sqlite mysql --deployment
|
||||||
|
# or sqlite
|
||||||
|
sudo -u gitlab -H bundle install --without development test mysql postgres --deployment
|
||||||
|
|
||||||
#### Setup database
|
#### Setup database
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue