Skip to content

gleam-lang/packages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gleam Packages

📦 Search for Gleam packages on Hex.

A Gleam application using the Wisp web framework, served with the Mist web server, using a SQLite database.

The application is deployed on Fly where LiteFS is used to replicate the SQLite database across all instances of the application.

Environment variables

The application is configured with a series of environment variables.

  • HEX_API_KEY - Required. A read-only API key for the Hex API. You can generate one via the Hex dashboard.
  • DATABASE_PATH - A path where the SQLite database will be stored. Defaults to ./database.sqlite. In production this should be set to $LITEFS_MOUNT_PATH/database.sqlite.
  • LITEFS_PRIMARY_FILE - If this environment variable is set then the application will only attempt to pull information from Hex and insert into the database if there is no file present at this path. When deployed to Fly this file is created by LiteFS for the node that has been elected leader, and the path will be $LITEFS_MOUNT_PATH/.primary.

Local development

Install Gleam! See ./Dockerfile for which version is used in production.

# Download a recent copy of the database
rm -f database.sqlite*
curl -o database.sqlite https://packages.gleam.run/packages.sqlite

gleam test        # Run the tests
gleam run server  # Run the server

The SQL query functions are generated from the sql directory. To regenerate them run gleam run -m codegen.

Deployment

# Deploy the application
fly deploy