|
| 1 | +# React on Rails Pro License Setup |
| 2 | + |
| 3 | +This document explains how to configure your React on Rails Pro license for the Pro features to work properly. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- React on Rails Pro gem installed |
| 8 | +- React on Rails Pro Node packages installed |
| 9 | +- Valid license key from [ShakaCode](https://shakacode.com/react-on-rails-pro) |
| 10 | + |
| 11 | +## License Configuration |
| 12 | + |
| 13 | +### Method 1: Environment Variable (Recommended) |
| 14 | + |
| 15 | +Set the `REACT_ON_RAILS_PRO_LICENSE` environment variable with your license key: |
| 16 | + |
| 17 | +```bash |
| 18 | +export REACT_ON_RAILS_PRO_LICENSE="your_jwt_license_token_here" |
| 19 | +``` |
| 20 | + |
| 21 | +For production deployments, add this to your deployment configuration: |
| 22 | + |
| 23 | +- **Heroku**: `heroku config:set REACT_ON_RAILS_PRO_LICENSE="your_token"` |
| 24 | +- **Docker**: Add to your Dockerfile or docker-compose.yml |
| 25 | +- **Kubernetes**: Add to your secrets or ConfigMap |
| 26 | + |
| 27 | +### Method 2: Configuration File |
| 28 | + |
| 29 | +Create a file at `config/react_on_rails_pro_license.key` in your Rails root directory: |
| 30 | + |
| 31 | +```bash |
| 32 | +echo "your_jwt_license_token_here" > config/react_on_rails_pro_license.key |
| 33 | +``` |
| 34 | + |
| 35 | +**Important**: This file is automatically excluded from Git via .gitignore. Never commit your license key to version control. |
| 36 | + |
| 37 | +## License Validation |
| 38 | + |
| 39 | +The license is validated at multiple points: |
| 40 | + |
| 41 | +1. **Ruby Gem**: Validated when Rails initializes |
| 42 | +2. **Node Renderer**: Validated when the Node renderer starts |
| 43 | +3. **Browser Package**: Relies on server-side validation (via `railsContext.rorPro`) |
| 44 | + |
| 45 | +### Development vs Production |
| 46 | + |
| 47 | +- **Development Environment**: |
| 48 | + - Invalid or missing licenses show warnings but allow continued usage |
| 49 | + - 30-day grace period for evaluation |
| 50 | + |
| 51 | +- **Production Environment**: |
| 52 | + - Invalid or missing licenses will prevent Pro features from working |
| 53 | + - The application will raise errors if license validation fails |
| 54 | + |
| 55 | +## Verification |
| 56 | + |
| 57 | +To verify your license is properly configured: |
| 58 | + |
| 59 | +### Ruby Console |
| 60 | + |
| 61 | +```ruby |
| 62 | +rails console |
| 63 | +> ReactOnRails::Utils.react_on_rails_pro_licence_valid? |
| 64 | +# Should return true if license is valid |
| 65 | +``` |
| 66 | + |
| 67 | +### Node Renderer |
| 68 | + |
| 69 | +When starting the Node renderer, you should see: |
| 70 | + |
| 71 | +``` |
| 72 | +[React on Rails Pro] License validation successful |
| 73 | +``` |
| 74 | + |
| 75 | +### Rails Context |
| 76 | + |
| 77 | +In your browser's JavaScript console: |
| 78 | + |
| 79 | +```javascript |
| 80 | +window.railsContext.rorPro |
| 81 | +// Should return true if license is valid |
| 82 | +``` |
| 83 | + |
| 84 | +## Troubleshooting |
| 85 | + |
| 86 | +### Common Issues |
| 87 | + |
| 88 | +1. **"No license found" error** |
| 89 | + - Verify the environment variable is set: `echo $REACT_ON_RAILS_PRO_LICENSE` |
| 90 | + - Check the config file exists: `ls config/react_on_rails_pro_license.key` |
| 91 | + |
| 92 | +2. **"Invalid license signature" error** |
| 93 | + - Ensure you're using the complete JWT token (it should be a long string starting with "eyJ") |
| 94 | + - Verify the license hasn't been modified or truncated |
| 95 | + |
| 96 | +3. **"License has expired" error** |
| 97 | + - Contact ShakaCode support to renew your license |
| 98 | + - In development, this will show as a warning but continue working |
| 99 | + |
| 100 | +4. **Node renderer fails to start** |
| 101 | + - Check that the same license is available to the Node process |
| 102 | + - Verify NODE_ENV is set correctly (development/production) |
| 103 | + |
| 104 | +### Debug Mode |
| 105 | + |
| 106 | +For more detailed logging, set: |
| 107 | + |
| 108 | +```bash |
| 109 | +export REACT_ON_RAILS_PRO_DEBUG=true |
| 110 | +``` |
| 111 | + |
| 112 | +## License Format |
| 113 | + |
| 114 | +The license is a JWT (JSON Web Token) signed with RSA-256. It contains: |
| 115 | + |
| 116 | +- Subscriber email |
| 117 | +- Issue date |
| 118 | +- Expiration date (if applicable) |
| 119 | + |
| 120 | +The token is verified using a public key embedded in the code, ensuring authenticity without requiring internet connectivity. |
| 121 | + |
| 122 | +## Support |
| 123 | + |
| 124 | +If you encounter any issues with license validation: |
| 125 | + |
| 126 | +1. Check this documentation |
| 127 | +2. Review the troubleshooting section above |
| 128 | +3. Contact ShakaCode support at [email protected] |
| 129 | +4. Visit https://shakacode.com/react-on-rails-pro for license management |
| 130 | + |
| 131 | +## Security Notes |
| 132 | + |
| 133 | +- Never share your license key publicly |
| 134 | +- Never commit the license key to version control |
| 135 | +- Use environment variables for production deployments |
| 136 | +- The license key is tied to your organization's subscription |
0 commit comments