Creating website for hire workers. Chapter 2. Configs

Creating website for hire workers. Chapter 2. Configs

Bravo webdev

Hi there. This is the 2th chapter of our tutorial "Creating custom website for hire workers". 

previous chapters available at out telegram channel ang group.

https://t.me/bravowebdevchannel

https://t.me/bravowebdev

*******************************************************

In this chapter we will configure our machine and clone project

We need to install Ubuntu (or windows,mac, other linux) and install ruby with ruby on rails gem. Also we need git and heroku. I intalled all of this according to installation guides at official websites of Ruby, bundler, gem Ruby on Rails,account at GitHub and Heroku. You can find tutorials here https://telegra.ph/Ruby-on-Rails-useful-links-11-24


After installation ruby, ruby on rails, postgresql, git and heroku we can start development.

************************************************************

type at terminal

mkdir bravo-webdev

cd bravo-webdev

ruby --version

output something like this

ruby 3.0.2

type

psql --version

output

psql (PostgreSQL) 10.19

type node --version and yarn --version for see installed version


Lets install ruby on rails

type

gem install rails

rails --version

output

Rails 6


Lets create our website

rails new yelpy (or type your own name instead yelpy)

cd yelpy

git init

heroku login

rails server (or rails s)

Open browser at http://127.0.0.1:3000/ and you will see Rails logo

If something wrong, you can return to the start, find help at our telegram group or website, groups about concrete technology (ruby, heroku) at english or your native language.

If you see logo, awesome, go ahead.

Create an Github account according Github official page instructions and create an Heroku account (its free, no credit-card required) following their official website instructions.

type git remote add origin git@github.com:your-repository-address (you can see it after create your account)

git add .

git commmit -m "my initial commit"

git push origin master

Your code now available at your Github account, you can check in browser

heroku git:remote -a my-app (name that your type when create a new app at heroku website)

git push heroku master

You can see deployment proccess at terminal and in browser at heroku website (you can open bash also in heroku and type commands like you on a server or connect to database)

I had an error, that heroku dont support sqlite3.

So you can open Gemfile and find gem 'sqlite' and comment it with # and copy, paste to development section

group :development do

 # Access an interactive console on exception pages or by calling 'console' anywhere in the code.

 gem 'web-console', '>= 4.1.0'

 # Display performance information such as SQL time and flame graphs for each request in your browser.

 # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md

 gem 'rack-mini-profiler', '~> 2.0'

 gem 'listen', '~> 3.3'

 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring

 gem 'spring'

 gem 'sqlite3', '~> 1.4'

end


and add gem 'postgresql' to the string where you commented sqlite3, close Gemfile and type 

gem install postgresql

bundle install

git add .

git commit -m "remove sqlite3, add postgresql"

git push origin master

git push heroku master

See building process and succesefull deployment. You will see rails logo at heroku-app address (you can see this address on heroku website 'Open app' button)

Dont see a logo? but a 404 error "The page you were looking for doesn't exist."? Ohh, yes, we forget say root page for our app.

Open config/routes.rb

type

root to: "rails/welcome#index"

git add .

git commit -m "add root page"

git push heroku master

git push origin master

Voila! We see logo at heroku address (https://app-webdev.herokuapp.com/) as we saw it on our development computers browser

That is it. You can also add Procfile to configure your heroku app (they said it on WARNINGS message) also I put here links to official docs about ruby, ruby on rails, github, heroku, postgres and instalation it on ubuntu 18.04


The next chapter (Chapter 3. Add registration and CRUD for resources) is directly custom development our website for hire workers. 

Join us. Other chapters

https://t.me/bravowebdevchannel

https://t.me/bravowebdev


Report Page