mirror of
https://github.com/dnote/dnote
synced 2026-03-14 14:35:50 +01:00
Run server on port 3001 (#687)
* Simplify docker compose file * Run on port 3001
This commit is contained in:
parent
162ceb4ad1
commit
ca5af5e34a
17 changed files with 45 additions and 36 deletions
|
|
@ -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
|
||||
|
|
|
|||
34
README.md
34
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.
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
</VirtualHost>
|
||||
```
|
||||
|
|
|
|||
BIN
assets/cli.gif
BIN
assets/cli.gif
Binary file not shown.
|
Before Width: | Height: | Size: 245 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB |
|
|
@ -13,4 +13,4 @@ ENTRYPOINT ["./entrypoint.sh"]
|
|||
|
||||
CMD ./dnote-server start
|
||||
|
||||
EXPOSE 3000
|
||||
EXPOSE 3001
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ SmtpPassword=mock-SmtpPassword
|
|||
SmtpHost=mock-SmtpHost
|
||||
SmtpPort=465
|
||||
|
||||
WebURL=http://localhost:3000
|
||||
WebURL=http://localhost:3001
|
||||
DisableRegistration=false
|
||||
|
|
|
|||
|
|
@ -5,5 +5,5 @@ SmtpPassword=mock-SmtpPassword
|
|||
SmtpHost=mock-SmtpHost
|
||||
SmtpPort=465
|
||||
|
||||
WebURL=http://localhost:3000
|
||||
WebURL=http://localhost:3001
|
||||
DisableRegistration=false
|
||||
|
|
|
|||
|
|
@ -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"),
|
||||
|
|
|
|||
|
|
@ -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)")
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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" && \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue