Coder Social home page Coder Social logo

kenforthewin / react-rails-auth Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 2.0 152 KB

full-stack, dockerized React token authentication with a Rails api

Ruby 60.21% HTML 3.93% Shell 1.41% CSS 0.94% JavaScript 33.50%
rails5 react rails-api docker docker-compose authentication

react-rails-auth's Introduction

react-rails-auth

What it is

This repo contains a Ruby on Rails application serving as the api for a React frontend. The API backend serves user token-based authentication to a custom-rolled, redux-based authentication frontend. The token auth implementation aims to be as simple as possible while still maintaining full functionality.

Why it exists

Use this repo as a learning exercise for rolling your own token auth, or as a starting point for a new app.

Getting started

All services in this repo are containerized. To get started, first make sure docker and docker-compose are installed.

  1. Clone the repo and navigate to its folder
  2. Create your own .env file at the base of the project. Refer to the .env.sample file for what's needed.
  3. Run the dev script with ./scripts/run-dev.sh
  4. Wait for the images to build.
  5. Eventually the dev server will be up at localhost:3001

Production stack

For production, the React site uses an alternate Dockerfile to build a production image. This image uses a simple nginx server to serve the static files which are generated from the build. Then, a combination of docker-gen and nginx are used to proxy requests to either the api or the react site. Finally, a docker-letsencrypt-nginx-proxy-companion container is included to optionally allow both services SSL encryption through Let's Encrypt.

react-rails-auth's People

Contributors

ken-nurelm avatar kenforthewin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

react-rails-auth's Issues

FATAL: no pg_hba.conf entry

I have a problem with latest docker. I installed it a week ago, it was ok that time, but now after 2 rebuilds i got next error:

 2018-03-19 15:29:29.999 UTC [70] FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off
api_1  | psql: FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off
db_1   | 2018-03-19 15:29:31.050 UTC [71] FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off
api_1  | psql: FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off
api_1  | psql: FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off
db_1   | 2018-03-19 15:29:32.114 UTC [72] FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off
db_1   | 2018-03-19 15:29:33.172 UTC [73] FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off
api_1  | psql: FATAL:  no pg_hba.conf entry for host "172.20.0.3", user "postgres", database "postgres", SSL off```

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.