diff --git a/.dev/config.toml b/.dev/config.toml index 4c8032444..19e963d94 100644 --- a/.dev/config.toml +++ b/.dev/config.toml @@ -1,8 +1,8 @@ -httpPort = 4001 +httpPort = 44643 noDaemon = true [client] -url = "http://localhost:4001" +url = "http://localhost:44643" [gui] port = 3001 diff --git a/doc/local-development.md b/doc/local-development.md index 26bbb7014..122c1f5e1 100644 --- a/doc/local-development.md +++ b/doc/local-development.md @@ -14,13 +14,13 @@ cd path/to/exo exo run ``` -If all goes well, you should be able to manage your server and gui processes at [http://localhost:4000](http://localhost:4000). Please note that this is the _installed_ exo gui that you are viewing, not the development instance. The development instance runs on port `4001` and can be accessed at [http://localhost:4001](http://localhost:4001). The development mode GUI has a "DEV" indicator in the footer so that you can tell at a glance which instance you are using. +If all goes well, you should be able to manage your server and gui processes at [http://localhost:43643](http://localhost:43643). Please note that this is the _installed_ exo gui that you are viewing, not the development instance. The development instance runs on port `44643` and can be accessed at [http://localhost:44643](http://localhost:44643). The development mode GUI has a "DEV" indicator in the footer so that you can tell at a glance which instance you are using. The `exo` CLI runs against the installed instance by default, but you can change to the development instance by adding the following to your exo config file (located at `~/.exo/config.toml`): ``` [client] -url = "http://localhost:4001" +url = "http://localhost:44643" ``` Now all `exo` commands will run against the development instance. To run against the installed instance again, remove or comment out these lines from your `config.toml`. diff --git a/gui/.env.development b/gui/.env.development index 1393130db..b5dd420e3 100644 --- a/gui/.env.development +++ b/gui/.env.development @@ -1 +1 @@ -VITE_API_PORT=4001 +VITE_API_PORT=44643 diff --git a/gui/.env.production b/gui/.env.production index ba7171f9f..9f2e76101 100644 --- a/gui/.env.production +++ b/gui/.env.production @@ -1 +1,2 @@ -VITE_API_PORT=4000 +# FIXME: this should come from the config.toml +VITE_API_PORT=43643 diff --git a/gui/vite.config.js b/gui/vite.config.js index c9a5a2b77..83b017edb 100644 --- a/gui/vite.config.js +++ b/gui/vite.config.js @@ -2,8 +2,8 @@ import { defineConfig } from 'vite'; import { svelte } from '@sveltejs/vite-plugin-svelte'; // Vite server runs on 3001 in development, which is proxied from the -// `exo` server running on 4001. In production, exo serves the GUI and -// the API on port 4000. +// `exo` server running on 44643. In production, exo serves the GUI and +// the API on port 43643. const port = 3001; // https://vitejs.dev/config/ diff --git a/internal/config/config.go b/internal/config/config.go index 3692b56b3..739f39d52 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -111,12 +111,12 @@ func setDefaults(cfg *Config) { } if cfg.HTTPPort == 0 { - cfg.HTTPPort = 4000 + cfg.HTTPPort = 43643 } // Log if cfg.Log.SyslogPort == 0 { - cfg.Log.SyslogPort = 4500 + cfg.Log.SyslogPort = 43550 } // GUI diff --git a/internal/config/defaultconfig.toml b/internal/config/defaultconfig.toml index 37e1d9a01..120fabe45 100644 --- a/internal/config/defaultconfig.toml +++ b/internal/config/defaultconfig.toml @@ -12,7 +12,7 @@ # runDir = "/path/to/exo-home/run" # Port the daemon service listens on. -# httpPort = 4000 +# httpPort = 43643 ## Logging subsystem that collects logs from running services. [log] diff --git a/internal/exod/main.go b/internal/exod/main.go index cfcca4118..778afe728 100644 --- a/internal/exod/main.go +++ b/internal/exod/main.go @@ -211,6 +211,21 @@ func RunServer(ctx context.Context, flags map[string]string) { Next: mux, }) + go func() { + // Add a redirect to the new port number if a request is received on the old + // one. Ignore any error as that's most likely some other service attempting + // to listen on the same port. This is to allow people to upgrade seamlessly + // but we should be able to remove it soon after the next release. (Written + // on the 19th of Oct 2021) + http.ListenAndServe(":4000", http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) { + uri := *req.URL + uri.Host = fmt.Sprintf("localhost:%d", cfg.HTTPPort) + redirectTo := uri.String() + http.Redirect(resp, req, redirectTo, http.StatusMovedPermanently) + return + })) + }() + addr := cmdutil.GetAddr(cfg) logger.Infof("listening for API calls at %s", addr) cmdutil.ListenAndServe(ctx, &http.Server{