ellipsis-ai / ellipsis

2 stars 0 forks source link

Get your AWS development Account

Annotate the AWS_KEY and AWS_SECRET

Setup AWS cli on your Mac

$ sudo pip install awscli

If you get an error run this instead:

$ sudo pip install awscli --ignore-installed six

If you need to upgrade awscli with pip use:

$ sudo pip install --upgrade awscli

Test awscli by typing:

$ aws help

Configure awscli by running:

$ aws configure --profile ellipsis_dev

And follow the instructions. For more info go to: http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-quick-configuration

You can now running the aws cli using the --profile option. For example:

$ aws s3 ls --profile ellipsis_dev

Install brew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew update

Install Java 8

$ brew update
$ brew cask install java

Check java is working:

$ java -version

FYI On the Mac jdk is installed in:

$ ls -lFa /Library/Java/JavaVirtualMachines

Install Activator

Download link is https://www.lightbend.com/activator/download add the Activator bin folder to your path https://downloads.typesafe.com/typesafe-activator/1.3.10/typesafe-activator-1.3.10.zip

Install Node v6

(With Node 7+ you may see errors trying to build.)

$ brew install node@6

Install ngrok and run it for port 9000 (ngrok http 9000)

Download link is https://ngrok.com/download Suggested installation location: /usr/local/bin Run ngrok using:

$ ngrok http 9000

If you use the free version of Ngrok everytime you restart it Ngrok will assign to you a new subdomain and you will have to update the Playapp configuration. If you upgrade your Ngrok plan you can choose and keep a subdomain. You can then use the Ngrock config. file:

Create a file at ~/.ngrok2/ngrok.yml. It should look like this

authtoken: <AUTH TOKEN>
tunnels:
  dev:
    proto: http
    addr: 9000
    hostname: <CHOOSEN SUBDOMAIN>.ngrok.io

Then from the command line you can simply run:

$ ngrok start dev

Create a Slack API App

Get the source code from Github

$ git clone git@github.com:ellipsis-ai/ellipsis.git

Install npm packages

$ cd ./ellipsis
$ npm install

Configure the Activator wrapper script

$ cp ./actw.template ./actw

Now edit ./actw and fill in the env. variables values When you are done make run_app executable with:

$ chmod 755 ./actw

Install docker for Mac

https://docs.docker.com/engine/installation/mac/

Run docker-compose

In this step you will start a Docker container running Postgres on port 5432. Before you do that you want to make sure you do not have any Postgres instance running on the same port. Just do:

$ ps aux | grep postgres

Stop the Postgres instance if running.

Now you can run Docker Compose:

$ cd ./ellipsis
$ docker-compose up

You should now have a postgres instance running on port 5432. You can verify that by running:

$ PGPASSWORD=ellipsis psql -h 127.0.0.1 -p 5432 ellipsis ellipsis

You also have Elasticsearch on port 9200, Kibana on port 5601, Elasticsearch-head on 9100 and Memcached on 11211.

http://localhost:9200 http://localhost:9100 http://localhost:5601

Run the app

The app is run using Activator the actw script is just a wrapper that invokes Activator with the necessary environment variables.

$ cp actw.template actw

Now edit actw and fill in all the value for the environment variables

$ vim actw

Finally you can run the app

$ ./actw help
$ ./actw run

Run the console

$ ./actw

Debug the app

$ ./actw -jvm-debug 9999 run

You can now use any Java debugger to attach to 9999.

Drop a Bad Db

$ docker exec -it ellipsis_postgres_1 bash bash

Now that you have a shell in the container, become the postgres user and use the dropdb command to drop the db

$ su postgres
$ dropdb ellipsis-test

Charbee Setup

In Ellipsis payments are handles by Chargebee. If you do not touch any of the payments code there is nothing to do. The billing pages will simply not be visible in your development server.

If you need to touch the payments code you need to:

  1. Create a new free Chargebee account
  2. Get the test site URL and generate a new API key. Complete the setup by clicking on the link in the email Chargebee sent you
  3. Add 2 env. variables to your IntellJ run configuration: CHARGEBEE_SITE and CHARGEBEE_API_KEY. Note that the CHARGEBEE_SITE is not the full URL but just the subdomain.
  4. Configure the Chargebee webhooks: go to Settings › API & Webhooks › Webhook Settings, in Webhook URL put: https://<your-dev-server-url/webhooks/chargebee/events, for instance https://ellipsis-matteo.ngrok.io/webhooks/chargebee/events. More info.
  5. Enable metered billing: go to Settings > SITE SETTINGS > Site Info & Billing Rules, enable Notify and wait to close Invoices and to save the changes made click Update Site Info & Billing Rules. More info
  6. Create the following cutom fields: On Plan, a field of type checkbox, named "metered" On Customer, two single line fields, organization_id and organization_name On Subscription, two single line fields, organization_id and organization_name
  7. Plans and Addons are automatically created by the Playapp at start up.