Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
160
Issues
160
List
Board
Labels
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
83e72f18
Verified
Commit
83e72f18
authored
Nov 29, 2024
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[cli] remove gargantext-server, replace by gargantext-cli server
parent
eec85c9f
Pipeline
#7055
failed with stages
in 12 minutes and 33 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
123 deletions
+30
-123
README.md
README.md
+1
-1
Types.hs
bin/gargantext-cli/CLI/Types.hs
+13
-0
Worker.hs
bin/gargantext-cli/CLI/Worker.hs
+1
-2
Main.hs
bin/gargantext-cli/Main.hs
+12
-7
Main.hs
bin/gargantext-server/Main.hs
+0
-89
gargantext.cabal
gargantext.cabal
+1
-22
EnvTypes.hs
src/Gargantext/API/Admin/EnvTypes.hs
+1
-1
Worker.hs
test/Test/API/Worker.hs
+1
-1
No files found.
README.md
View file @
83e72f18
...
...
@@ -115,7 +115,7 @@ From inside the `haskell-gargantext/` directory, run
### Multi-User with Graphical User Interface (Server Mode)
```
shell
$
~/.local/bin/stack
--docker
exec
gargantext-
server
--
--run
Prod
$
~/.local/bin/stack
--docker
exec
gargantext-
cli
--
server start
-m
Prod
```
Then you can log in with
`user1`
/
`1resu`
...
...
bin/gargantext-cli/CLI/Types.hs
View file @
83e72f18
...
...
@@ -16,6 +16,7 @@ module CLI.Types where
import
Data.String
import
Data.Text
(
Text
)
import
Gargantext.API.Admin.EnvTypes
(
Mode
)
import
Gargantext.Core.Config.Types
(
SettingsFile
(
..
))
import
Gargantext.Core.Types
(
NodeId
)
import
Gargantext.Core.Types.Query
...
...
@@ -93,6 +94,17 @@ data CLIRoutes
|
CLIR_export
FilePath
deriving
(
Show
,
Eq
)
data
CLIServer
=
CLIS_start
ServerArgs
|
CLIS_version
deriving
(
Show
,
Eq
)
data
ServerArgs
=
ServerArgs
{
server_mode
::
!
Mode
,
server_port
::
!
Int
,
server_toml
::
!
SettingsFile
}
deriving
(
Show
,
Eq
)
data
CLIWorker
=
CLIW_run
WorkerArgs
|
CLIW_runAll
WorkerAllArgs
...
...
@@ -127,6 +139,7 @@ data CLICmd
|
CCMD_upgrade
!
UpgradeArgs
|
CCMD_golden_file_diff
!
GoldenFileDiffArgs
|
CCMD_routes
!
CLIRoutes
|
CCMD_server
!
CLIServer
|
CCMD_worker
!
CLIWorker
deriving
(
Show
,
Eq
)
...
...
bin/gargantext-cli/CLI/Worker.hs
View file @
83e72f18
...
...
@@ -32,9 +32,8 @@ import Options.Applicative
import
Prelude
qualified
-- TODO Command to spawn all workers at once
-- TODO Command to monitor queues
-- TODO Support for KillWorkerSafely on Ctrl-C (so that the job in progress is moved back into the queue)
workerCLI
::
CLIWorker
->
IO
()
workerCLI
(
CLIW_run
(
WorkerArgs
{
..
}))
=
do
...
...
bin/gargantext-cli/Main.hs
View file @
83e72f18
...
...
@@ -11,29 +11,31 @@ Main specifications to index a corpus with a term list
-}
{-# LANGUAGE
Strict
#-}
{-# LANGUAGE
LambdaCase
#-}
{-# LANGUAGE
LambdaCase
#-}
{-# LANGUAGE
Strict
#-}
{-# LANGUAGE TypeApplications #-}
module
Main
where
import
Prelude
import
CLI.FilterTermsAndCooc
import
CLI.ObfuscateDB
(
obfuscateDB
,
obfuscateDBCmd
)
import
CLI.Types
import
Options.Applicative
import
CLI.Admin
(
adminCLI
,
adminCmd
)
import
CLI.FileDiff
(
fileDiffCLI
,
fileDiffCmd
)
import
CLI.FilterTermsAndCooc
import
CLI.Import
(
importCLI
,
importCmd
)
import
CLI.Ini
(
iniCLI
,
iniCmd
)
import
CLI.Init
(
initCLI
,
initCmd
)
import
CLI.Invitations
(
invitationsCLI
,
invitationsCmd
)
import
CLI.ObfuscateDB
(
obfuscateDB
,
obfuscateDBCmd
)
import
CLI.Phylo
(
phyloCLI
,
phyloCmd
)
import
CLI.Phylo.Profile
(
phyloProfileCLI
,
phyloProfileCmd
)
import
CLI.Server
(
serverCLI
,
serverCmd
)
import
CLI.Server.Routes
(
routesCLI
,
routesCmd
)
import
CLI.Types
import
CLI.Upgrade
(
upgradeCLI
,
upgradeCmd
)
import
CLI.Worker
(
workerCLI
,
workerCmd
)
import
Options.Applicative
import
Prelude
runCLI
::
CLI
->
IO
()
runCLI
=
\
case
...
...
@@ -63,6 +65,8 @@ runCLI = \case
->
fileDiffCLI
args
CLISub
(
CCMD_routes
args
)
->
routesCLI
args
CLISub
(
CCMD_server
args
)
->
serverCLI
args
CLISub
(
CCMD_worker
args
)
->
workerCLI
args
...
...
@@ -89,5 +93,6 @@ allOptions = subparser (
upgradeCmd
<>
fileDiffCmd
<>
routesCmd
<>
serverCmd
<>
workerCmd
)
bin/gargantext-server/Main.hs
deleted
100644 → 0
View file @
eec85c9f
{-|
Module : Main.hs
Description : Gargantext starter
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Script to start gargantext with different modes (Dev, Prod, Mock).
-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE TypeOperators #-}
-- {-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE TypeFamilies #-}
module
Main
where
import
Data.Text
(
unpack
)
import
Data.Version
(
showVersion
)
import
GHC.IO.Encoding
import
Gargantext.API
(
startGargantext
)
-- , startGargantextMock)
import
Gargantext.API.Admin.EnvTypes
import
Gargantext.API.Admin.Settings
import
Gargantext.Core.Config.Types
(
SettingsFile
(
..
))
import
Gargantext.Prelude
import
Gargantext.System.Logging
import
Options.Generic
import
System.Exit
(
exitSuccess
)
import
qualified
Paths_gargantext
as
PG
-- cabal magic build module
instance
ParseRecord
Mode
instance
ParseField
Mode
instance
ParseFields
Mode
data
MyOptions
w
=
MyOptions
{
run
::
w
:::
Mode
<?>
"Possible modes: Dev | Mock | Prod"
,
port
::
w
:::
Maybe
Int
<?>
"By default: 8008"
,
toml
::
w
:::
Maybe
FilePath
<?>
"By default: gargantext-settings.toml"
,
version
::
w
:::
Bool
<?>
"Show version number and exit"
}
deriving
(
Generic
)
instance
ParseRecord
(
MyOptions
Wrapped
)
deriving
instance
Show
(
MyOptions
Unwrapped
)
main
::
IO
()
main
=
withLogger
()
$
\
ioLogger
->
do
-- Sets the locale to avoid encoding issues like in #284.
setLocaleEncoding
utf8
currentLocale
<-
getLocaleEncoding
MyOptions
myMode
myPort
mb_tomlFile
myVersion
<-
unwrapRecord
"Gargantext server"
---------------------------------------------------------------
if
myVersion
then
do
logMsg
ioLogger
INFO
$
"Version: "
<>
showVersion
PG
.
version
System
.
Exit
.
exitSuccess
else
return
()
---------------------------------------------------------------
let
myPort'
=
case
myPort
of
Just
p
->
p
Nothing
->
8008
tomlFile
=
SettingsFile
$
case
mb_tomlFile
of
Nothing
->
"gargantext-settings.toml"
Just
i
->
i
---------------------------------------------------------------
let
start
=
case
myMode
of
Mock
->
panicTrace
"[ERROR] Mock mode unsupported"
_
->
startGargantext
myMode
myPort'
tomlFile
logMsg
ioLogger
INFO
$
"Starting with "
<>
show
myMode
<>
" mode."
logMsg
ioLogger
INFO
$
"Machine locale: "
<>
show
currentLocale
start
---------------------------------------------------------------
gargantext.cabal
View file @
83e72f18
...
...
@@ -651,6 +651,7 @@ executable gargantext-cli
CLI.Phylo
CLI.Phylo.Common
CLI.Phylo.Profile
CLI.Server
CLI.Server.Routes
CLI.Types
CLI.Upgrade
...
...
@@ -694,28 +695,6 @@ executable gargantext-cli
, vector ^>= 0.12.3.0
ghc-options: -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates -Wmissing-signatures -Wunused-binds -Wunused-imports -Werror -freduction-depth=300 -fprint-potential-instances
executable gargantext-server
import:
defaults
, optimized
main-is: Main.hs
other-modules:
Paths_gargantext
hs-source-dirs:
bin/gargantext-server
build-depends:
cassava ^>= 0.5.2.0
, containers ^>= 0.6.7
, extra ^>= 1.7.9
, gargantext
, gargantext-prelude
, ini ^>= 0.4.1
, optparse-generic ^>= 1.4.7
, postgresql-simple ^>= 0.6.4
, text ^>= 2.0.2
, unordered-containers ^>= 0.2.16.0
, vector ^>= 0.12.3.0
common testDependencies
build-depends:
base >=4.7 && <5
...
...
src/Gargantext/API/Admin/EnvTypes.hs
View file @
83e72f18
...
...
@@ -61,7 +61,7 @@ import System.Log.FastLogger qualified as FL
data
Mode
=
Dev
|
Mock
|
Prod
deriving
(
Show
,
Read
,
Generic
)
deriving
(
Show
,
Read
,
Generic
,
Eq
)
-- | Given the 'Mode' the server is running in, it returns the list of
-- allowed levels. For example for production we ignore everything which
...
...
test/Test/API/Worker.hs
View file @
83e72f18
...
...
@@ -63,7 +63,7 @@ tests = sequential $ aroundAll withTestDBAndPort $ do
_
<-
sendJobWithCfg
cfg
Ping
mTimeout
<-
Timeout
.
timeout
(
5
*
1
000
000
)
$
do
mTimeout
<-
Timeout
.
timeout
(
5
*
1
_000_
000
)
$
do
md
<-
atomically
$
readTChan
tchan
md
`
shouldBe
`
Just
DT
.
NPing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment