Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default dev server port #173

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/front/.env
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HOST=localhost
# fix docker apache port - This value need to be sync with docker compose external port
DOCKER_APACHE_PORT=4321
# docker node port
DOCKER_NODE_PORT=3000
DOCKER_NODE_PORT=5173

### BUILD HTACCESS
# Encrypted password
Expand Down
1 change: 1 addition & 0 deletions apps/front/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ dist-ssr
.cache
vite.config.ts.timestamp*
build-stats.html
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion apps/front/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ htaccessTemplateFilePath: resolve("src/.htaccess")
PROTOCOL=https
```

When you run `npm run dev`, you should see the app running on https://localhost:3000
When you run `npm run dev`, you should see the app running on https://localhost:5173

## Workflow

Expand Down
2 changes: 1 addition & 1 deletion apps/front/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const log = debug("server:server")

const loadEnvVars = loadEnv(process.env.NODE_ENV, process.cwd(), "")
const isProduction = process.env.NODE_ENV === "production"
const port = process.env.DOCKER_NODE_PORT ?? portFinderSync.getPort(3000)
const port = process.env.DOCKER_NODE_PORT ?? portFinderSync.getPort(5173)
const protocol = loadEnvVars.PROTOCOL ?? "http"
const isSSL = protocol === "https"

Expand Down
2 changes: 1 addition & 1 deletion apps/front/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineConfig(({ command, mode }: ConfigEnv): UserConfig => {
// In some case, process.env vars are loaded via external service like gitlab-ci
// and must overwrite .env vars loaded by loadEnv()
...process.env,
PORT: `${loadEnvVars.DOCKER_NODE_PORT ?? portFinderSync.getPort(3000)}`,
PORT: `${loadEnvVars.DOCKER_NODE_PORT ?? portFinderSync.getPort(5173)}`,
HOST: loadEnvVars["HOST"] ?? ipAddress,
PROTOCOL: protocol,
COMMAND: command,
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ services:
node:
image: node:18.17.1
ports:
- "${DOCKER_NODE_PORT:-3000}:3000"
- "24678:24678" # vite hot reload port
- "1234:1234" # expose node server for generating pages
- "${DOCKER_NODE_PORT:-5173}:5173" # vite dev server
- "24678:24678" # vite HMR
- "1234:1234" # expose express server for static page generation
volumes:
- "./:/app"
working_dir: /app
Expand Down
Loading