All Projects → adaam2 → Docker Rails React Starter

adaam2 / Docker Rails React Starter

A basic docker-compose, Rails and React / Webpack starter kit

Programming Languages

javascript
184084 projects - #8 most used programming language
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Docker Rails React Starter

Docker Web Framework Examples
Example apps that demonstate how to use Docker with your favorite web frameworks.
Stars: ✭ 204 (+292.31%)
Mutual labels:  webpack, rails, docker-compose
Hyperstack
Hyperstack ALPHA https://hyperstack.org
Stars: ✭ 463 (+790.38%)
Mutual labels:  webpack, rails
Ts Monorepo
Template for setting up a TypeScript monorepo
Stars: ✭ 459 (+782.69%)
Mutual labels:  webpack, create-react-app
React App
Create React App with server-side code support
Stars: ✭ 614 (+1080.77%)
Mutual labels:  webpack, create-react-app
Strimpack
A platform for livestreamers to make a home for their audience.
Stars: ✭ 378 (+626.92%)
Mutual labels:  create-react-app, docker-compose
Create React App Typescript
DEPRECATED: Create React apps using typescript with no build configuration.
Stars: ✭ 3,759 (+7128.85%)
Mutual labels:  webpack, create-react-app
Webpacker
Use Webpack to manage app-like JavaScript modules in Rails
Stars: ✭ 5,282 (+10057.69%)
Mutual labels:  webpack, rails
Webpack Messages
Beautifully format Webpack messages throughout your bundle lifecycle(s)!
Stars: ✭ 238 (+357.69%)
Mutual labels:  webpack, create-react-app
Filterlists
🛡 The independent, comprehensive directory of filter and host lists for advertisements, trackers, malware, and annoyances.
Stars: ✭ 653 (+1155.77%)
Mutual labels:  create-react-app, docker-compose
Orats
Opinionated rails application templates.
Stars: ✭ 681 (+1209.62%)
Mutual labels:  rails, docker-compose
Error Overlay Webpack Plugin
Catch errors with style 💥✨
Stars: ✭ 821 (+1478.85%)
Mutual labels:  webpack, create-react-app
Hyper React
The project has moved to Hyperstack!!
Stars: ✭ 295 (+467.31%)
Mutual labels:  webpack, rails
Kickoff tailwind
A rapid Rails 6 application template for personal use bundled with Tailwind CSS
Stars: ✭ 287 (+451.92%)
Mutual labels:  webpack, rails
Cookiecutter Django Vue
Cookiecutter Django Vue is a template for Django-Vue projects.
Stars: ✭ 462 (+788.46%)
Mutual labels:  webpack, docker-compose
React webpack rails
Simple and lightweight react-webpack-rails integration.
Stars: ✭ 248 (+376.92%)
Mutual labels:  webpack, rails
Kails
A Web App like Ruby on Rails with Koa2, Webpack and Postgres
Stars: ✭ 512 (+884.62%)
Mutual labels:  webpack, rails
Vue Rails Form Builder Demo
An example of Rails app using vue-form-for gem
Stars: ✭ 12 (-76.92%)
Mutual labels:  webpack, rails
Firefly
Web app boilerplate for beginners based on Firebase and React 🔥
Stars: ✭ 204 (+292.31%)
Mutual labels:  webpack, create-react-app
Create React Kotlin App
Create React apps using Kotlin with no build configuration
Stars: ✭ 2,427 (+4567.31%)
Mutual labels:  webpack, create-react-app
Retro Board
Retrospective Board
Stars: ✭ 622 (+1096.15%)
Mutual labels:  webpack, docker-compose

Technologies

  • Docker compose
  • Postgresql
  • Nginx proxy
  • Ruby on Rails 5 (API only)
  • React + Redux + Redux Thunk + Reselect
  • Sidekiq in a Worker container.

Setup && running the application

Before you run the application for the first time, you must create the database and run migrations:

docker-compose run backend rake db:create db:migrate

Or alternatively, log in via bash and run the commands there:

docker-compose run backend bash
[email protected]:/usr/src/backend-app# rake db:create
Created database 'backend_development'
Created database 'backend_test'
[email protected]:/usr/src/backend-app# rake db:migrate
== 20180306161431 DeviseTokenAuthCreateUsers: migrating =======================
-- create_table(:users)
   -> 0.0164s
-- add_index(:users, :email, {:unique=>true})
   -> 0.0088s
-- add_index(:users, [:uid, :provider], {:unique=>true})
   -> 0.0078s
-- add_index(:users, :reset_password_token, {:unique=>true})
   -> 0.0092s
-- add_index(:users, :confirmation_token, {:unique=>true})
   -> 0.0070s
== 20180306161431 DeviseTokenAuthCreateUsers: migrated (0.0497s) ==============

Docker on OS X

If you are using Docker for Mac, you must setup the directory /Users to be able to be bind mounted into Docker containers by going to Docker for Mac preferences, and then File Sharing, and ensuring that /Users is listed there.

Running

Running the app (and navigate to http://localhost:8080):

docker-compose up --build

Accessing the bash console for the React container (for installing new Yarn / NPM packages):

docker-compose run frontend bash

Accessing the bash console for the Rails app (for rails c):

docker-compose run backend bash
=> rails c

Creating the database:

docker-compose run backend rake db:setup

Running migrations:

docker-compose run backend rake db:migrate

Killing the application (and remove data volumes):

docker-compose down --volumes

Running backend RSpec tests:

docker-compose run backend rspec

Running Jest (JS) specs:

docker-compose run frontend yarn test

Architecture

The application can be built using docker-compose up --build.

There are several interlinking services orchestrated in individual containers: db (the postgresql instance), backend (the Rails api), frontend (the React application) and finally the nginx proxy container which pulls everything together and which is the only container which exposes any ports to the host machine.

The nginx conf can be found at /config/nginx/nginx.conf.

The Rails application is proxied from port 3000 to http://localhost:8080/api and the Webpack / React application is proxied from port 4000 to the root at http://localhost:8080/.

The React application was originally created using create-react-app but was ejected to expose the full configuration.

Using on your own project

Nuke the git directory:

rm -rf .git

Start again:

git init
git add .
git commit -m "Initial commit"

Do some work / profit

Recommended dep versions

I develop using Ubuntu, so your mileage may vary on other operating systems like OS X and Windows.

Docker Compose:

➜  react-rails-docker git:(master) docker-compose -v
docker-compose version 1.19.0, build 9e633ef

Docker:

➜  react-rails-docker git:(master) ✗ docker -v
Docker version 17.12.1-ce, build 7390fc6

Ruby version (through rbenv):

➜  react-rails-docker git:(master) ✗ ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].