This is the backend of Squareteam. Written in Ruby with Sinatra.
For convenience, all commands in this README have been used with this alias : alias brake='bundle exec rake'
You have two usual environment to help you develop the backend : development and test.
you can skip to the next paragraph Run with docker for simplicity
Install the bundle
bundle install --without "production"Create sqlite databases if they don't exist
# For development env touch db/development.sqlite3 brake db:schema:load # For test env touch db/test.sqlite3 RACK_ENV=test brake db:schema:loadbundle exec ruby console ``## Launching a development server```bashbrake runServed by default on http://localhost:8000/
brake specPrerequisites: all you need is docker installed on your machine and fig. For convenience on MacOS, you can use the Vagrantfile.
Create a directory to store the database data
mkdir -p /tmp/mysql_stif you want it in another location, you will need to change it also in the fig.yml file
Launch everything with (daemonized, remove the -d parameter to not daemonize):
sudo fig up -dSet dev.squareteam.io as hostname for your local ip
sudo echo'127.0.0.1 dev.squareteam.io'>> /etc/hostsOpen your browser and visit
http://dev.squareteam.io/api/ You will need an insecure_key to connect to the container. Beware: this is a public 'private key', it is not secure at all, don't use in production
curl -o insecure_key -fSL https://github.com/phusion/baseimage-docker/raw/master/image/insecure_key chmod 600 insecure_key ssh -i insecure_key -p 2222 root@localhostbundle install --deploymentSet database env variables and don't forget to create the database if it doesn't exist.
PREPROD_ST_DB_NAME= PREPROD_ST_DB_USERNAME= PREPROD_ST_DB_PASSWORD= PREPROD_ST_DB_HOST= PREPROD_ST_DB_PORT=if you need to create a database you can use the rake tasks
RACK_ENV=preprod brake db:create RACK_ENV=preprod brake db:setup RACK_ENV=preprod brake db:migrateRACK_ENV=preprod bundle exec rackup -o PREPROD_ST_HOST -p PREPROD_ST_PORT See nginx.conf.example to tweak the nginx configuration.
bundle install --deploymentSet database env variables and don't forget to create the database if it doesn't exist.
ST_DB_NAME= ST_DB_USERNAME= ST_DB_PASSWORD= ST_DB_HOST= ST_DB_PORT=if you need to create a database you can use the rake tasks
RACK_ENV=production brake db:create RACK_ENV=production brake db:setup RACK_ENV=production brake db:migrateRACK_ENV=production bundle exec rackup -o ST_HOST -p ST_PORT 