The goal of this project is to simplify order and distribution management for startup food companies. This is the backend for several other client apps (Working Titles).
- Install docker
Signup for the following services:
- Create a new log destination
- Duplicate and rename
config/log_config.example.yml~>config/log_config.yml - Copy the Host and Port into
config/log_config.yml
- Create a
demo companyvia the xero interface Create demo account - Goto the xero dev console Xero Dev - Applications
- Create a new private application
- Select the
Demo Companyas the target - Generate keys - Leave password blank:
mkdir ~/xero_keys
cd ~/xero_keys
openssl genrsa -out privatekey.pem 1024
openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 1825
openssl pkcs12 -export -out public_privatekey.pfx -inkey privatekey.pem -in publickey.cer
pbcopy < publickey.cer- Paste in the public key into the xero new app form
Add in the following env vars to the stack
XERO_API_KEY=APP_KEYXERO_SECRET=APP_SECRETXERO_PRIVATE_KEY=rsa_private_keySPOILAGE_ACCOUNT_CODE=400COGS_ACCOUNT_CODE=500SALES_ACCOUNT_CODE=400REDIS_URL=redis://localhostREDIS_ADDRESS=redisAWS_ACCESS_KEY_ID=AWS_ACCESS_KEYAWS_SECRET_ACCESS_KEY=SECRETAWS_REGION=us-east-1PDF_BUCKET=aws_bucketMAIL_GUN_DOMAIN=mg.yourdomain.com[email protected]ROUTIFIC_API_KEY=routific_api_keyMAPBOX_API_TOKEN=mapbnox_api_keySLACK_CHANNEL_URL=https://hooks.slack.com/services/keyDISTRIBUTION_SLACK_CHANNEL_URL=https://hooks.slack.com/services/keyFIREBASE_URL=https://yourapp.firebaseio.com/GOOGLE_API_KEY=google_api_key[email protected]
Note The XERO_PRIVATE_KEY needs to be converted to a single line with newlines replaced with \n
Example:
XERO_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nMIICXAIBAAKBgQC7yxBqf5NnEFeyNkNIj+1EIFK4NDsOSITYkNh7kQSKbyUmHes1\nAE29ePg7+S8mYhMBfQy0U/2IGI9RDsQKsZLpEj0iiBpBLtl0N1sg90Nc+RjEAPaR\nA63bKVDi1fCstilaQbXN7dQeGEOg83Zh/5WzNtdJlC823iDoWwCWVhK63wIDAQAB\nAoGARZCKazkJDHO0WLLbJ8URGlxy6AOJINhiRasaVmO47+MOOpl2Xx9RrLPkvKtM\n+QX5jmKZUu+NsqhOZrN2kZOIHKS7lV/+6HkxCVhmkWFN1Y0oapaZ8Gggp7OJ2uwP\nv3eXeOzZnlqY/cwjDzntgyO5Gyek47rwh319q62VRxwJ/wECQQD5LRCRfQryrYgu\nVO2wjOeWX3bfHI8wk+8wjwQ7BSdROME2N+/opUuWUZ5pmjaowEYuSuEqdakkDIfU\n1EseYwFfAkEAwO+nYRrMIW9Jv7zWB0sHK3f01rQqL0uRudRkZoaMKRu+CzODOdHX\n3PMqgPlip9OypK/uDRL1teQ8zj+QDTs2gQJBALOmxSJQSFttuBjHjNPU04g8bhRU\nnvyEPFkDVCaFcbKCu/MuY1+WBahsU22LLUt/zVnFDRDC4l8mVayiH0LaWPsCQH2i\nkWgWPx71jruiJ+0P2ldgAbteDqpFl1tfBxIMQ3Dxc8tve+BG2T4zylW6D5ghro63\nUViKJB6RxVa45WD4UgECQFWqHSe84+hoNgel5gZw2nIF8kNvnT0mI6EQRTfXqFcG\nXlR1tb04Ega6LrgXD7W120NXPKK+R3GO2AxIi7vg9qU=\n-----END RSA PRIVATE KEY-----"
Install the in-spiritus-cli tool
The easiest way to get the project running is by using the CLI tool. This will manage starting and stopped, migrations, opening sessions to the correct containers and several other regular tasks
npm install -g mlvk/in-spiritus-cli- Install the tool globallyis serve- Run from the root of the project. Starts all the containersis --help
Read the cli docs for more info.
If you have trouble using the CLI tool, you can manage the docker-compose manually with these commands.
docker-compose -f docker/docker-compose-no-sync.yml up- To start just to base services (without workers)docker-compose -f docker/docker-compose.yml up- To start all services
docker-compose -f docker/docker-compose.yml exec web rake db:reset- Run the first time you build the containers
docker-compose -f docker/docker-compose.yml exec web rake db:migrate- To run migrationsdocker-compose -f docker/docker-compose.yml exec web rake erd- Generate Entity-Relationship Diagramsdocker-compose -f docker/docker-compose.yml exec web rails c- Start a rails consoledocker-compose -f docker/docker-compose.yml exec web bash- Start a bash shell on the web containerdocker-compose -f docker/docker-compose.yml exec db psql -U postgres- Open a psql command line in the db containerdocker-compose -f docker/docker-compose.yml exec redis redis-cli- Start the redis-cli on the redis container
- Run
docker-compose -f docker/docker-compose.yml exec rake secretfor each slot where needed in the secrets file
- Build a new base web container (When Gemfile changes):
docker build -f docker/Dockerfile.app -t mlvk/in-spiritus:0.0.12 . - Build a new base web container (When Gemfile changes):
docker build -f docker/Dockerfile.python -t mlvk/in-spiritus-python:0.0.1 .
- Push to dockerhub registry:
docker push mlvk/in-spiritus:0.0.13 - Push to dockerhub registry:
docker push mlvk/in-spiritus-python:0.0.2
- You can install the ruby-test Atom plugin
- For the setting in the mini test area use the following settings:
- Minitest command: run all tests:
is zeus test - Minitest command: run test file:
is zeus test {relative_path} - Minitest command: run current test:
is zeus test {relative_path}:{line_number}