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_PORT: 2342
|
||||
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
||||
PHOTOPRISM_SQL_PORT: 4000
|
||||
PHOTOPRISM_SQL_PORT: 2343
|
||||
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_PID_FILENAME: "photoprism.pid"
|
||||
PHOTOPRISM_LOG_FILENAME: "photoprism.log"
|
||||
|
|
|
@ -33,11 +33,11 @@ services:
|
|||
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_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_PORT: 2342
|
||||
PHOTOPRISM_SQL_HOST: "0.0.0.0"
|
||||
PHOTOPRISM_SQL_PORT: 4000
|
||||
PHOTOPRISM_SQL_PORT: 2343
|
||||
PHOTOPRISM_SQL_PASSWORD: "photoprism"
|
||||
TF_CPP_MIN_LOG_LEVEL: 0
|
||||
|
||||
|
|
|
@ -119,8 +119,8 @@ RUN echo "alias go=richgo" > /root/.bash_aliases
|
|||
# Set up project directory
|
||||
WORKDIR "/go/src/github.com/photoprism/photoprism"
|
||||
|
||||
# Expose HTTP port 2342 plus 4000 for TiDB and 9515 for chromedriver
|
||||
EXPOSE 2342 4000 9515
|
||||
# Expose HTTP port 2342 plus 2343 for TiDB and 9515 for chromedriver
|
||||
EXPOSE 2342 2343 9515
|
||||
|
||||
# Keep container running (services can be started manually using a terminal)
|
||||
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_IMPORT_PATH /photoprism/import
|
||||
ENV PHOTOPRISM_DATABASE_PATH /photoprism/database
|
||||
ENV PHOTOPRISM_SQL_PATH /photoprism/database
|
||||
ENV PHOTOPRISM_TEMP_PATH /photoprism/temp
|
||||
ENV PHOTOPRISM_CACHE_PATH /photoprism/cache
|
||||
ENV PHOTOPRISM_CONFIG_PATH /photoprism/config
|
||||
|
@ -85,7 +85,7 @@ RUN chmod -R 777 /photoprism
|
|||
RUN photoprism -v
|
||||
|
||||
# Expose http and database ports
|
||||
EXPOSE 2342 4000
|
||||
EXPOSE 2342 2343
|
||||
|
||||
# Run server
|
||||
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 TF_CPP_MIN_LOG_LEVEL 0
|
||||
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
|
||||
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_IMPORT_PATH /photoprism/import
|
||||
ENV PHOTOPRISM_DATABASE_PATH /photoprism/database
|
||||
ENV PHOTOPRISM_SQL_PATH /photoprism/database
|
||||
ENV PHOTOPRISM_TEMP_PATH /photoprism/temp
|
||||
ENV PHOTOPRISM_CACHE_PATH /photoprism/cache
|
||||
ENV PHOTOPRISM_CONFIG_PATH /photoprism/config
|
||||
|
@ -169,7 +169,7 @@ RUN chmod -R 777 /photoprism
|
|||
RUN photoprism -v
|
||||
|
||||
# Expose http and database ports
|
||||
EXPOSE 2342 4000
|
||||
EXPOSE 2342 2343
|
||||
|
||||
# Run server
|
||||
CMD photoprism start
|
||||
|
|
|
@ -13,7 +13,7 @@ services:
|
|||
- seccomp:unconfined
|
||||
ports:
|
||||
- 2342:2342 # [local port]:[container port]
|
||||
# - 4000:4000 # Internal database (MySQL compatible)
|
||||
# - 2343:2343 # Internal database (MySQL compatible)
|
||||
healthcheck: # Optional
|
||||
test: "photoprism status"
|
||||
interval: 60s
|
||||
|
@ -36,12 +36,12 @@ services:
|
|||
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
||||
PHOTOPRISM_HTTP_PORT: 2342
|
||||
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_ADMIN_PASSWORD: "photoprism" # Plain text or bcrypt hash (escape "$" with "$$")
|
||||
PHOTOPRISM_WEBDAV_PASSWORD: "photoprism" # Plain text only (username "photoprism")
|
||||
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_SIZE: 3840
|
||||
# PHOTOPRISM_THUMB_LIMIT: 3840
|
||||
|
|
|
@ -12,7 +12,7 @@ services:
|
|||
restart: unless-stopped
|
||||
ports:
|
||||
- 2342:2342 # [local port]:[container port]
|
||||
# - 4000:4000 # Internal database (MySQL compatible)
|
||||
# - 2343:2343 # Internal database (MySQL compatible)
|
||||
healthcheck: # Optional
|
||||
test: "photoprism status"
|
||||
interval: 60s
|
||||
|
@ -35,12 +35,12 @@ services:
|
|||
PHOTOPRISM_HTTP_HOST: "0.0.0.0"
|
||||
PHOTOPRISM_HTTP_PORT: 2342
|
||||
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_ADMIN_PASSWORD: "photoprism" # Plain text or bcrypt hash (escape "$" with "$$")
|
||||
PHOTOPRISM_WEBDAV_PASSWORD: "photoprism" # Plain text only (username "photoprism")
|
||||
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_DSN: "photoprism:photoprism@tcp(photoprism-db:3306)/photoprism?parseTime=true"
|
||||
# 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-build-path %s\n", conf.HttpStaticBuildPath())
|
||||
|
||||
fmt.Printf("database-path %s\n", conf.DatabasePath())
|
||||
fmt.Printf("database-driver %s\n", conf.DatabaseDriver())
|
||||
fmt.Printf("database-dsn %s\n", conf.DatabaseDsn())
|
||||
fmt.Printf("http-host %s\n", conf.HttpServerHost())
|
||||
fmt.Printf("http-port %d\n", conf.HttpServerPort())
|
||||
fmt.Printf("http-mode %s\n", conf.HttpServerMode())
|
||||
|
||||
fmt.Printf("sql-host %s\n", conf.SqlServerHost())
|
||||
fmt.Printf("sql-port %d\n", conf.SqlServerPort())
|
||||
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-port %d\n", conf.HttpServerPort())
|
||||
fmt.Printf("http-mode %s\n", conf.HttpServerMode())
|
||||
fmt.Printf("database-driver %s\n", conf.DatabaseDriver())
|
||||
fmt.Printf("database-dsn %s\n", conf.DatabaseDsn())
|
||||
|
||||
fmt.Printf("sips-bin %s\n", conf.SipsBin())
|
||||
fmt.Printf("darktable-bin %s\n", conf.DarktableBin())
|
||||
|
|
|
@ -51,11 +51,11 @@ func startAction(ctx *cli.Context) error {
|
|||
if ctx.IsSet("config") {
|
||||
fmt.Printf("NAME VALUE\n")
|
||||
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-port %d\n", conf.SqlServerPort())
|
||||
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-port %d\n", conf.HttpServerPort())
|
||||
|
|
|
@ -116,14 +116,14 @@ func TestConfig_SqlServerPort(t *testing.T) {
|
|||
c := NewConfig(ctx)
|
||||
|
||||
port := c.SqlServerPort()
|
||||
assert.Equal(t, uint(4000), port)
|
||||
assert.Equal(t, uint(2343), port)
|
||||
}
|
||||
|
||||
func TestConfig_SqlServerPath(t *testing.T) {
|
||||
ctx := CliTestContext()
|
||||
c := NewConfig(ctx)
|
||||
|
||||
path := c.DatabasePath()
|
||||
path := c.SqlPath()
|
||||
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).
|
||||
func (c *Config) DatabaseDsn() string {
|
||||
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
|
||||
|
@ -154,7 +154,7 @@ func (c *Config) connectToDatabase(ctx context.Context) error {
|
|||
if isTiDB {
|
||||
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++ {
|
||||
|
|
|
@ -61,8 +61,8 @@ func (c *Config) CreateDirectories() error {
|
|||
return createError(c.ResourcesPath(), err)
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(c.DatabasePath(), os.ModePerm); err != nil {
|
||||
return createError(c.DatabasePath(), err)
|
||||
if err := os.MkdirAll(c.SqlPath(), os.ModePerm); err != nil {
|
||||
return createError(c.SqlPath(), err)
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(c.TensorFlowModelPath(), os.ModePerm); err != nil {
|
||||
|
|
|
@ -149,23 +149,6 @@ var GlobalFlags = []cli.Flag{
|
|||
Value: "~/.local/share/photoprism",
|
||||
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{
|
||||
Name: "sips-bin",
|
||||
Usage: "sips cli binary `FILENAME`",
|
||||
|
@ -192,6 +175,7 @@ var GlobalFlags = []cli.Flag{
|
|||
},
|
||||
cli.IntFlag{
|
||||
Name: "http-port",
|
||||
Value: 2342,
|
||||
Usage: "HTTP server port",
|
||||
EnvVar: "PHOTOPRISM_HTTP_PORT",
|
||||
},
|
||||
|
@ -207,6 +191,7 @@ var GlobalFlags = []cli.Flag{
|
|||
},
|
||||
cli.IntFlag{
|
||||
Name: "sql-port",
|
||||
Value: 2343,
|
||||
Usage: "built-in SQL server port",
|
||||
EnvVar: "PHOTOPRISM_SQL_PORT",
|
||||
},
|
||||
|
@ -220,6 +205,23 @@ var GlobalFlags = []cli.Flag{
|
|||
Usage: "built-in SQL server 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{
|
||||
Name: "detect-nsfw",
|
||||
Usage: "flag photos as private that may be offensive",
|
||||
|
|
|
@ -54,12 +54,12 @@ type Params struct {
|
|||
ImportPath string `yaml:"import-path" flag:"import-path"`
|
||||
AssetsPath string `yaml:"assets-path" flag:"assets-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"`
|
||||
DatabaseDsn string `yaml:"database-dsn" flag:"database-dsn"`
|
||||
SqlServerHost string `yaml:"sql-host" flag:"sql-host"`
|
||||
SqlServerPort uint `yaml:"sql-port" flag:"sql-port"`
|
||||
SqlServerPassword string `yaml:"sql-password" flag:"sql-password"`
|
||||
SqlServerPath string `yaml:"sql-path" flag:"sql-path"`
|
||||
HttpServerHost string `yaml:"http-host" flag:"http-host"`
|
||||
HttpServerPort int `yaml:"http-port" flag:"http-port"`
|
||||
HttpServerMode string `yaml:"http-mode" flag:"http-mode"`
|
||||
|
@ -116,7 +116,7 @@ func (c *Params) expandFilenames() {
|
|||
c.OriginalsPath = fs.Abs(c.OriginalsPath)
|
||||
c.ImportPath = fs.Abs(c.ImportPath)
|
||||
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.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/temp", c.TempPath)
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -2,15 +2,6 @@ package config
|
|||
|
||||
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).
|
||||
func (c *Config) DetachServer() bool {
|
||||
return c.params.DetachServer
|
||||
|
@ -84,7 +75,7 @@ func (c *Config) SqlServerHost() string {
|
|||
// SqlServerPort returns the built-in SQL server port.
|
||||
func (c *Config) SqlServerPort() uint {
|
||||
if c.params.SqlServerPort == 0 {
|
||||
return 4000
|
||||
return 2343
|
||||
}
|
||||
|
||||
return c.params.SqlServerPort
|
||||
|
@ -94,3 +85,12 @@ func (c *Config) SqlServerPort() uint {
|
|||
func (c *Config) SqlServerPassword() string {
|
||||
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
|
||||
temp-path: /srv/photoprism/temp
|
||||
sql-host: localhost
|
||||
sql-port: 4000
|
||||
sql-port: 2343
|
||||
sql-password: photoprism
|
||||
http-host:
|
||||
http-mode: release
|
||||
http-port: 81
|
||||
http-password:
|
||||
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
|
||||
language: english
|
||||
|
|
Loading…
Reference in a new issue