*[FRONT][ERGO][[Node Phylo] Default initial behaviour on clicking a Phylo node for the 1st time (#582)](https://gitlab.iscpif.fr/gargantext/purescript-gargantext/issues/582)
*[BACK][PROXY][Enabling the microservices proxy trigger endless "Refresh to update" modals (#374)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/374)
*[BACK][REFACT][[REFACTORING] renaming Corpus to Document for HAL related file (#372)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/372)
## Version 0.0.7.1.12
*[BACK][INFRA][Microservices notes proxy doesn't work with local CodiMD (#370)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/370)
*[BACK][DOC][[Documentation] Document development tooling (#371)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/371)
## Version 0.0.7.1.11
*[BACK][SECURITY][Allow the microservices proxy to be disabled or enabled by configuration settings (#369)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/369)
## Version 0.0.7.1.10
*[BACK][FIX][Improving message error from the TSV import (#361)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/361)
*[BACK][FIX][Creation of corpus from HAL's API crash (#366)](https://gitlab.iscpif.fr/gargantext/haskell-gargantext/issues/366)
Enter a Nix shell. This will take a long time the first time you run it:
In what follows, many commands need to be executed from within the Nix shell. To make that clear, those will be prefixed with `n$`, *but you must not actually type `n$` before the commands*.
To enter a Nix shell, run the following (this will take a moment the first time you run it, be patient):
```shell
nix-shell
$ nix-shell
```
Once you are in a Nix shell, you can run commands like you would in any other shell.
You can exit a Nix shell at any point with `exit`.
In what follows, many commands need to be executed from within the Nix shell. To make that clear, those will be prefixed with `n$`, *but you must not actually type `n$` before the commands*.
At any point, you can exit a Nix shell and go back to your regular shell by running `exit`.
If for some reason you do not want to enter a Nix shell, you can still run a command from outside:
If for some reason you do not want to enter a Nix shell, you can still run a command from outside: running the following in a non-Nix shell
```shell
nix-shell --run"my command"
$ nix-shell --run"my command"
```
is equivalent to running `my command` from within a Nix shell.
#### Disable optimization flags
#### (Optional) Disable optimization flags
Make a file `cabal.project.local` that will tell Cabal to turn off optimizations:
If you are developing Gargantext, you might be interested in disabling compiler optimizations.
This speeds up compilation, but the compiled program itself will be less efficient.
To disable compiler optimizations, copy the file `cabal.project.local_toCopy` (which contains the flags that disable optimizations) into `cabal.project.local` (which will be read by Cabal):
*Note: This project can be built with either stack or cabal. We keep the `cabal.project` up-to-date, which allows us to build with cabal by default but we support stack thanks to thanks to `cabal2stack`, which allows us to generate a valid `stack.yaml` from a `cabal.project`. Due to the fact gargantext requires a particular set of system dependencies (C++ libraries, toolchains, etc) we use nix to setup an environment with all the required system dependencies, in a sandboxed and isolated fashion.*
*This documentation shows how to build with cabal. For information related to stack, see `docs/using_stack.md`.*
**From within the Nix shell**, run:
Depending on your situation, there are several ways to build the project:
1.**Simple build**
*This will build the project and install the executables `gargantext-cli` and `gargantext-server` somewhere on your system.
Depending on your Cabal configuration, this is probably `~/.local/bin/` or `~/.cabal/bin/`.*
From within the Nix shell, run:
```shell
n$ cabal update
n$ cabal install
```
#### Build the backend and frontend
2.**Full build**
*Same as "simple build" above, but also runs tests and builds documentation.*
Just run the `install` script:
```shell
$ ./bin/install
```
3.**Build and run**
*Builds and runs the Gargantext server. This has the advantage of letting you run Gargantext without having to know where on your machine the executable is.*
*Since you will be running Gargantext,***you need to have gone through initialization first;***see "Initializing and running" below.*
From inside a Nix shell:
```shell
./bin/install
cd purescript-gargantext/
./bin/install
cd ..
n$ cabal run gargantext-server ----ini gargantext.ini --run Prod
```
### Initializing and running
...
...
@@ -96,8 +126,8 @@ cd ..
#### Start containers for database and NLP software bricks
```shell
cd devops/docker
docker compose up
$ cd devops/docker
$ docker compose up
```
The initialization schema should be loaded automatically from `devops/postgres/schema.sql`.
...
...
@@ -105,7 +135,7 @@ The initialization schema should be loaded automatically from `devops/postgres/s
#### Create configuration file
```shell
cp gargantext.ini_toModify gargantext.ini
$ cp gargantext.ini_toModify gargantext.ini
```
> `.gitignore` excludes this file, so you don't need to worry about committing it by mistake, and you can change the passwords in `gargantext.ini` safely.
...
...
@@ -121,24 +151,25 @@ The master user's name is automatically set to `gargantua`, but you will be prom
#### Running
From inside a Nix shell:
Make sure you know where `gargantext-server` is (probably in `~/.local/bin/` or `.cabal/bin/`). If the location is in your `$PATH`, just run:
```shell
n$ cabal run gargantext-server ----ini gargantext.ini --run Prod
(If the location is not in your `$PATH`, just prefix `gargantext-server` with the path to it.)
If you are working on the backend, you might want to use the `./start` script: it rebuilds the backend, starts the docker containers, and launches the Gargantext server at once.
You might want to use the `./start` script: it rebuilds the backend, starts the docker containers, and launches the Gargantext server at once.
@@ -157,12 +188,19 @@ When a devlopment is needed on libraries (for instance, the HAL crawler in https
> Note: without `stack.yaml` we would have to only fix `cabal.project` -> `source-repository-package` commit id. Sha256 is there to make sure CI reruns the tests.
### Tooling info
Once you get Gargantext to compile and run on your machine, you will likely want
the following:
- Language support (intellisense) in your editor; see `docs/editor_setup.md`
- Being able to send commands to the Gargantext server from GHCI; see `docs/running_commands.md`
## Use Cases <a name="use-cases"></a>
### Multi-User with Graphical User Interface (Server Mode)
We store the repository in directory `repos` in the [CBOR](https://cbor.io/) file format. To decode it to JSON and analyze, say, using [jq](https://shapeshed.com/jq-json/), use the following command:
Then, shut down the container, replace `image` section in `devops/docker/docker-compose.yaml` with `postgres:14`. Also, it is a good practice to create a new volume, say `garg-pgdata14` and bind the new container to it. If you want to keep the same volume, remember about removing it like so:
```sh
docker-compose rm postgres
docker volume rm docker_garg-pgdata
```shell
$ docker-compose rm postgres
$ docker volume rm docker_garg-pgdata
```
Now, start the container and execute:
```sh
# need to drop the empty DB first, since schema will be created when restoring the dump
Restart VSCodium, open the `haskell-gargantext` project. Wait a few seconds;
you might get a popup telling you that GHCup needs to download some version
of GHC; accept.
Now *if everything went well*, you should have Haskell intellisense working
in your editor: hover over a symbol to get its type and documentation,
right-click a symbol and click "Jump to definition" to jump to its definition,
etc.
Sadly, there is a good chance that something did go wrong. To help you
troubleshoot, here's a rundown of what should have happened under the hood when
you opened the project — assuming I didn't misunderstand anything:
1. The `direnv` extension sees the `.envrc` file at the root of the project,
and sets the environment variables accordingly (all `.envrc` actually says
is to use a Nix shell).
2. The `haskell` extension looks up what version of GHC is needed and tells that
to GHCup.
3. If needed, GHCup downloads the right version of GHC for the project and adds
it to its collection of GHC compilers in `~/.ghcup/ghc/`
4. Now the `haskell` extension has everything it needs.
Things to try if something goes wrong
--------------------------------------
- Make sure that you have compiled the project before.
- The current HLS version might be too recent to work with your GHC version.
To check that and use an adequate HLS version:
- Check out the project's GHC version around the beginning of `cabal.project`;
- Look up the corresponding "Last supporting HLS version" in [this table](https://haskell-language-server.readthedocs.io/en/latest/support/ghc-version-support.html#current-ghc-version-support-status).
For instance, if the project's GHC version is 9.4.7, you need HLS v2.5.0.0 *at most*.
- Tell GHCup to compile the corresponding version of HLS based the corresponding version of GHC,
with the following command (again, using GHC 9.4.7 as an example):
```shell
$ ghcup compile hls --version 2.5.0.0 --ghc 9.4.7
```
Now in principle the VSCodium `haskell` extension should have everything
elseLeft$("Encapsulation problem at line "<>pack(showligne)<>" in column '"<>columnHeader<>"' : the caracter \" must only appear at the beginning and the end of a field ")
elsereturnTrue
-- else Left $ ("The column '" <> columnHeader <> "' at line " <> pack (show ligne) <> " is empty")
-- Put a warning for the user to know their is a problem (empty column)
testErrorPerLine_del[]l|del==Comma=Left(pack$"Too much field at line "<>showl<>". Try using tabulation as a delimiter. Other delimiter like comma (,) may appear in some text.")
|otherwise=Left(pack$"Too much field at line "<>showl)
testErrorPerLine[]__l=Left(pack$"Missing one field at line "<>showl)