Installation on Mac for Development
Written by Miguel Michelson
So you want to set up Chaskiq on macOS to hack on and develop with? We’ll assume that you don’t have Ruby/Rails/Postgres/Redis installed on your Mac. Let’s begin!(If you want to install Chaskiq for production use, see our install guide)..
Run this script in terminal, to setup Rails development environment:
bash <(curl -s https://raw.githubusercontent.com/techAPJ/install-rails/master/mac)
This script will install following new packages on your system:
In case you have any of this package pre-installed and don’t want to run entire script, see the script and pick the packages you don’t have currently installed. The script is fine-tuned for Chaskiq, and includes all the packages required for Discourse installation.Now that we have installed Chaskiq dependencies, let’s move on to install Chaskiq itself.
Clone the Chaskiq repository in ~/chaskiq folder:
git clone https://github.com/michelson/chaskiq.git ~/chaskiq
~ indicates home folder, so Chaskiq source code will be available in your home folder.
Switch to your Chaskiq folder:
Note that you will need setup some environment variables first, the example file is located a .env.example in the root folder. Rename that to .env and add your variables for development.
Your file should look like this:
HOST=http://localhost:3000 ASSET_HOST=http://localhost:3000 WS=ws://localhost:3000/cable SES_ADDRESS= SES_USER_NAME= SES_PASSWORD= AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_S3_BUCKET= AWS_S3_REGION= ADMIN_EMAILemail@example.com ADMIN_PASSWORD=123456 SNS_CONFIGURATION_SET=metrics DEFAULT_SENDER_EMAIL=
Important things are your HOST and WS vars and ADMIN_EMAIL and ADMIN_PASSWORD for initial admin generation
Install the needed gems
source ~/.bashrc bundle install
Now that you have successfully installed gems, run these commands:
bundle exec rake db:create bundle exec rake db:migrate bundle exec rake db:seed RAILS_ENV=test bundle exec rake db:create db:migrate
Try running the specs:
bundle exec rake spec
All the tests should pass. Start rails server:
bundle exec rails server
You should now be able to connect with your Chaskiq app on http://localhost:3000 - try it out!
The rails admin_generator task will create an admin user for you, you will need to have an ADMIN_EMAIL and ADMIN_PASSWORD on your .env try this credentials:
Happy hacking! And to get started with that, see Begginer Guide to develop Chaskiq plugins.