Skip to content
/ registro Public

WebApp to manage people registration, consumption, payments to an event.

License

Notifications You must be signed in to change notification settings

iax7/registro

Registro

Rubocop Ruby Rails PostgreSQL NodeJS Conventional Commits

This webapp was developed using the following tools, those are not required but can be a good baseline to start working in this project

Run Locally

Ubuntu 18.04 LTS Prerequisites

sudo apt-get install -y ruby build-essential patch ruby-dev zlib1g-dev liblzma-dev
sudo apt-get install -y libpq-dev #PostgreSQL

Fedora 32 Prerequisites

sudo dnf install -y ruby ruby-devel gcc openssl-devel zlib-devel rpm-build libpq-devel g++
sudo dnf group install -y "C Development Tools and Libraries"
  1. Ensure you have Ruby and NodeJS installed.

  2. Install bundler gem: sudo gem install bundler

  3. Install all gem dependencies: bundle install

  4. Edit the secrets variables

    • If you are starting over:

      # 1. create .env file
      cp .env.template .env
      # 2. create a key
      rake secret | tail -1 | cut -c1-32 > config/master.key
    • Then create a Credentials file using rails credentials:edit and add the following content:

      secret_key_base: xxxxxxxx
      
      google_key: xxxxxxxx
      api_user: xxxxxxxx
      api_pass: xxxxxxxx
      
      smtp:
        address: xxxxxx.xx.com
        domain: xxxxxxxxxx.com
        user_name: xxxx@xxxxxxxx.com
        password: xxxxxxxx
  5. Start PostgreSQL DB (with docker)

    docker run --name reg -p 5432:5432 \
           -v ~/dev/data/reg:/var/lib/postgresql/data \
           -e POSTGRES_PASSWORD=123456 -d postgres:13
    1. Initialize the db:
    rails db:create
    rails db:schema:load
    
    rails db:seed
    
    # Optional - If you want to generate random data
    rails db:populate
  6. Install yarn dependencies:

    yarn install --check-files
  7. You should be ready to go. Run the project.

    rails server
  8. You can login using admin account that was previously seed:

    admin@domain.com / changeme

Test

This project used RSPEC to run test. Set your environment first:

rails db:migrate RAILS_ENV=test

Run tests using: rspec

Run in Heroku

For more information please visit the official heroku page

  • Set the Buildpacks:

    heroku buildpacks:clear
    heroku buildpacks:set heroku/nodejs
    heroku buildpacks:add heroku/ruby
  • Set environmental Variables (for PROD):

    heroku config:set RAILS_MAX_THREADS=1
    heroku config:set RAILS_MIN_THREADS=1
    heroku config:set RAILS_ENV=production
    heroku config:set RAILS_MASTER_KEY=$(cat config/master.key)
    heroku config:set RAILS_SERVE_STATIC_FILES=true
  • Create the DB

    heroku rake db:schema:load
    heroku rake db:seed
  • You will have an administrator account already configured. Login using the following credentials: admin@domain.com:changeme

Maintenance

Update Gems

bundle update

Documentation