Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
2d2ffc6f
Commit
2d2ffc6f
authored
Oct 10, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1666 from zzet/feature/postgres
Postgresql
parents
dda852a0
8402bca7
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
136 additions
and
3 deletions
+136
-3
.travis.yml
.travis.yml
+2
-0
Gemfile
Gemfile
+3
-2
Gemfile.lock
Gemfile.lock
+2
-0
config/database.yml.postgresql
config/database.yml.postgresql
+48
-0
config/initializers/postgresql_limit_fix.rb
config/initializers/postgresql_limit_fix.rb
+26
-0
db/migrate/20121009205010_postgres_create_integer_cast.rb
db/migrate/20121009205010_postgres_create_integer_cast.rb
+15
-0
doc/installation.md
doc/installation.md
+40
-1
No files found.
.travis.yml
View file @
2d2ffc6f
env
:
-
DB=postgresql
-
DB=mysql
before_install
:
-
sudo apt-get install libicu-dev -y
...
...
@@ -11,6 +12,7 @@ rvm:
-
1.9.3
services
:
-
mysql
-
postgresql
before_script
:
-
"
cp
config/database.yml.$DB
config/database.yml"
-
"
cp
config/gitlab.yml.example
config/gitlab.yml"
...
...
Gemfile
View file @
2d2ffc6f
...
...
@@ -11,8 +11,9 @@ end
gem
"
rails
"
,
"3.2.8"
# Supported DBs
gem
"
sqlite3
"
gem
"
mysql2
"
gem
"
sqlite3
"
,
:group
=>
:sqlite
gem
"
mysql2
"
,
:group
=>
:mysql
gem
"
pg
"
,
:group
=>
:postgres
# Auth
gem
"
devise
"
,
"~> 2.1.0"
...
...
Gemfile.lock
View file @
2d2ffc6f
...
...
@@ -245,6 +245,7 @@ GEM
multi_json (~> 1.3)
omniauth-oauth (~> 1.0)
orm_adapter (0.3.0)
pg (0.14.0)
polyglot (0.3.3)
posix-spawn (0.3.6)
pry (0.9.9.6)
...
...
@@ -441,6 +442,7 @@ DEPENDENCIES
omniauth-google-oauth2
omniauth-ldap!
omniauth-twitter
pg
pry
pygments.rb (= 0.3.1)
rack-mini-profiler
...
...
config/database.yml.postgresql
0 → 100644
View file @
2d2ffc6f
#
# 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
config/initializers/postgresql_limit_fix.rb
0 → 100644
View file @
2d2ffc6f
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
db/migrate/20121009205010_postgres_create_integer_cast.rb
0 → 100644
View file @
2d2ffc6f
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
doc/installation.md
View file @
2d2ffc6f
...
...
@@ -75,6 +75,9 @@ Now install the required packages:
# If you want to use MySQL:
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
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
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
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment