Giter Site home page Giter Site logo

setting_react_rails's Introduction

React x Rails API モードのDocker環境構築初期設定

1. リポジトリのClone

$ git clone [email protected]:DaisukeShinoku/setting_react_rails.git

2. Railsのビルド

$ docker-compose run api rails new . --force --no-deps --database=postgresql --api
$ docker-compose build

3. Reactの作成

$ docker-compose run --rm front sh -c "npm install -g create-react-app && create-react-app . --template typescript"

4. DB作成

(1) api/config/database.ymlに必要な設定を追記

~
~
default: &default
  adapter: postgresql
  encoding: unicode
  # For details on connection pooling, see Rails configuration guide
  # https://guides.rubyonrails.org/configuring.html#database-pooling
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

  ### 下記を追記
  host: db
  username: postgres
  passowrd:
  ### 上記を追記

development:
  <<: *default
  database: docker_qiita_oniki_development
~
~

(2) Docker立ち上げ(ターミナルを一つ占有する)

$ docker-compose up

(3) DBを作成する

上記の作業と別のターミナルを立ち上げて行う

$ docker-compose exec api rails db:create

この時点で下記のURLでそれぞれのデフォルトページが表示されることを確認する

  • Rails : http://localhost:3000/
  • React : http://localhost:8000/

setting_react_rails's People

Contributors

daisukeshinoku avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.