Skip to content

13LD/restaurants-nearby

Repository files navigation

restaurants-nearby

Build Status

Description

Simple rails template for general project.

Requirements

  • Rails 6.0.x
  • PostgreSQL

What's included?

  • Docker for production deploy
  • Nginx Proxy server configuration with Let's encrypt SSL Certificate
  • Webpacker and Stimulus setting for client javascript
  • ActiveJob + Sidekiq + Redis setting for async jobs
  • ActiveAdmin + ArcticAdmin for application admin
  • Foreman setting for integrative dev setup
  • Rspec + FactoryBot setting for test code
  • Guard + LiveReload setting for hot reloading
  • Slack Message Notification for Exception

Foreman start task

Procfile-based applications

with rails hot

It runs

  • rails
  • webpacker
  • guard
  • sidekiq

Stimulus generator

Stimulus specific generator task.

with rails g stimulus posts index

It generates

  • app/javascript/posts/index_controller.js with sample html markup containing stimulus path helper.

Production deploy process

After installing docker & docker-compose in your host machine.

Set up a seperate Nginx-Proxy docker container in your host machine.

git clone https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion.git
cd docker-compose-letsencrypt-nginx-proxy-companion
mv .env.sample .env
./start.sh

Clone your repository to host machine and build docker-compose.

git clone http://github.com/username/your_own_rails_repository
docker-compose build
docker-compose up -d

Make sure your production database table is created before deploy(it doesn't support db:create yet)

# After accessing to your postgres container
su - postgres
createdb project_production;

Scale your rails application to 5 replicas. scale docker containers

docker-compose up -d --scale app=5

Automated deploy task

After pushing repository to git and providing deployment information in lib/tasks/deploy.rake file. You can automate above process.

rails deploy:production

Testing

rspec-rails factory-bot

Run test specs

bundle exec rspec

Docker CMDs

To see your live container log

docker ps
docker logs -f --tail 5 processid

Check images / containers

docker images -a
docker container ls -a

Remove all abandonded images

docker rmi -f $(docker images -a | grep "none" | awk '{print $3}')
docker rmi $(docker images -f "dangling=true" -q)

Destry all exited containers remove scientist name containers

docker container rm $(docker container ls -aq --filter status=exited)

Prune (be careful)

docker container prune
docker image prune
docker network prune
docker volume prune

Stop and delete specific container

docker stop processid
docker rm processid

About

Service for restaurants nearby suggests

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published