https://github.com/mamantoha/deployerb
a toolkit for building realtime RESTful APIs with MongoDB
https://github.com/mamantoha/deployerb
mongo mongodb ruby
Last synced: 4 months ago
JSON representation
a toolkit for building realtime RESTful APIs with MongoDB
- Host: GitHub
- URL: https://github.com/mamantoha/deployerb
- Owner: mamantoha
- License: mit
- Created: 2014-09-13T10:52:55.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2024-04-11T08:36:15.000Z (about 2 years ago)
- Last Synced: 2024-04-14T21:52:43.184Z (about 2 years ago)
- Topics: mongo, mongodb, ruby
- Language: Ruby
- Homepage:
- Size: 945 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Deployerb
## Installation
* Install MongoDB
* Install Ruby
* Install Node.js
### Clone Deployerb from GiHub
```console
git clone https://github.com/mamantoha/deployerb.git
cd deployerb
```
### Install Ruby dependencies
```console
cd ./backend
bundle install
```
### Install Yarn dependencies
```console
cd ./frontend
npm install
```
### Development
```console
cd ./backend
bundle exec rackup
```
```console
cd ./frontend
cp node_modules/highlight.js/styles/github.min.css public/hljs-themes
cp node_modules/highlight.js/styles/github-dark.min.css public/hljs-themes
npm run dev
```
## Production
### Build the Vue 3 Frontend
```
cd ./frontend
npm install
npm run build
cp -r dist/* ../backend/public
cp node_modules/highlight.js/styles/github.min.css ../backend/public/hljs-themes
cp node_modules/highlight.js/styles/github-dark.min.css ../backend/public/hljs-theme
```
## Configure Nginx
`/etc/nginx/sites-available/default`
```
server {
listen 80;
server_name localhost;
root /path/to/deployerb/backend/public;
index index.html;
location / {
try_files $uri /index.html;
}
location /api/ {
proxy_pass http://127.0.0.1:9292/;
rewrite ^/api/(.*)$ /$1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
This setup serves:
- Frontend (Vue 3) → `/` (served as static files)
- Backend (Sinatra API) → `/api/` (proxied to Puma)
### Start the Sinatra Backend
```
cd ./backend
bundle install
RAILS_ENV=production bundle exec puma -C config/puma.rb
```