Generic DAG Jobs Dashboard.
You will need Leiningen 2.0 or above installed.
$ rlwrap lein figwheel
$ lein repl
user=> (start) ; Server
user=> (start-fw) ; Figwheel; better start it independently.
CREATE USER ephyra WITH PASSWORD 'ephyra';
ALTER ROLE ephyra WITH LOGIN;
CREATE DATABASE ephyra_dev;
CREATE DATABASE ephyra_test;
GRANT ALL ON DATABASE ephyra_dev, ephyra_test to ephyra;
After executing these commands, the command below should succeed.
$ sh -c 'export PGPASSWORD=ephyra; psql --host localhost -U ephyra ephyra_dev -c "SELECT 1337 AS it_works"'
To customise, see profiles.clj.
$ lein migratus
$ lein migratus rollback
$ lein repl
user=> (migrate)
user=> (rollback)
OpenJDK 8 is recommended. 9 may still run but above that Leiningen won't even start.
To start a web server for the application, run:
$ lein run
Kafka consumer:
$ lein run consumer
Input is specified by specs in ephyra.jobs.persistence. Examples in resources/samples/events.
$ lein repl
user=> (migrate)
user=> (load-sample-events)
Another way is to send and receive events over Kafka from your job executor.
When running a compiled uberjar, following env vars are required:
export DATABASE_URL="postgresql://localhost/ephyra_dev?user=ephyra&password=ephyra"
export KAFKA_SERVER="localhost:9092" # Only for the consumer.
export EXECUTOR_RUN_JOB_URL="http://localhost:5000/run_plan"
export EXECUTOR_RUN_PLAN_URL="http://localhost:5000/run_plan"
SENTRY_DSN=...(check: https://sentry.io [optional])
Since JDBC cannot connect to Unix sockets on its own, you can use the trainwreck of a SocketFactory to connect to Cloud SQL Proxy Unix sockets: https://github.com/GoogleCloudPlatform/cloud-sql-jdbc-socket-factory#using
E.g.:
CLOUD_SQL_FORCE_UNIX_SOCKET=meh
DATABASE_URL='postgresql:///ephyra?user=ephyra&password=<XXX>&socketFactory=com.google.cloud.sql.postgres.SocketFactory&socketFactoryArg=<PROJECT_ID>:<REGION>:<DB_NAME>'
Limitations:
- The path Cloud SQL sockets must be mapped to is hardcoded to /cloudsql by the library.
- We have to set
CLOUD_SQL_FORCE_UNIX_SOCKET
(previouslyGAE_RUNTIME
) to something nonblank so the library doesn't try to connect via SSL instead.
See LICENCE.
Copyright © 2016-2018 Infectious Media Copyright © 2018- Infectious Media and Contributors