Example projecto for "GraphQL on Rails" tutorial:
You need nodejs and yarn installed.
Run yarn && bundle && rails s
to make the magic happen.
You need docker
and docker-compose
installed (for MacOS just use official app).
Run the following commands to prepare your Docker dev env:
$ docker-compose build
$ docker-compose run runner yarn install
$ docker-compose run runner ./bin/setup
It builds the Docker image, installs Ruby and NodeJS dependencies, creates database, run migrations and seeds.
You're all set! Now you're ready to code!
You can run the Rails up using the following command:
$ docker-compose up rails
If you want to run Webpack Dev server as well:
$ docker-compose up rails webpacker
You can also use dip
–CLI utility for straightforward provisioning and interacting with an applications configured by docker-compose
.
To install dip
copy and run the command below:
$ gem install dip
Then use the following commands:
# provision application
dip provision
# run web app with all debuging capabilities (i.e. `binding.pry`)
dip rails s
# run rails console
dip rails c
# run webpacker dev server
dip up -d webpacker
# `-d` - mean that service will run in detached (background) mode