Giter Club home page Giter Club logo

sherpa's Introduction

Sherpa skeleton service

New service

cd /path
git clone [email protected]:sequre/sherpa.git
cd sherpa
ruby start_new_service.rb  # you have to answer with the CamelCase and snake_case new service name

Setup

Initialize docker services

Make sure that our docker_services is up an ready. You can check with:

$> docker-compose ps
           Name                         Command               State
--------------------------------------------------------------------------------------------------
dockerservices_postgres_1    docker-entrypoint.sh postgres    Up      0.0.0.0:5432->5432/tcp
dockerservices_redis_1       docker-entrypoint.sh redis ...   Up      0.0.0.0:6379->6379/tcp
dockerservices_sentry_1      /entrypoint.sh /run_sentry.sh    Up      0.0.0.0:9000->9000/tcp
dockerservices_wisproMQ1_1   docker-entrypoint.sh rabbi ...   Up      15671/tcp, 0.0.0.0:15672->15

You must see:

  • dockerservices_postgres_1 State Up (Postgres service)
  • dockerservices_redis_1 State Up (Redis service)
  • dockerservices_sentry_1 State Up (Sentry service)
  • dockerservices_wisproMQ1_1 State Up (Rabbit service)

Install bundle

$> cd ~/Sherpa
$> gem install bundle
$> bundle install

ENV file

Install direnv

Configure envs

$> cd ~/Sherpa
$> touch .envrc

Inside the file .envrc (or whatever env file you like), set:

# This is an example for development environment. You can use whatever you like.
DB_HOST=localhost
DB_PORT=5432
DB_NAME=sherpa
DB_USER=sherpa
DB_PASS=sherpa
RABBIT_USER=wisproMQ
RABBIT_PASS=wisproMQ
RABBIT_HOST=localhost
RABBIT_VIRTUAL_HOST=sync.devel
IV_ENCRYPTER="REPLACE_WITH_ENCODED_IV"
KEY_ENCRYPTER="REPLACE_WITH_ENCODED_KEY"

IMPORTANT After initialize or update the file .envrc.

cd ../Sherpa # This is for upload the rbvenv-vars

Configure Postgres for AFIP Service

Create user

$> cd ~/docker_services
$> ./run_in_service.sh postgres bash
$> psql -U postgres
CREATE USER sherpa WITH PASSWORD 'sherpa';

Create database

$> cd ~/docker_services
$> ./run_in_service.sh postgres bash
$> psql -U postgres
CREATE DATABASE sherpa;

Grant permission to user

$> cd ~/docker_services    # If use postgres docker service
$> ./run_in_service.sh postgres bash # If use postgres docker service
$> psql -U postgres
GRANT ALL PRIVILEGES ON DATABASE DB_NAME TO sherpa;
ALTER DATABASE DB_NAME OWNER TO sherpa;
ALTER ROLE sherpa SUPERUSER;

Migrate database

$> rake db:migrate

Set Rabbit user permission

  • Visit http://localhost:15672/
  • username: RABBIT_USER
  • password: RABBIT_PASS
  • Go to Admin tab
  • On the right click on "Virtual Hosts"
  • Click on the RABBIT_VIRTUAL_HOST created
  • Set permission to RABBIT_USER

Debugging

$> rails console

Testing

For testing use:

$> rails test

Running

$> rake init_consumer[queue]

sherpa's People

Contributors

gedera avatar

Watchers

James Cloos avatar  avatar

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.