Skip to content

flora-pm/flora-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

9fced39 · Sep 10, 2022
Sep 10, 2022
Aug 25, 2022
Sep 10, 2022
Jul 23, 2022
Sep 10, 2022
Aug 8, 2022
Dec 15, 2021
Sep 10, 2022
May 25, 2022
Apr 26, 2022
Sep 10, 2022
Sep 9, 2022
Dec 30, 2021
Aug 12, 2022
Aug 5, 2022
Nov 13, 2021
Sep 10, 2022
Nov 25, 2021
Jun 28, 2022
Aug 24, 2022
Feb 23, 2022
Aug 6, 2022
Jun 22, 2022
Sep 10, 2022
Sep 10, 2022
Dec 30, 2021
Apr 16, 2022
Jun 26, 2022
Mar 27, 2022
Apr 17, 2022
Sep 10, 2022
Sep 10, 2022
Aug 25, 2022
Jun 20, 2022

Repository files navigation

Flora
A package index for the Haskell ecosystem

Logo

CI badge made with Haskell Matrix chatroom badge

Flora.pm
A read-only mirror of hackage.haskell.org with an improved and lightweight interface.

Flora Server
An alternative package index server for the Haskell ecosystem with mirroring capabilities.

Read More

Installation and Configuration

For ease of development, a shell.nix file is provided. It brings with it system dependency and tooling.

To jump into the development environment, use make nix-shell. It is impure by default, so your editor and development tools will still be accessible.

System dependencies

Flora server

The configuration is handled through environment variables. They are all prefixed by FLORA_ to avoid conflict, and the server will tell you which ones are missing.

To start in the best of conditions, create a file called environment.local.sh with the following content:

source environment.sh

# export FLORA_SENTRY_DSN="" # Don't forget to add your Sentry DSN if you use it!
# export FLORA_PROMETHEUS_ENABLED="true"

This will get all the variables from environment.sh and allow you to override them.

You can then build the server with

# To build the binaries
$ make build
# To load the main library in a REPL
$ make repl

Database

The Flora server uses PostgreSQL 14.

To create the database and apply the migrations, type:

$ make db-setup # Implies db-create

you can also use db-create and db-drop to create and delete the database in the PostgreSQL instance.

Docker Workflow

A docker-based workflow is provided. The idea is to develop from within a container that brings with it all dependencies, and communicates with another container for the PostgreSQL database.

# You need to build the container first. It's gonna take around 13 minutes the first time you build
$ make docker-build
# Start the container.
$ make docker-start
# Once the containers are running, you can enter the development environment and start hacking
$ make docker-enter
# You'll be in the docker container. Environment variables are automatically set 
# so you should be able to start Flora
(docker)$ make nix-tmux
# You'll be in a tmux session, everything should be launched
# Visit localhost:8084 from your web browser to see if it all works.

# To provision the development database, type:
$ make docker-enter
(docker)$ source environment.docker.sh
(docker)$ make db-drop  # password is 'postgres' by default
(docker)$ make db-setup # password is 'postgres' by default
(docker)$ make nix-provision
# And you should be good!

Importing everything from Hackage

  1. Download the archive containing all packages here
  2. Extract it in Flora's root directory. You should now have a 01-index folder
  3. Run make import-from-hackage

You can explore the Makefile rules by typing make in your shell.