This repo contains an MVP about a simpler and modified version of Twitter in Ruby on Rails.
-
Clone this repo and get into it.
-
Rename
.env.sampleto.envand fill it up with your github credentials. (DB_HOST will be filled later) -
Run
docker compose up. This will give you your db_host container name(tweetable-individual_xxxx_db_1) -
On a different window run
docker compose exec client bash. -
Inside the bash terminal run the
bootstrapcommand. -
Set up your
config/database.ymlfile following the rules at the instructions. -
Install all the gems with
bundle install, if it says something like your bundle is locked... runbundle update.
7.a if an error Couldn't find an integrity file appears, run yarn install --check-files.
- Initialize your DB:
rails db:create
You can access your running app looking at localhost:3000.
To be able to see your app running on any browser, run it using
rails server -b 0.0.0.0. Otherwise the server will start but you won't be able to see anything since the rails app is just showing for its local container.
The file config/database.yml should be configured like the next example.
default: &default
adapter: postgresql
encoding: unicode
host: db
username: postgres
password: <%= ENV['PGPASSWORD'] %>
# For details on connection pooling, see Rails configuration guide
# https://guides.rubyonrails.org/configuring.html#database-pooling
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>If you want to connect to your db from a GUI client, you can use the next credentials:
username: postgres
password: codeable
host: localhost
port: 54320
database: <rails_db_dev_name>