Commit 37ff4945 authored by Arthur Del Esposte's avatar Arthur Del Esposte 🤘🏻
Browse files

Change to Postgresql

parent 4a2f6267
Pipeline #3534549 failed with stage
in 3 minutes and 28 seconds
# Which Docker image to use
image: "ruby:2.3.1"
#
# # Which Docker services to use
services:
- postgres:latest
# Build variables
variables:
# Configure postgres service (https://hub.docker.com/_/postgres/)
# These variables need to be set for Rails too in database.yml.
POSTGRES_DB: resource_adaptor_test
POSTGRES_USER: resource_adaptor
POSTGRES_PASSWORD: resource_adaptor
before_script:
- ruby -v
- which ruby
......@@ -6,6 +21,7 @@ before_script:
- bundle exec rake db:create
- bundle exec rake db:migrate
rspec:
script:
- bundle exec rspec
......@@ -11,6 +11,7 @@ gem 'httparty'
gem 'rest-client'
gem 'sqlite3'
gem 'pg'
gem 'colorize'
......
......@@ -62,6 +62,7 @@ GEM
multi_xml (0.5.5)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
pg (0.18.4)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
......@@ -137,6 +138,7 @@ PLATFORMS
DEPENDENCIES
colorize
httparty
pg
rails (= 4.2.2)
rails-api
rest-client
......
......@@ -6,6 +6,9 @@ The detailed documentation can be found in [Smart City Platform's Stoa page](htt
## Environment Setup
* Install [PostgreSQL](https://www.postgresql.org/download/)
* Run on terminal: ```$ sudo -u postgres psql```
* Run on postgresql command line: ```$ create role resource_adaptor with createdb login password 'resource_adaptor';```
* Install RVM
* Run on terminal: ```$ rvm install 2.2.0```
* In the project directory, run:
......@@ -25,9 +28,7 @@ You should see all tests passing =)
We use a relational database to store some important information about all components encapsulated by a resource.
By default, our [database config file](config/database.yml) use the adpater for sqlite3 that is good enough for smal amount of transactions (or small number of simulated components).
However, you can also configure a resource-adaptor to use more powerful alternatives, such as [PostgreSQL](https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres) and
[MySQL](https://www.digitalocean.com/community/tutorials/how-to-use-mysql-with-your-ruby-on-rails-application-on-ubuntu-14-04).
By default, our [database config file](config/database.yml) use the adpater for postgresql.
### Services links
......
......@@ -5,21 +5,28 @@
# gem 'sqlite3'
#
default: &default
adapter: sqlite3
adapter: postgresql
encoding: unicode
pool: 5
timeout: 100000
development:
<<: *default
database: db/development.sqlite3
database: resource_adaptor_development
username: resource_adaptor
password: resource_adaptor
# 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:
<<: *default
database: db/test.sqlite3
database: resource_adaptor_test
username: resource_adaptor
password: resource_adaptor
production:
<<: *default
database: db/production.sqlite3
database: resource_adaptor_production
username: resource_adaptor
password: resource_adaptor
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