diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ffb31385..b0fa33eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ That's it. You're ready to contribute. ## Server ```bash -# Start dev server (runs on localhost:3000) +# Start dev server (runs on localhost:3001) make dev-server # Run tests diff --git a/README.md b/README.md index 12fd8675..e9469d83 100644 --- a/README.md +++ b/README.md @@ -23,22 +23,36 @@ dnote sync ## Installation -On Unix-like systems (Linux, FreeBSD, macOS), you can use the installation script: +```bash +# Linux, macOS, FreeBSD, Windows +curl -s https://www.getdnote.com/install | sh - curl -s https://www.getdnote.com/install | sh - -Or on macOS with Homebrew: - -```sh +# macOS with Homebrew brew install dnote ``` -You can also download the binary for your platform from the [releases page](https://github.com/dnote/dnote/releases). +Or [download binary](https://github.com/dnote/dnote/releases). -## Server +## Server (Optional) -Self-host your own Dnote server - just run a binary, no database required. [Download](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md) or run [with Docker](https://github.com/dnote/dnote/blob/master/host/docker/README.md). +Just run a binary. No database setup required. + +Run with Docker Compose using [compose.yml](./host/docker/compose.yml): + +```yaml +services: + dnote: + image: dnote/dnote:latest + container_name: dnote + ports: + - 3001:3001 + volumes: + - ./dnote_data:/data + restart: unless-stopped +``` + +Or see the [guide](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md) for binary installation and configuration options. ## Documentation -Please see [Dnote wiki](https://github.com/dnote/dnote/wiki) for the documentation. +See the [Dnote wiki](https://github.com/dnote/dnote/wiki) for full documentation. diff --git a/SELF_HOSTING.md b/SELF_HOSTING.md index 52bc7cfd..d033b45e 100644 --- a/SELF_HOSTING.md +++ b/SELF_HOSTING.md @@ -30,7 +30,7 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; - proxy_pass http://127.0.0.1:3000; + proxy_pass http://127.0.0.1:3001; } } ``` @@ -51,8 +51,8 @@ Enable `mod_proxy`, then create `/etc/apache2/sites-available/dnote.conf`: ProxyRequests Off ProxyPreserveHost On - ProxyPass / http://127.0.0.1:3000/ keepalive=On - ProxyPassReverse / http://127.0.0.1:3000/ + ProxyPass / http://127.0.0.1:3001/ keepalive=On + ProxyPassReverse / http://127.0.0.1:3001/ RequestHeader set X-Forwarded-HTTPS "0" ``` diff --git a/assets/cli.gif b/assets/cli.gif deleted file mode 100644 index 8925e131..00000000 Binary files a/assets/cli.gif and /dev/null differ diff --git a/assets/devices.png b/assets/devices.png deleted file mode 100644 index 5d40ee10..00000000 Binary files a/assets/devices.png and /dev/null differ diff --git a/host/docker/Dockerfile b/host/docker/Dockerfile index 81beabee..cd93f6ca 100644 --- a/host/docker/Dockerfile +++ b/host/docker/Dockerfile @@ -13,4 +13,4 @@ ENTRYPOINT ["./entrypoint.sh"] CMD ./dnote-server start -EXPOSE 3000 +EXPOSE 3001 diff --git a/host/docker/README.md b/host/docker/README.md index 69926481..179492b6 100644 --- a/host/docker/README.md +++ b/host/docker/README.md @@ -19,7 +19,7 @@ docker compose pull docker compose up -d ``` -Visit http://localhost:3000 in your browser to see Dnote running. +Visit http://localhost:3001 in your browser to see Dnote running. Please see [the installation guide](https://github.com/dnote/dnote/blob/master/SELF_HOSTING.md) for further configuration. diff --git a/host/docker/compose.yml b/host/docker/compose.yml index d2c2e5ed..2869033a 100644 --- a/host/docker/compose.yml +++ b/host/docker/compose.yml @@ -1,14 +1,9 @@ -version: "3" - services: dnote: image: dnote/dnote:latest - environment: - APP_ENV: PRODUCTION - WebURL: localhost:3000 - DisableRegistration: "false" + container_name: dnote ports: - - 3000:3000 + - 3001:3001 volumes: - ./dnote_data:/data - restart: always + restart: unless-stopped diff --git a/pkg/e2e/server_test.go b/pkg/e2e/server_test.go index 52a2d311..c37b7320 100644 --- a/pkg/e2e/server_test.go +++ b/pkg/e2e/server_test.go @@ -151,8 +151,8 @@ func TestServerStartHelp(t *testing.T) { func TestServerStartInvalidConfig(t *testing.T) { cmd := exec.Command(testServerBinary, "start") - // Clear WebURL env var so validation fails - cmd.Env = []string{} + // Set invalid WebURL to trigger validation failure + cmd.Env = []string{"WebURL=not-a-valid-url"} output, err := cmd.CombinedOutput() diff --git a/pkg/server/.env.dev b/pkg/server/.env.dev index 334b1196..fe5dca07 100644 --- a/pkg/server/.env.dev +++ b/pkg/server/.env.dev @@ -5,5 +5,5 @@ SmtpPassword=mock-SmtpPassword SmtpHost=mock-SmtpHost SmtpPort=465 -WebURL=http://localhost:3000 +WebURL=http://localhost:3001 DisableRegistration=false diff --git a/pkg/server/.env.test b/pkg/server/.env.test index d633f83c..8c0befed 100644 --- a/pkg/server/.env.test +++ b/pkg/server/.env.test @@ -5,5 +5,5 @@ SmtpPassword=mock-SmtpPassword SmtpHost=mock-SmtpHost SmtpPort=465 -WebURL=http://localhost:3000 +WebURL=http://localhost:3001 DisableRegistration=false diff --git a/pkg/server/config/config.go b/pkg/server/config/config.go index 916bae4e..e941a9a5 100644 --- a/pkg/server/config/config.go +++ b/pkg/server/config/config.go @@ -93,8 +93,8 @@ type Params struct { func New(p Params) (Config, error) { c := Config{ AppEnv: getOrEnv(p.AppEnv, "APP_ENV", AppEnvProduction), - Port: getOrEnv(p.Port, "PORT", "3000"), - WebURL: getOrEnv(p.WebURL, "WebURL", ""), + Port: getOrEnv(p.Port, "PORT", "3001"), + WebURL: getOrEnv(p.WebURL, "WebURL", "http://localhost:3001"), DBPath: getOrEnv(p.DBPath, "DBPath", DefaultDBPath), DisableRegistration: p.DisableRegistration || readBoolEnv("DisableRegistration"), LogLevel: getOrEnv(p.LogLevel, "LOG_LEVEL", "info"), diff --git a/pkg/server/main.go b/pkg/server/main.go index 4e36b96d..e8fa1aa8 100644 --- a/pkg/server/main.go +++ b/pkg/server/main.go @@ -81,8 +81,8 @@ Flags: } appEnv := startFlags.String("appEnv", "", "Application environment (env: APP_ENV, default: PRODUCTION)") - port := startFlags.String("port", "", "Server port (env: PORT, default: 3000)") - webURL := startFlags.String("webUrl", "", "Full URL to server without trailing slash (env: WebURL, example: https://example.com)") + port := startFlags.String("port", "", "Server port (env: PORT, default: 3001)") + webURL := startFlags.String("webUrl", "", "Full URL to server without trailing slash (env: WebURL, default: http://localhost:3001)") dbPath := startFlags.String("dbPath", "", "Path to SQLite database file (env: DBPath, default: $XDG_DATA_HOME/dnote/server.db)") disableRegistration := startFlags.Bool("disableRegistration", false, "Disable user registration (env: DisableRegistration, default: false)") logLevel := startFlags.String("logLevel", "", "Log level: debug, info, warn, or error (env: LOG_LEVEL, default: info)") diff --git a/scripts/cli/build.sh b/scripts/cli/build.sh index c805ba90..c5c6043c 100755 --- a/scripts/cli/build.sh +++ b/scripts/cli/build.sh @@ -57,7 +57,7 @@ build() { # build binary destDir="$outputDir/$platform-$arch" - ldflags="-X main.apiEndpoint=https://localhost:3000/api -X main.versionTag=$version" + ldflags="-X main.apiEndpoint=https://localhost:3001/api -X main.versionTag=$version" tags="fts5" pushd "$projectDir" diff --git a/scripts/cli/dev.sh b/scripts/cli/dev.sh index ce173496..d4a23e76 100755 --- a/scripts/cli/dev.sh +++ b/scripts/cli/dev.sh @@ -6,6 +6,6 @@ dir=$(dirname "${BASH_SOURCE[0]}") sudo rm -rf "$(which dnote)" "$GOPATH/bin/cli" # change tags to darwin if on macos -go install -ldflags "-X main.apiEndpoint=http://127.0.0.1:3000/api" --tags "linux fts5" "$dir/../../pkg/cli" +go install -ldflags "-X main.apiEndpoint=http://127.0.0.1:3001/api" --tags "linux fts5" "$dir/../../pkg/cli" sudo ln -s "$GOPATH/bin/cli" /usr/local/bin/dnote diff --git a/scripts/e2e/test.sh b/scripts/e2e/test.sh index 240d5c97..8ff94364 100755 --- a/scripts/e2e/test.sh +++ b/scripts/e2e/test.sh @@ -9,5 +9,5 @@ source "$basePath/pkg/server/.env.test" set +a pushd "$basePath"/pkg/e2e -go test --tags "fts5" ./... -p 1 +go test --tags "fts5" ./... -p 1 -v -timeout 5m popd diff --git a/scripts/server/dev.sh b/scripts/server/dev.sh index 5eb93328..7e1fe80e 100755 --- a/scripts/server/dev.sh +++ b/scripts/server/dev.sh @@ -23,7 +23,7 @@ cp "$basePath"/pkg/server/assets/static/* "$basePath/pkg/server/static" # run server moduleName="github.com/dnote/dnote" ldflags="-X '$moduleName/pkg/server/buildinfo.CSSFiles=main.css' -X '$moduleName/pkg/server/buildinfo.JSFiles=main.js' -X '$moduleName/pkg/server/buildinfo.Version=dev' -X '$moduleName/pkg/server/buildinfo.Standalone=true'" -task="go run -ldflags \"$ldflags\" --tags fts5 main.go start -port 3000" +task="go run -ldflags \"$ldflags\" --tags fts5 main.go start -port 3001" ( cd "$basePath/pkg/watcher" && \