Update Dockerfiles and set default SQL port to 2343
This commit is contained in:
parent
428d5f34b5
commit
ba396952a8
|
@ -20,9 +20,9 @@ services:
|
||||||
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_HTTP_PORT: 2342
|
PHOTOPRISM_HTTP_PORT: 2342
|
||||||
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_SQL_PORT: 4000
|
PHOTOPRISM_SQL_PORT: 2343
|
||||||
PHOTOPRISM_SQL_PASSWORD: "photoprism"
|
PHOTOPRISM_SQL_PASSWORD: "photoprism"
|
||||||
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:4000)/photoprism?parseTime=true"
|
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:2343)/photoprism?parseTime=true"
|
||||||
PHOTOPRISM_DATABASE_DRIVER: "internal"
|
PHOTOPRISM_DATABASE_DRIVER: "internal"
|
||||||
PHOTOPRISM_PID_FILENAME: "photoprism.pid"
|
PHOTOPRISM_PID_FILENAME: "photoprism.pid"
|
||||||
PHOTOPRISM_LOG_FILENAME: "photoprism.log"
|
PHOTOPRISM_LOG_FILENAME: "photoprism.log"
|
||||||
|
|
|
@ -33,11 +33,11 @@ services:
|
||||||
PHOTOPRISM_TEMP_PATH: "/go/src/github.com/photoprism/photoprism/assets/photos/temp"
|
PHOTOPRISM_TEMP_PATH: "/go/src/github.com/photoprism/photoprism/assets/photos/temp"
|
||||||
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/assets/photos/originals"
|
PHOTOPRISM_ORIGINALS_PATH: "/go/src/github.com/photoprism/photoprism/assets/photos/originals"
|
||||||
PHOTOPRISM_DATABASE_DRIVER: "internal"
|
PHOTOPRISM_DATABASE_DRIVER: "internal"
|
||||||
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:4000)/photoprism?parseTime=true"
|
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:2343)/photoprism?parseTime=true"
|
||||||
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_HTTP_PORT: 2342
|
PHOTOPRISM_HTTP_PORT: 2342
|
||||||
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_SQL_PORT: 4000
|
PHOTOPRISM_SQL_PORT: 2343
|
||||||
PHOTOPRISM_SQL_PASSWORD: "photoprism"
|
PHOTOPRISM_SQL_PASSWORD: "photoprism"
|
||||||
TF_CPP_MIN_LOG_LEVEL: 0
|
TF_CPP_MIN_LOG_LEVEL: 0
|
||||||
|
|
||||||
|
|
|
@ -119,8 +119,8 @@ RUN echo "alias go=richgo" > /root/.bash_aliases
|
||||||
# Set up project directory
|
# Set up project directory
|
||||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||||
|
|
||||||
# Expose HTTP port 2342 plus 4000 for TiDB and 9515 for chromedriver
|
# Expose HTTP port 2342 plus 2343 for TiDB and 9515 for chromedriver
|
||||||
EXPOSE 2342 4000 9515
|
EXPOSE 2342 2343 9515
|
||||||
|
|
||||||
# Keep container running (services can be started manually using a terminal)
|
# Keep container running (services can be started manually using a terminal)
|
||||||
CMD tail -f /dev/null
|
CMD tail -f /dev/null
|
||||||
|
|
|
@ -56,7 +56,7 @@ ENV PATH /photoprism/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
|
||||||
|
|
||||||
ENV PHOTOPRISM_ORIGINALS_PATH /photoprism/originals
|
ENV PHOTOPRISM_ORIGINALS_PATH /photoprism/originals
|
||||||
ENV PHOTOPRISM_IMPORT_PATH /photoprism/import
|
ENV PHOTOPRISM_IMPORT_PATH /photoprism/import
|
||||||
ENV PHOTOPRISM_DATABASE_PATH /photoprism/database
|
ENV PHOTOPRISM_SQL_PATH /photoprism/database
|
||||||
ENV PHOTOPRISM_TEMP_PATH /photoprism/temp
|
ENV PHOTOPRISM_TEMP_PATH /photoprism/temp
|
||||||
ENV PHOTOPRISM_CACHE_PATH /photoprism/cache
|
ENV PHOTOPRISM_CACHE_PATH /photoprism/cache
|
||||||
ENV PHOTOPRISM_CONFIG_PATH /photoprism/config
|
ENV PHOTOPRISM_CONFIG_PATH /photoprism/config
|
||||||
|
@ -85,7 +85,7 @@ RUN chmod -R 777 /photoprism
|
||||||
RUN photoprism -v
|
RUN photoprism -v
|
||||||
|
|
||||||
# Expose http and database ports
|
# Expose http and database ports
|
||||||
EXPOSE 2342 4000
|
EXPOSE 2342 2343
|
||||||
|
|
||||||
# Run server
|
# Run server
|
||||||
CMD photoprism start
|
CMD photoprism start
|
||||||
|
|
|
@ -52,7 +52,7 @@ RUN apt-get update && apt-get upgrade && \
|
||||||
ENV LD_LIBRARY_PATH /root/.local/lib:/usr/local/lib:/usr/lib:/lib
|
ENV LD_LIBRARY_PATH /root/.local/lib:/usr/local/lib:/usr/lib:/lib
|
||||||
ENV TF_CPP_MIN_LOG_LEVEL 0
|
ENV TF_CPP_MIN_LOG_LEVEL 0
|
||||||
RUN curl -L \
|
RUN curl -L \
|
||||||
"https://dl.photoprism.org/tensorflow/arm64/libtensorflow-arm64-1.14.0.tar.gz" | \
|
"https://dl.photoprism.org/tensorflow/arm64/libtensorflow-arm64-1.15.2.tar.gz" | \
|
||||||
tar -C "/usr" -xz
|
tar -C "/usr" -xz
|
||||||
RUN ldconfig
|
RUN ldconfig
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ ENV PATH /photoprism/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
|
||||||
|
|
||||||
ENV PHOTOPRISM_ORIGINALS_PATH /photoprism/originals
|
ENV PHOTOPRISM_ORIGINALS_PATH /photoprism/originals
|
||||||
ENV PHOTOPRISM_IMPORT_PATH /photoprism/import
|
ENV PHOTOPRISM_IMPORT_PATH /photoprism/import
|
||||||
ENV PHOTOPRISM_DATABASE_PATH /photoprism/database
|
ENV PHOTOPRISM_SQL_PATH /photoprism/database
|
||||||
ENV PHOTOPRISM_TEMP_PATH /photoprism/temp
|
ENV PHOTOPRISM_TEMP_PATH /photoprism/temp
|
||||||
ENV PHOTOPRISM_CACHE_PATH /photoprism/cache
|
ENV PHOTOPRISM_CACHE_PATH /photoprism/cache
|
||||||
ENV PHOTOPRISM_CONFIG_PATH /photoprism/config
|
ENV PHOTOPRISM_CONFIG_PATH /photoprism/config
|
||||||
|
@ -169,7 +169,7 @@ RUN chmod -R 777 /photoprism
|
||||||
RUN photoprism -v
|
RUN photoprism -v
|
||||||
|
|
||||||
# Expose http and database ports
|
# Expose http and database ports
|
||||||
EXPOSE 2342 4000
|
EXPOSE 2342 2343
|
||||||
|
|
||||||
# Run server
|
# Run server
|
||||||
CMD photoprism start
|
CMD photoprism start
|
||||||
|
|
|
@ -13,7 +13,7 @@ services:
|
||||||
- seccomp:unconfined
|
- seccomp:unconfined
|
||||||
ports:
|
ports:
|
||||||
- 2342:2342 # [local port]:[container port]
|
- 2342:2342 # [local port]:[container port]
|
||||||
# - 4000:4000 # Internal database (MySQL compatible)
|
# - 2343:2343 # Internal database (MySQL compatible)
|
||||||
healthcheck: # Optional
|
healthcheck: # Optional
|
||||||
test: "photoprism status"
|
test: "photoprism status"
|
||||||
interval: 60s
|
interval: 60s
|
||||||
|
@ -36,12 +36,12 @@ services:
|
||||||
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_HTTP_PORT: 2342
|
PHOTOPRISM_HTTP_PORT: 2342
|
||||||
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_SQL_PORT: 4000 # Port for internal TiDB SQL server (driver "internal")
|
PHOTOPRISM_SQL_PORT: 2343 # Port for internal TiDB SQL server (driver "internal")
|
||||||
PHOTOPRISM_SQL_PASSWORD: "photoprism" # Plain text only (username "root")
|
PHOTOPRISM_SQL_PASSWORD: "photoprism" # Plain text only (username "root")
|
||||||
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # Plain text or bcrypt hash (escape "$" with "$$")
|
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # Plain text or bcrypt hash (escape "$" with "$$")
|
||||||
PHOTOPRISM_WEBDAV_PASSWORD: "photoprism" # Plain text only (username "photoprism")
|
PHOTOPRISM_WEBDAV_PASSWORD: "photoprism" # Plain text only (username "photoprism")
|
||||||
PHOTOPRISM_DATABASE_DRIVER: "internal" # Change to "mysql" for external MySQL or MariaDB
|
PHOTOPRISM_DATABASE_DRIVER: "internal" # Change to "mysql" for external MySQL or MariaDB
|
||||||
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:4000)/photoprism?parseTime=true"
|
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:2343)/photoprism?parseTime=true"
|
||||||
# PHOTOPRISM_THUMB_QUALITY: 95 # High-quality thumbnails (optional)
|
# PHOTOPRISM_THUMB_QUALITY: 95 # High-quality thumbnails (optional)
|
||||||
# PHOTOPRISM_THUMB_SIZE: 3840
|
# PHOTOPRISM_THUMB_SIZE: 3840
|
||||||
# PHOTOPRISM_THUMB_LIMIT: 3840
|
# PHOTOPRISM_THUMB_LIMIT: 3840
|
||||||
|
|
|
@ -12,7 +12,7 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- 2342:2342 # [local port]:[container port]
|
- 2342:2342 # [local port]:[container port]
|
||||||
# - 4000:4000 # Internal database (MySQL compatible)
|
# - 2343:2343 # Internal database (MySQL compatible)
|
||||||
healthcheck: # Optional
|
healthcheck: # Optional
|
||||||
test: "photoprism status"
|
test: "photoprism status"
|
||||||
interval: 60s
|
interval: 60s
|
||||||
|
@ -35,12 +35,12 @@ services:
|
||||||
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_HTTP_PORT: 2342
|
PHOTOPRISM_HTTP_PORT: 2342
|
||||||
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
||||||
PHOTOPRISM_SQL_PORT: 4000 # Port for internal TiDB SQL server (driver "internal")
|
PHOTOPRISM_SQL_PORT: 2343 # Port for internal TiDB SQL server (driver "internal")
|
||||||
PHOTOPRISM_SQL_PASSWORD: "photoprism" # Plain text only (username "root")
|
PHOTOPRISM_SQL_PASSWORD: "photoprism" # Plain text only (username "root")
|
||||||
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # Plain text or bcrypt hash (escape "$" with "$$")
|
PHOTOPRISM_ADMIN_PASSWORD: "photoprism" # Plain text or bcrypt hash (escape "$" with "$$")
|
||||||
PHOTOPRISM_WEBDAV_PASSWORD: "photoprism" # Plain text only (username "photoprism")
|
PHOTOPRISM_WEBDAV_PASSWORD: "photoprism" # Plain text only (username "photoprism")
|
||||||
PHOTOPRISM_DATABASE_DRIVER: "internal" # Change to "mysql" for external MySQL or MariaDB
|
PHOTOPRISM_DATABASE_DRIVER: "internal" # Change to "mysql" for external MySQL or MariaDB
|
||||||
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:4000)/photoprism?parseTime=true"
|
PHOTOPRISM_DATABASE_DSN: "root:photoprism@tcp(localhost:2343)/photoprism?parseTime=true"
|
||||||
# PHOTOPRISM_DATABASE_DRIVER: "mysql" # Using MariaDB or MySQL instead of the internal TiDB is optional
|
# PHOTOPRISM_DATABASE_DRIVER: "mysql" # Using MariaDB or MySQL instead of the internal TiDB is optional
|
||||||
# PHOTOPRISM_DATABASE_DSN: "photoprism:photoprism@tcp(photoprism-db:3306)/photoprism?parseTime=true"
|
# PHOTOPRISM_DATABASE_DSN: "photoprism:photoprism@tcp(photoprism-db:3306)/photoprism?parseTime=true"
|
||||||
# PHOTOPRISM_THUMB_QUALITY: 95 # High-quality thumbnails (optional, default JPEG quality is 90)
|
# PHOTOPRISM_THUMB_QUALITY: 95 # High-quality thumbnails (optional, default JPEG quality is 90)
|
||||||
|
|
|
@ -57,17 +57,17 @@ func configAction(ctx *cli.Context) error {
|
||||||
fmt.Printf("static-path %s\n", conf.HttpStaticPath())
|
fmt.Printf("static-path %s\n", conf.HttpStaticPath())
|
||||||
fmt.Printf("static-build-path %s\n", conf.HttpStaticBuildPath())
|
fmt.Printf("static-build-path %s\n", conf.HttpStaticBuildPath())
|
||||||
|
|
||||||
fmt.Printf("database-path %s\n", conf.DatabasePath())
|
fmt.Printf("http-host %s\n", conf.HttpServerHost())
|
||||||
fmt.Printf("database-driver %s\n", conf.DatabaseDriver())
|
fmt.Printf("http-port %d\n", conf.HttpServerPort())
|
||||||
fmt.Printf("database-dsn %s\n", conf.DatabaseDsn())
|
fmt.Printf("http-mode %s\n", conf.HttpServerMode())
|
||||||
|
|
||||||
fmt.Printf("sql-host %s\n", conf.SqlServerHost())
|
fmt.Printf("sql-host %s\n", conf.SqlServerHost())
|
||||||
fmt.Printf("sql-port %d\n", conf.SqlServerPort())
|
fmt.Printf("sql-port %d\n", conf.SqlServerPort())
|
||||||
fmt.Printf("sql-password %s\n", conf.SqlServerPassword())
|
fmt.Printf("sql-password %s\n", conf.SqlServerPassword())
|
||||||
|
fmt.Printf("sql-path %s\n", conf.SqlPath())
|
||||||
|
|
||||||
fmt.Printf("http-host %s\n", conf.HttpServerHost())
|
fmt.Printf("database-driver %s\n", conf.DatabaseDriver())
|
||||||
fmt.Printf("http-port %d\n", conf.HttpServerPort())
|
fmt.Printf("database-dsn %s\n", conf.DatabaseDsn())
|
||||||
fmt.Printf("http-mode %s\n", conf.HttpServerMode())
|
|
||||||
|
|
||||||
fmt.Printf("sips-bin %s\n", conf.SipsBin())
|
fmt.Printf("sips-bin %s\n", conf.SipsBin())
|
||||||
fmt.Printf("darktable-bin %s\n", conf.DarktableBin())
|
fmt.Printf("darktable-bin %s\n", conf.DarktableBin())
|
||||||
|
|
|
@ -51,11 +51,11 @@ func startAction(ctx *cli.Context) error {
|
||||||
if ctx.IsSet("config") {
|
if ctx.IsSet("config") {
|
||||||
fmt.Printf("NAME VALUE\n")
|
fmt.Printf("NAME VALUE\n")
|
||||||
fmt.Printf("detach-server %t\n", conf.DetachServer())
|
fmt.Printf("detach-server %t\n", conf.DetachServer())
|
||||||
fmt.Printf("database-path %s\n", conf.DatabasePath())
|
|
||||||
|
|
||||||
fmt.Printf("sql-host %s\n", conf.SqlServerHost())
|
fmt.Printf("sql-host %s\n", conf.SqlServerHost())
|
||||||
fmt.Printf("sql-port %d\n", conf.SqlServerPort())
|
fmt.Printf("sql-port %d\n", conf.SqlServerPort())
|
||||||
fmt.Printf("sql-password %s\n", conf.SqlServerPassword())
|
fmt.Printf("sql-password %s\n", conf.SqlServerPassword())
|
||||||
|
fmt.Printf("sql-path %s\n", conf.SqlPath())
|
||||||
|
|
||||||
fmt.Printf("http-host %s\n", conf.HttpServerHost())
|
fmt.Printf("http-host %s\n", conf.HttpServerHost())
|
||||||
fmt.Printf("http-port %d\n", conf.HttpServerPort())
|
fmt.Printf("http-port %d\n", conf.HttpServerPort())
|
||||||
|
|
|
@ -116,14 +116,14 @@ func TestConfig_SqlServerPort(t *testing.T) {
|
||||||
c := NewConfig(ctx)
|
c := NewConfig(ctx)
|
||||||
|
|
||||||
port := c.SqlServerPort()
|
port := c.SqlServerPort()
|
||||||
assert.Equal(t, uint(4000), port)
|
assert.Equal(t, uint(2343), port)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfig_SqlServerPath(t *testing.T) {
|
func TestConfig_SqlServerPath(t *testing.T) {
|
||||||
ctx := CliTestContext()
|
ctx := CliTestContext()
|
||||||
c := NewConfig(ctx)
|
c := NewConfig(ctx)
|
||||||
|
|
||||||
path := c.DatabasePath()
|
path := c.SqlPath()
|
||||||
assert.Equal(t, "/go/src/github.com/photoprism/photoprism/assets/resources/database", path)
|
assert.Equal(t, "/go/src/github.com/photoprism/photoprism/assets/resources/database", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ func (c *Config) DatabaseDriver() string {
|
||||||
// DatabaseDsn returns the database data source name (DSN).
|
// DatabaseDsn returns the database data source name (DSN).
|
||||||
func (c *Config) DatabaseDsn() string {
|
func (c *Config) DatabaseDsn() string {
|
||||||
if c.params.DatabaseDsn == "" {
|
if c.params.DatabaseDsn == "" {
|
||||||
return "root:photoprism@tcp(localhost:4000)/photoprism?parseTime=true"
|
return "root:photoprism@tcp(localhost:2343)/photoprism?parseTime=true"
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.params.DatabaseDsn
|
return c.params.DatabaseDsn
|
||||||
|
@ -154,7 +154,7 @@ func (c *Config) connectToDatabase(ctx context.Context) error {
|
||||||
if isTiDB {
|
if isTiDB {
|
||||||
log.Infof("starting database server at %s:%d\n", c.SqlServerHost(), c.SqlServerPort())
|
log.Infof("starting database server at %s:%d\n", c.SqlServerHost(), c.SqlServerPort())
|
||||||
|
|
||||||
go tidb.Start(ctx, c.DatabasePath(), c.SqlServerPort(), c.SqlServerHost(), c.Debug())
|
go tidb.Start(ctx, c.SqlPath(), c.SqlServerPort(), c.SqlServerHost(), c.Debug())
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 1; i <= 12; i++ {
|
for i := 1; i <= 12; i++ {
|
||||||
|
|
|
@ -61,8 +61,8 @@ func (c *Config) CreateDirectories() error {
|
||||||
return createError(c.ResourcesPath(), err)
|
return createError(c.ResourcesPath(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.MkdirAll(c.DatabasePath(), os.ModePerm); err != nil {
|
if err := os.MkdirAll(c.SqlPath(), os.ModePerm); err != nil {
|
||||||
return createError(c.DatabasePath(), err)
|
return createError(c.SqlPath(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.MkdirAll(c.TensorFlowModelPath(), os.ModePerm); err != nil {
|
if err := os.MkdirAll(c.TensorFlowModelPath(), os.ModePerm); err != nil {
|
||||||
|
|
|
@ -149,23 +149,6 @@ var GlobalFlags = []cli.Flag{
|
||||||
Value: "~/.local/share/photoprism",
|
Value: "~/.local/share/photoprism",
|
||||||
EnvVar: "PHOTOPRISM_ASSETS_PATH",
|
EnvVar: "PHOTOPRISM_ASSETS_PATH",
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
|
||||||
Name: "database-path",
|
|
||||||
Usage: "built-in database server storage path",
|
|
||||||
EnvVar: "PHOTOPRISM_DATABASE_PATH",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "database-driver",
|
|
||||||
Usage: "database `DRIVER` (internal or mysql)",
|
|
||||||
Value: "internal",
|
|
||||||
EnvVar: "PHOTOPRISM_DATABASE_DRIVER",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
|
||||||
Name: "database-dsn",
|
|
||||||
Usage: "database data source name (`DSN`)",
|
|
||||||
Value: "root:@tcp(localhost:4000)/photoprism?parseTime=true",
|
|
||||||
EnvVar: "PHOTOPRISM_DATABASE_DSN",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "sips-bin",
|
Name: "sips-bin",
|
||||||
Usage: "sips cli binary `FILENAME`",
|
Usage: "sips cli binary `FILENAME`",
|
||||||
|
@ -192,6 +175,7 @@ var GlobalFlags = []cli.Flag{
|
||||||
},
|
},
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "http-port",
|
Name: "http-port",
|
||||||
|
Value: 2342,
|
||||||
Usage: "HTTP server port",
|
Usage: "HTTP server port",
|
||||||
EnvVar: "PHOTOPRISM_HTTP_PORT",
|
EnvVar: "PHOTOPRISM_HTTP_PORT",
|
||||||
},
|
},
|
||||||
|
@ -207,6 +191,7 @@ var GlobalFlags = []cli.Flag{
|
||||||
},
|
},
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "sql-port",
|
Name: "sql-port",
|
||||||
|
Value: 2343,
|
||||||
Usage: "built-in SQL server port",
|
Usage: "built-in SQL server port",
|
||||||
EnvVar: "PHOTOPRISM_SQL_PORT",
|
EnvVar: "PHOTOPRISM_SQL_PORT",
|
||||||
},
|
},
|
||||||
|
@ -220,6 +205,23 @@ var GlobalFlags = []cli.Flag{
|
||||||
Usage: "built-in SQL server password",
|
Usage: "built-in SQL server password",
|
||||||
EnvVar: "PHOTOPRISM_SQL_PASSWORD",
|
EnvVar: "PHOTOPRISM_SQL_PASSWORD",
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "sql-path",
|
||||||
|
Usage: "built-in database server storage path",
|
||||||
|
EnvVar: "PHOTOPRISM_SQL_PATH",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "database-driver",
|
||||||
|
Usage: "database `DRIVER` (internal or mysql)",
|
||||||
|
Value: "internal",
|
||||||
|
EnvVar: "PHOTOPRISM_DATABASE_DRIVER",
|
||||||
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "database-dsn",
|
||||||
|
Usage: "database data source name (`DSN`)",
|
||||||
|
Value: "root:@tcp(localhost:2343)/photoprism?parseTime=true",
|
||||||
|
EnvVar: "PHOTOPRISM_DATABASE_DSN",
|
||||||
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "detect-nsfw",
|
Name: "detect-nsfw",
|
||||||
Usage: "flag photos as private that may be offensive",
|
Usage: "flag photos as private that may be offensive",
|
||||||
|
|
|
@ -54,12 +54,12 @@ type Params struct {
|
||||||
ImportPath string `yaml:"import-path" flag:"import-path"`
|
ImportPath string `yaml:"import-path" flag:"import-path"`
|
||||||
AssetsPath string `yaml:"assets-path" flag:"assets-path"`
|
AssetsPath string `yaml:"assets-path" flag:"assets-path"`
|
||||||
ResourcesPath string `yaml:"resources-path" flag:"resources-path"`
|
ResourcesPath string `yaml:"resources-path" flag:"resources-path"`
|
||||||
DatabasePath string `yaml:"database-path" flag:"database-path"`
|
|
||||||
DatabaseDriver string `yaml:"database-driver" flag:"database-driver"`
|
DatabaseDriver string `yaml:"database-driver" flag:"database-driver"`
|
||||||
DatabaseDsn string `yaml:"database-dsn" flag:"database-dsn"`
|
DatabaseDsn string `yaml:"database-dsn" flag:"database-dsn"`
|
||||||
SqlServerHost string `yaml:"sql-host" flag:"sql-host"`
|
SqlServerHost string `yaml:"sql-host" flag:"sql-host"`
|
||||||
SqlServerPort uint `yaml:"sql-port" flag:"sql-port"`
|
SqlServerPort uint `yaml:"sql-port" flag:"sql-port"`
|
||||||
SqlServerPassword string `yaml:"sql-password" flag:"sql-password"`
|
SqlServerPassword string `yaml:"sql-password" flag:"sql-password"`
|
||||||
|
SqlServerPath string `yaml:"sql-path" flag:"sql-path"`
|
||||||
HttpServerHost string `yaml:"http-host" flag:"http-host"`
|
HttpServerHost string `yaml:"http-host" flag:"http-host"`
|
||||||
HttpServerPort int `yaml:"http-port" flag:"http-port"`
|
HttpServerPort int `yaml:"http-port" flag:"http-port"`
|
||||||
HttpServerMode string `yaml:"http-mode" flag:"http-mode"`
|
HttpServerMode string `yaml:"http-mode" flag:"http-mode"`
|
||||||
|
@ -116,7 +116,7 @@ func (c *Params) expandFilenames() {
|
||||||
c.OriginalsPath = fs.Abs(c.OriginalsPath)
|
c.OriginalsPath = fs.Abs(c.OriginalsPath)
|
||||||
c.ImportPath = fs.Abs(c.ImportPath)
|
c.ImportPath = fs.Abs(c.ImportPath)
|
||||||
c.TempPath = fs.Abs(c.TempPath)
|
c.TempPath = fs.Abs(c.TempPath)
|
||||||
c.DatabasePath = fs.Abs(c.DatabasePath)
|
c.SqlServerPath = fs.Abs(c.SqlServerPath)
|
||||||
c.PIDFilename = fs.Abs(c.PIDFilename)
|
c.PIDFilename = fs.Abs(c.PIDFilename)
|
||||||
c.LogFilename = fs.Abs(c.LogFilename)
|
c.LogFilename = fs.Abs(c.LogFilename)
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,6 @@ func TestParams_SetValuesFromFile(t *testing.T) {
|
||||||
assert.Equal(t, "/srv/photoprism/photos/import", c.ImportPath)
|
assert.Equal(t, "/srv/photoprism/photos/import", c.ImportPath)
|
||||||
assert.Equal(t, "/srv/photoprism/temp", c.TempPath)
|
assert.Equal(t, "/srv/photoprism/temp", c.TempPath)
|
||||||
assert.Equal(t, "internal", c.DatabaseDriver)
|
assert.Equal(t, "internal", c.DatabaseDriver)
|
||||||
assert.Equal(t, "root:photoprism@tcp(localhost:4000)/photoprism?parseTime=true", c.DatabaseDsn)
|
assert.Equal(t, "root:photoprism@tcp(localhost:2343)/photoprism?parseTime=true", c.DatabaseDsn)
|
||||||
assert.Equal(t, 81, c.HttpServerPort)
|
assert.Equal(t, 81, c.HttpServerPort)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,15 +2,6 @@ package config
|
||||||
|
|
||||||
import "github.com/photoprism/photoprism/pkg/fs"
|
import "github.com/photoprism/photoprism/pkg/fs"
|
||||||
|
|
||||||
// DatabasePath returns the database storage path for TiDB.
|
|
||||||
func (c *Config) DatabasePath() string {
|
|
||||||
if c.params.DatabasePath == "" {
|
|
||||||
return c.ResourcesPath() + "/database"
|
|
||||||
}
|
|
||||||
|
|
||||||
return fs.Abs(c.params.DatabasePath)
|
|
||||||
}
|
|
||||||
|
|
||||||
// DetachServer returns true if server should detach from console (daemon mode).
|
// DetachServer returns true if server should detach from console (daemon mode).
|
||||||
func (c *Config) DetachServer() bool {
|
func (c *Config) DetachServer() bool {
|
||||||
return c.params.DetachServer
|
return c.params.DetachServer
|
||||||
|
@ -84,7 +75,7 @@ func (c *Config) SqlServerHost() string {
|
||||||
// SqlServerPort returns the built-in SQL server port.
|
// SqlServerPort returns the built-in SQL server port.
|
||||||
func (c *Config) SqlServerPort() uint {
|
func (c *Config) SqlServerPort() uint {
|
||||||
if c.params.SqlServerPort == 0 {
|
if c.params.SqlServerPort == 0 {
|
||||||
return 4000
|
return 2343
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.params.SqlServerPort
|
return c.params.SqlServerPort
|
||||||
|
@ -94,3 +85,12 @@ func (c *Config) SqlServerPort() uint {
|
||||||
func (c *Config) SqlServerPassword() string {
|
func (c *Config) SqlServerPassword() string {
|
||||||
return c.params.SqlServerPassword
|
return c.params.SqlServerPassword
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SqlPath returns the database storage path for the built-in SQL server.
|
||||||
|
func (c *Config) SqlPath() string {
|
||||||
|
if c.params.SqlServerPath == "" {
|
||||||
|
return c.ResourcesPath() + "/database"
|
||||||
|
}
|
||||||
|
|
||||||
|
return fs.Abs(c.params.SqlServerPath)
|
||||||
|
}
|
||||||
|
|
4
internal/config/testdata/config.yml
vendored
4
internal/config/testdata/config.yml
vendored
|
@ -6,13 +6,13 @@ originals-path: /srv/photoprism/photos/originals
|
||||||
import-path: /srv/photoprism/photos/import
|
import-path: /srv/photoprism/photos/import
|
||||||
temp-path: /srv/photoprism/temp
|
temp-path: /srv/photoprism/temp
|
||||||
sql-host: localhost
|
sql-host: localhost
|
||||||
sql-port: 4000
|
sql-port: 2343
|
||||||
sql-password: photoprism
|
sql-password: photoprism
|
||||||
http-host:
|
http-host:
|
||||||
http-mode: release
|
http-mode: release
|
||||||
http-port: 81
|
http-port: 81
|
||||||
http-password:
|
http-password:
|
||||||
database-driver: internal
|
database-driver: internal
|
||||||
database-dsn: root:photoprism@tcp(localhost:4000)/photoprism?parseTime=true
|
database-dsn: root:photoprism@tcp(localhost:2343)/photoprism?parseTime=true
|
||||||
theme: lavendel
|
theme: lavendel
|
||||||
language: english
|
language: english
|
||||||
|
|
Loading…
Reference in a new issue