Documentation ¶
Index ¶
Constants ¶
const ( EnvPrefixOld = "pydio" EnvPrefixNew = "cells" )
Variables ¶
var AclCmd = &cobra.Command{ Use: "acl", Short: "Manage access control lists", Long: ` DESCRIPTION ACLs are managed in a dedicated microservice. It is simpler to manage them in the frontend, but you can use this command to create/delete/search ACLs directly. ACLs are used to grant permissions to a given node (retrieved by UUID) for a given Role. `, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
AclCmd represents the acl command
var AdminCmd = &cobra.Command{ Use: "admin", Short: "Direct Read/Write access to Cells data", Long: ` DESCRIPTION Set of commands with direct access to Cells data. These commands require a running Cells instance. They connect directly to low-level services using gRPC connections. They are not authenticated. `, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { bindViperFlags(cmd.Flags(), map[string]string{}) initConfig() return nil }, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
AdminCmd groups the data manipulation commands The sub-commands are connecting via gRPC to a **running** Cells instance.
var CleanCmd = &cobra.Command{ Use: "clean", PersistentPreRun: func(cmd *cobra.Command, args []string) { bindViperFlags(cmd.Flags(), map[string]string{}) }, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, Short: "Housekeeping commands", Long: "Collection of tools for purging Cells internal data (activities, logs, etc)", }
var ConfigCmd = &cobra.Command{ Use: "config", Short: "Configuration manager", Long: ` DESCRIPTION Set of commands providing programmatic access to stored configuration. `, PersistentPreRun: func(cmd *cobra.Command, args []string) { bindViperFlags(cmd.Flags(), map[string]string{}) }, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
ConfigCmd represents the config command
var ConfigureCmd = &cobra.Command{ Use: "configure", Aliases: []string{"install"}, Short: "Setup required configurations", Long: ` DESCRIPTION Launch the configuration process of Pydio Cells. REQUIREMENTS You must have an available MySQL database, along with a privileged user (for instance 'pydio'). Supported databases are: - MariaDB version 10.3 and above, - MySQL version 5.7 and above (except 8.0.22 that has a bug preventing Cells to run correctly). As recommended by database documentation, tune the 'max_connections' parameter to a value in line with your production database server specifications. For reference, the default value of 151 will have a maximum memory usage of about 575MB, but will not scale up for a multiple users load in production. BROWSER-BASED INSTALLER If you are on a desktop machine, pick browser-based installation at first prompt, or you can force it with: $ ` + os.Args[0] + ` configure --bind default The installer opens a web page on port 8080 with a wizard for you to provide various configuration parameters, including DB connection info and the login/password of the main administrator. In case where default port is busy, you can choose another one via the 'bind' flag, for instance: $ ` + os.Args[0] + ` configure --bind 0.0.0.0:12345 or $ ` + os.Args[0] + ` configure --bind <your server IP or FQDN>:12345 After browser configuration, all microservices are started automatically and you can directly start using Cells. It is yet good practice to stop the installer and restart Cells in normal mode before going live. COMMAND-LINE INSTALLER If you are more a shell person, you can perform the configuration process directly using this CLI (using the '--cli' flag or by choosing so at first prompt). You will then be able to choose to either use the default bindings for the embedded webserver or adapt these to your specific setup. You can always reconfigure the webserver bindings afterwards by calling this command: $ ` + os.Args[0] + ` configure sites See corresponding inline documentation for further details. AUTOMATED PROVISIONING For automated, non-interactive installation, you can pass a YAML or a JSON config file that contains all necessary information, please refer to the documentation on https://pydio.com ENVIRONMENT All the command flags documented below are mapped to their associated ENV var using upper case and CELLS_ prefix. For example : $ ` + os.Args[0] + ` configure --bind :9876 is equivalent to $ export CELLS_BIND=":9876"; ` + os.Args[0] + ` configure For backward compatibility reasons, the --cli, --yaml and --json flags do not respect the above rule (this might evolve in a future version). They are respectively equivalent to CELLS_INSTALL_CLI, CELLS_INSTALL_YAML and CELLS_INSTALL_JSON ENV vars. `, PreRunE: func(cmd *cobra.Command, args []string) error { if err := checkFdlimit(); err != nil { return err } replaceKeys := map[string]string{ cruntime.KeyInstallYamlLegacy: cruntime.KeyInstallYaml, cruntime.KeyInstallJsonLegacy: cruntime.KeyInstallJson, cruntime.KeyInstallCliLegacy: cruntime.KeyInstallCli, } cmd.Flags().VisitAll(func(flag *pflag.Flag) { key := flag.Name if replace, ok := replaceKeys[flag.Name]; ok { key = replace } viper.BindPFlag(key, flag) }) initConfig() niModeCli = cruntime.GetBool(cruntime.KeyInstallCli) niYamlFile = cruntime.GetString(cruntime.KeyInstallYaml) niJsonFile = cruntime.GetString(cruntime.KeyInstallJson) niExitAfterInstall = cruntime.GetBool(cruntime.KeyInstallExitAfter) niBindUrl = cruntime.GetString(cruntime.KeySiteBind) niExtUrl = cruntime.GetString(cruntime.KeySiteExternal) niNoTls = cruntime.GetBool(cruntime.KeySiteNoTLS) niCertFile = cruntime.GetString(cruntime.KeySiteTlsCertFile) niKeyFile = cruntime.GetString(cruntime.KeySiteTlsKeyFile) niLeEmailContact = cruntime.GetString(cruntime.KeySiteLetsEncryptEmail) niLeAcceptEula = cruntime.GetBool(cruntime.KeySiteLetsEncryptAgree) niLeUseStagingCA = cruntime.GetBool(cruntime.KeySiteLetsEncryptStaging) return nil }, Run: func(cmd *cobra.Command, args []string) { cmd.Println("") cmd.Println("\033[1mWelcome to " + common.PackageLabel + " installation\033[0m ") cmd.Println(common.PackageLabel + " (v" + common.Version().String() + ") will be configured to run on this machine.") cmd.Println("Make sure to prepare access and credentials to a MySQL 5.6+ (or MariaDB equivalent) server.") cmd.Println("Pick your installation mode when you are ready.") cmd.Println("") var proxyConf *install.ProxyConfig if niYamlFile != "" || niJsonFile != "" || niBindUrl != "" { installConf, err := nonInteractiveInstall(cmd, args) fatalIfError(cmd, err) if installConf.FrontendLogin != "" { return } proxyConf = installConf.GetProxyConfig() } else { if !niModeCli { p := promptui.Select{Label: "Installation mode", Items: []string{"Browser-based (requires a browser access)", "Command line (performed in this terminal)"}} installIndex, _, err := p.Run() fatalIfError(cmd, err) niModeCli = installIndex == 1 } sites, err := config.LoadSites() fatalIfError(cmd, err) proxyConf = sites[0] proxyConf, err = switchDefaultTls(cmd, proxyConf, niNoTls) fatalIfError(cmd, err) if !niModeCli { var message string proxyConf, message, err = checkDefaultBusy(cmd, proxyConf, true) fatalIfError(cmd, err) if message != "" { cmd.Println(promptui.IconWarn, message) } } } if niModeCli { _, err := cliInstall(cmd, proxyConf) fatalIfError(cmd, err) } else { performBrowserInstall(cmd, proxyConf) } if niExitAfterInstall || (niModeCli && cmd.Name() != "start") { cmd.Println("") cmd.Println(promptui.IconGood + "\033[1m Installation Finished\033[0m") cmd.Println("") return } return }, }
ConfigureCmd launches a wizard (either in this CLI or in your web browser) to configure a new instance of Pydio Cells.
var DataSourceCmd = &cobra.Command{ Use: "datasource", Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, Short: "Datasource management commands", Long: "Collection of tools for manipulating datasources.", }
var (
DefaultStartCmd *cobra.Command
)
var DocCmd = &cobra.Command{ Use: "doc", Hidden: true, Short: "Manage documentation about Cells and this CLI tool", Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
var FilesCmd = &cobra.Command{ Use: "files", Short: "Directly manage files and metadata on the nodes", Long: ` DESCRIPTION Manage metadata linked to nodes. Metadata are stored as simple key/values and attached to a node UUID. `, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
var JsonRequest = &cobra.Command{ Use: "json", Run: func(cmd *cobra.Command, args []string) { action := &cmd2.RpcAction{} action.Init(&jobs.Job{}, &jobs.Action{ Parameters: map[string]string{ "service": "pydio.grpc.mailer", "method": "mailer.MailerService.ConsumeQueue", "request": "{}", }, }) action.Run(context.Background(), nil, jobs.ActionMessage{}) action2 := &cmd2.RpcAction{} action2.Init(&jobs.Job{}, &jobs.Action{ Parameters: map[string]string{ "service": "pydio.grpc.role", "method": "idm.RoleService.SearchRole", "request": "{}", }, }) _, e := action2.Run(context.Background(), nil, jobs.ActionMessage{}) fmt.Println(e) }, }
var RootCmd = &cobra.Command{ Use: os.Args[0], Short: "Secure File Sharing for business", Long: ` DESCRIPTION Pydio Cells is self-hosted Document Sharing & Collaboration software for organizations that need advanced sharing without security trade-offs. Cells gives you full control of your document sharing environment – combining fast performance, huge file transfer sizes, granular security, and advanced workflow automations in an easy-to-set-up and easy-to-support self-hosted platform. CONFIGURE For the very first run, use '` + os.Args[0] + ` configure' to begin the browser-based or command-line based installation wizard. Services will automatically start at the end of a browser-based installation. RUN Run '$ ` + os.Args[0] + ` start' to load all services. WORKING DIRECTORIES By default, application data is stored under the standard OS application dir: - Linux: ${USER_HOME}/.config/pydio/cells - Darwin: ${USER_HOME}/Library/Application Support/Pydio/cells - Windows: ${USER_HOME}/ApplicationData/Roaming/Pydio/cells You can customize the storage locations with the following ENV variables: - CELLS_WORKING_DIR: replace the whole standard application dir - CELLS_DATA_DIR: replace the location for storing default datasources (default CELLS_WORKING_DIR/data) - CELLS_LOG_DIR: replace the location for storing logs (default CELLS_WORKING_DIR/logs) - CELLS_SERVICES_DIR: replace location for services-specific data (default CELLS_WORKING_DIR/services) LOGS LEVEL By default, logs are outputted in console format at the Info level and appended to a CELLS_LOG_DIR/pydio.log file. You can: - Change the level (debug, info, warn or error) with the --log flag - Output the logs in json format with --log_json=true - Prevent logs from being written to a file with --log_to_file=false For backward compatibility: - The CELLS_LOGS_LEVEL environment variable still works to define the --log flag (or CELLS_LOG env var) but is now deprecated and will disappear in version 4. - The --log=production flag still works and is equivalent to "--log=info --log_json=true --log_to_file=true" `, }
RootCmd represents the base command when called without any subcommands
var StartCmd = &cobra.Command{ Use: "start", Short: "A brief description of your command", Long: `A longer description that spans multiple lines and likely contains examples and usage of using your command. For example: Cobra is a CLI library for Go that empowers applications. This application is a tool to generate the needed files to quickly create a Cobra application.`, PreRunE: func(cmd *cobra.Command, args []string) error { runtime.SetArgs(args) bindViperFlags(cmd.Flags(), map[string]string{ runtime.KeyFork: runtime.KeyForkLegacy, }) initLogLevel() metrics.Init() initConfig() handleSignals(args) return nil }, RunE: func(cmd *cobra.Command, args []string) error { ctx := cmd.Context() pluginsReg, err := registry.OpenRegistry(ctx, "mem:///?cache=plugins&byname=true") reg, err := registry.OpenRegistry(ctx, runtime.RegistryURL()) if err != nil { return err } clientgrpc.WarnMissingConnInContext = true conn, err := grpc.Dial("cells:///", clientgrpc.DialOptionsForRegistry(reg)...) if err != nil { return err } ctx = servercontext.WithRegistry(ctx, reg) ctx = servicecontext.WithRegistry(ctx, pluginsReg) ctx = clientcontext.WithClientConn(ctx, conn) ctx = nodescontext.WithSourcesPool(ctx, nodes.NewPool(ctx, reg)) broker.Register(broker.NewBroker(runtime.BrokerURL(), broker.WithContext(ctx))) runtime.InitGlobalConnConsumers(ctx, "main") go initLogLevelListener(ctx) runtime.Init(ctx, "main") services, err := pluginsReg.List(registry.WithType(pb.ItemType_SERVICE)) if err != nil { return err } var ( srvGRPC server.Server srvHTTP server.Server srvGeneric server.Server srvs []server.Server ) for _, ss := range services { var s service.Service if !ss.As(&s) { continue } if !runtime.IsRequired(s.Name(), s.Options().Tags...) { continue } opts := s.Options() opts.Context = servicecontext.WithRegistry(opts.Context, reg) opts.Context = servicecontext.WithKeyring(opts.Context, keyring) if opts.Fork && !runtime.IsFork() { if !opts.AutoStart { continue } srvFork := fork.NewServer(opts.Context) var srvForkAs *fork.ForkServer if srvFork.As(&srvForkAs) { srvForkAs.RegisterForkParam(opts.Name) } srvs = append(srvs, srvFork) opts.Server = srvFork continue } if opts.Server != nil { srvs = append(srvs, opts.Server) } else if opts.ServerProvider != nil { serv, er := opts.ServerProvider(ctx) if er != nil { log.Fatal(er) } opts.Server = serv srvs = append(srvs, opts.Server) } else { if s.IsGRPC() { if srvGRPC == nil { lis, err := net.Listen("tcp", runtime.GrpcBindAddress()) if err != nil { return err } srvGRPC = servergrpc.New(ctx, servergrpc.WithListener(lis)) srvs = append(srvs, srvGRPC) } opts.Server = srvGRPC } if s.IsREST() { if srvHTTP == nil { if runtime.HttpServerType() == runtime.HttpServerCaddy { if s, e := caddy.New(opts.Context, ""); e != nil { log.Fatal(e) } else { srvHTTP = s } } else { srvHTTP = http.New(ctx) } srvs = append(srvs, srvHTTP) } opts.Server = srvHTTP } if s.IsGeneric() { if srvGeneric == nil { srvGeneric = generic.New(ctx) srvs = append(srvs, srvGeneric) } opts.Server = srvGeneric } } opts.Server.BeforeServe(s.Start) opts.Server.AfterServe(func() error { if err := reg.Register(s); err != nil { return err } return nil }) opts.Server.BeforeStop(s.Stop) } go func() { ch, err := config.WatchMap("services") if err != nil { return } for kv := range ch { s, err := reg.Get(kv.Key) if err != nil { continue } var rs service.Service if s.As(&rs) && rs.Options().AutoRestart { rs.Stop() rs.Start() } } }() for _, srv := range srvs { go func(srv server.Server) { if err := srv.Serve(); err != nil { fmt.Println(err) } return }(srv) } select { case <-cmd.Context().Done(): } for _, srv := range srvs { if err := srv.Stop(); err != nil { fmt.Println("Error stopping server ", err) } } return nil }, }
StartCmd represents the start command
var TestExternalGrpc = &cobra.Command{ Use: "grpc", Short: "Sample GRPC request sent to web-facing interface", RunE: func(cmd *cobra.Command, args []string) error { creds, err := loadTLSCredentials() if err != nil { return err } conn, err := grpc.Dial(extAddr, grpc.WithTransportCredentials(creds)) if err != nil { return err } cli := tree.NewNodeProviderClient(conn) md := metadata.MD{} md.Set("x-pydio-bearer", extToken) og := metadata.NewOutgoingContext(context.Background(), md) stream, e := cli.ListNodes(og, &tree.ListNodesRequest{Node: &tree.Node{Path: "common-files"}}) if e != nil { return e } for { rsp, er := stream.Recv() if er != nil { if er != io.EOF { return er } break } fmt.Println(rsp.GetNode().GetPath(), rsp.GetNode().GetType(), rsp.GetNode().GetSize()) } return nil }, }
var ToolsCmd = &cobra.Command{ Use: "tools", Short: "Additional tools", Long: ` DESCRIPTION Various commands that do not require a running Cells instance. `, PersistentPreRun: func(cmd *cobra.Command, args []string) { initConfig() }, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
ToolsCmd are tools that do not need a running Cells instance
Functions ¶
func Execute ¶
func Execute()
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func RegisterAdditionalPrompt ¶
func RegisterAdditionalPrompt(step CellsCliPromptStep)
Types ¶
type CellsCliPromptStep ¶
type CellsCliPromptStep struct { Step string Prompt func(*install.InstallConfig) error }
type CellsVersion ¶
type CellsVersion struct { //Distribution string PackageLabel string Version string BuildTime string GitCommit string OS string Arch string GoVersion string }
CellsVersion contains version information for the current running binary
type NiInstallConfig ¶
type NiInstallConfig struct { install.InstallConfig `yaml:",inline"` ProxyConfigs []*install.ProxyConfig `json:"proxyConfigs" yaml:"proxyconfigs"` CustomConfigs map[string]interface{} `json:"customConfigs" yaml:"customconfigs"` }
Source Files ¶
- admin-acl-create.go
- admin-acl-delete.go
- admin-acl-patch-recycle-personal.go
- admin-acl-search.go
- admin-acl.go
- admin-clean-activities.go
- admin-clean-logs.go
- admin-clean.go
- admin-config-del.go
- admin-config-history.go
- admin-config-list.go
- admin-config-set.go
- admin-config.go
- admin-datasource-migrate.go
- admin-datasource-resync.go
- admin-datasource-snapshot.go
- admin-datasource.go
- admin-files-bench-create.go
- admin-files-ls.go
- admin-files-meta-put.go
- admin-files-meta-read.go
- admin-files.go
- admin-hidden-reload-assets.go
- admin-purge-activities.go
- admin-resync.go
- admin-user-create.go
- admin-user-delete.go
- admin-user-personal-token.go
- admin-user-search.go
- admin-user-set-profile.go
- admin-user-set-pwd.go
- admin-user-unlock.go
- admin-user.go
- admin.go
- configure-db-add.go
- configure-db-list.go
- configure-db-move.go
- configure-db-set.go
- configure-db.go
- configure-sites-add.go
- configure-sites-delete.go
- configure-sites.go
- configure.go
- flag-registry.go
- flag.go
- hidden-doc-generate.go
- hidden-doc-i18n-count.go
- hidden-doc-i18n.go
- hidden-doc-openapi.go
- hidden-doc.go
- install-cli.go
- install-ni.go
- ps.go
- rlimit_posix.go
- root.go
- server-ps.go
- server-start.go
- server.go
- service-level.go
- service-start.go
- service-stop.go
- service.go
- signals.go
- start.go
- test-external-grpc.go
- test-json-request.go
- tools-completion.go
- tools-config.go
- tools.go
- update.go
- version.go
Directories ¶
Path | Synopsis |
---|---|
protoc-gen-go-client-stub
module
|
|
protoc-gen-go-enhanced-grpc
module
|
|
protoc-gen-go-multi-grpc
module
|