Skip to content

A Rails 6 boilerplate to create your next Saas product. Preloaded with graphQL, devise, JWT, CanCanCan, RailsAdmin, Rubocop, Rspec, i18n and more.

License

Notifications You must be signed in to change notification settings

itsazzad/rails-devise-graphql

 
 

Repository files navigation

💎 My Company.

Maintenance GitHub license GitHub top language GitHub issues

My CompanyS

Versions

  • Current ruby version 2.6.x
  • Bundler version 2.1.4
  • Rails version 6.0.X
  • PostgreSQL Server as db connector

Dependencies

Started with the help of the follwoing repos:

🚀 Quick start

Clone env_sample to .env for local development. We set it up with default rails 3000 and client 8000 ports:

cp env_sample .env

If you are running Docker on Linux, the files rails new created are owned by root. This happens because the container runs as the root user. If this is the case, change the ownership of the new files.

sudo chown -R $USER:$USER .

Now that you’ve got a new Gemfile, you need to build the image again. (This, and changes to the Gemfile or the Dockerfile, should be the only times you’ll need to rebuild.)

docker-compose build

You can now boot the app with docker-compose up:

docker-compose up

Finally, you need to create the database. In another terminal, run:

docker-compose run web rake db:create
docker-compose run web rake db:migrate
docker-compose run web rake db:seed

View the Rails welcome page!

That’s it. Your app should now be running on port 3000 on your Docker daemon.

On Docker Desktop for Mac and Docker Desktop for Windows, go to http://localhost:3000 on a web browser to see the Rails Welcome.

Point the GraphQL IDE to http://0.0.0.0:3000/graphql

Stop the application

To stop the application, run docker-compose down in your project directory. You can use the same terminal window in which you started the database, or another one where you have access to a command prompt. This is a clean way to stop the application.

docker-compose down
docker-compose down --rmi local -v --remove-orphans

Restart the application

To restart the application run docker-compose up in the project directory.

Rebuild the application

If you make changes to the Gemfile or the Compose file to try out some different configurations, you need to rebuild. Some changes require only docker-compose up --build, but a full rebuild requires a re-run of docker-compose run web bundle install to sync changes in the Gemfile.lock to the host, followed by docker-compose up --build.

Here is an example of the first case, where a full rebuild is not necessary. Suppose you simply want to change the exposed port on the local host from 3000 in our first example to 3001. Make the change to the Compose file to expose port 3000 on the container through a new port, 3001, on the host, and save the changes:

ports:
  - "3001:3000"

Now, rebuild and restart the app with docker-compose up --build.

Inside the container, your app is running on the same port as before 3000, but the Rails Welcome is now available on http://localhost:3001 on your local host.

Packages

No packages published

Languages

  • Ruby 86.5%
  • HTML 7.8%
  • SCSS 2.4%
  • JavaScript 2.0%
  • CSS 0.5%
  • Shell 0.4%
  • Dockerfile 0.4%