/glam

(WIP) a webapp for language documentation

Primary LanguageClojureEclipse Public License 2.0EPL-2.0

Introduction

Glam is an app for linguistic data annotation that's still under construction. It's built using Clojure(Script), Material-UI, Fulcro, and XTDB. Check back soon 🚧

Resources:

Installation

(These instructions are a sketch--more detailed instructions will be given later.)

  1. Secure a server that will run the app. We will assume you are using an Ubuntu machine.
  2. Download a JAR from the latest release.
  3. Configure the JAR as a service.
  4. Set up HTTPS. If you do not set up HTTPS, your instance of Glam will be vulnerable to password-stealing attacks. Fortunately, this is fairly easy--we recommend running Glam on the default port (8080) and using a reverse proxy like Nginx with certbot to provide HTTPS.

Development

First, take care of dependencies. You will need to:

  1. Install Clojure CLI tools
  2. Install NPM and Node
  3. Install Yarn

Running: Command Line

# install dependencies
$ yarn
# start compiling CLJS--leave this running in a terminal session...
$ yarn client
# and in a separate session, start a server repl--note you'll have to type `(start)`
$ yarn server
clojure -A:dev
Clojure 1.10.1
user=> (start)
# navigate to localhost:8085, and see package.json for more

Running: IntelliJ + Cursive

On the terminal:

yarn client

Clojure Server Profile:

  1. Make a new profile based on "Clojure REPL > Local"
  2. Select "Run with Deps"
  3. Put dev in Aliases
  4. Run and write (start)
  5. See src/dev/user.clj for development tools.

ClojureScript Client Profile:

  1. Make a new profile based on "Clojure REPL > Remote"
  2. Connection type: nREPL
  3. Connection details: "Use port from nREPL file"
  4. Project: glam
  5. Make sure you're entered (start) in the server.
  6. Navigate to localhost:8085
  7. Run your client profile and enter:
(require '[shadow.cljs.devtools.api :as shadow])
(shadow/repl :main)
  1. Write (js/console.log "hi") and ensure that it was printed out to the console in your browser session

Yarn Commands

Note: all docs command will require additional dependencies for asciidoctor. Use gem to get them.

  • client: Start the shadow-cljs ClojureScript compiler, which will compile code to JS and also hot reload any changes.
  • client/cljs-repl: Get a client CLJS REPL (note: requires a running browser session).
  • client/clj-repl: Get a client CLJ REPL (note: this is only useful if you want to fiddle with shadow-cljs, which is rare).
  • server: Start a server REPL. (This will not start the server automatically--to do that, you need to type (start).)
  • start: Convenience function for running client/main and server.
  • clean: Remove all compilation artefacts.
  • client/release: Build the single .js bundle for a production release.
  • server/release: Build the single .jar file for a production release.
  • release: Convenience function for running client/release and server/release.
  • test: Run all Clojure tests. (Currently, there are no CLJS tests.)
  • clojure-outdated: Check Clojure dependencies for oudatedness.
  • npm-outdated: Check NPM dependencies for outdatedness.
  • loc: Count lines of code (requires cloc: npm install -g cloc).
  • docs/html: Compile docs/book.adoc into HTML at target/book.html
  • docs/pdf: Compile docs/book.adoc into a PDF at target/book.pdf
  • docs: Perform docs/html and docs/pdf

Swagger UI for REST API

Navigate to http://localhost:8085/rest-api/v1/docs/index.html

XTDB Inspector

Set the environment variable XTDB_INSPECTOR_URI_PREFIX=/_inspector (e.g. XTDB_INSPECTOR_URI_PREFIX=/_inspector yarn server), and see http://localhost:8085/_inspector/attr