Skip to content

Commit

Permalink
Merge pull request #11 from bucko13/deployment-environments
Browse files Browse the repository at this point in the history
fix: conditional base url subpath for flexible deployments
  • Loading branch information
nk1tz authored Feb 15, 2024
2 parents e3f288b + fa74b6c commit 328bc3e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-ligers-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@caravan/coordinator": patch
---

Enable caravan coordinator to be run without the subpath which is primarily just for supporting github pages hosting but causes issues in other environments
4 changes: 2 additions & 2 deletions apps/coordinator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ ENV NODE_OPTIONS=--max-old-space-size=32768

RUN npx turbo run build --filter=coordinator...

# Serve the production build files via nginx (will be served at http://localhost:80/caravan/#
# Serve the production build files via nginx (will be served at http://localhost:80/#
# in docker vm. Map port 80 to a different port on the host machine to access the app)
FROM nginx:1.23 AS runner
WORKDIR /app
COPY --from=installer /app/apps/coordinator/build /usr/share/nginx/html/caravan
COPY --from=installer /app/apps/coordinator/build /usr/share/nginx/html/
6 changes: 3 additions & 3 deletions apps/coordinator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $ npm run dev
...
```

Now visit http://localhost:5173/caravan/# to interact with your local copy of
Now visit http://localhost:5173/# to interact with your local copy of
Caravan.

### Host Remotely
Expand Down Expand Up @@ -97,10 +97,10 @@ docker build -t caravan:latest -f apps/coordinator/Dockerfile .
To run the built docker image:

```bash
docker run -p 80:8000 caravan:latest
docker run -p 8000:80 caravan:latest
```

Caravan should then be accessible at http://localhost:8000/caravan/#
Caravan should then be accessible at http://localhost:8000/#

## Usage

Expand Down
6 changes: 5 additions & 1 deletion apps/coordinator/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
base: "/caravan/#",
// only need to set the base to a subdirectory when deploying to GitHub Pages
// otherwise, if running locally or deploying via alternative like vercel or replit,
// then the sub-path can cause issues
base:
process.env.GH_PAGES || process.env.GITHUB_ACTIONS ? "/caravan/#" : "/#",
resolve: {
alias: {
utils: path.resolve(__dirname, "./src/utils"),
Expand Down

0 comments on commit 328bc3e

Please sign in to comment.