diff --git a/Client/.env.production b/Client/.env.production new file mode 100644 index 000000000..a5bce84e1 --- /dev/null +++ b/Client/.env.production @@ -0,0 +1 @@ +VITE_APP_API_BASE_URL=UPTIME_APP_API_BASE_URL diff --git a/Client/.gitignore b/Client/.gitignore index 50c8dda2a..ebf01f87a 100644 --- a/Client/.gitignore +++ b/Client/.gitignore @@ -24,3 +24,5 @@ dist-ssr *.sw? .env + +!env.sh \ No newline at end of file diff --git a/Client/env.sh b/Client/env.sh new file mode 100755 index 000000000..d95f8ee8f --- /dev/null +++ b/Client/env.sh @@ -0,0 +1,8 @@ +#!/bin/sh +for i in $(env | grep UPTIME_APP_) +do + key=$(echo $i | cut -d '=' -f 1) + value=$(echo $i | cut -d '=' -f 2-) + echo $key=$value + find /usr/share/nginx/html -type f \( -name '*.js' -o -name '*.css' \) -exec sed -i "s|${key}|${value}|g" '{}' + +done \ No newline at end of file diff --git a/Client/package.json b/Client/package.json index 44d796143..7e649e1f7 100644 --- a/Client/package.json +++ b/Client/package.json @@ -6,6 +6,7 @@ "scripts": { "dev": "vite", "build": "vite build", + "build-dev": "vite build --mode development", "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, diff --git a/Docker/dev/client.Dockerfile b/Docker/dev/client.Dockerfile index a650e0f72..37b2bae74 100644 --- a/Docker/dev/client.Dockerfile +++ b/Docker/dev/client.Dockerfile @@ -8,7 +8,7 @@ RUN npm install COPY ../../Client . -RUN npm run build +RUN npm run build-dev RUN npm install -g serve diff --git a/Docker/dist/build_images.sh b/Docker/dist/build_images.sh index a5ec3eec9..33af5efdf 100755 --- a/Docker/dist/build_images.sh +++ b/Docker/dist/build_images.sh @@ -6,10 +6,10 @@ cd ../.. # Define an array of services and their Dockerfiles declare -A services=( - ["bluewave/uptime_client"]="./Docker/dist/client.Dockerfile" - ["bluewave/database_mongo"]="./Docker/dist/mongoDB.Dockerfile" - ["bluewave/uptime_redis"]="./Docker/dist/redis.Dockerfile" - ["bluewave/uptime_server"]="./Docker/dist/server.Dockerfile" + ["bluewaveuptime/uptime_client"]="./Docker/dist/client.Dockerfile" + ["bluewaveuptime/uptime_database_mongo"]="./Docker/dist/mongoDB.Dockerfile" + ["bluewaveuptime/uptime_redis"]="./Docker/dist/redis.Dockerfile" + ["bluewaveuptime/uptime_server"]="./Docker/dist/server.Dockerfile" ) # Loop through each service and build the corresponding image diff --git a/Docker/dist/client.Dockerfile b/Docker/dist/client.Dockerfile index 1edbfa522..3c4f577c0 100644 --- a/Docker/dist/client.Dockerfile +++ b/Docker/dist/client.Dockerfile @@ -15,5 +15,7 @@ FROM nginx:1.27.1-alpine COPY ./Docker/dist/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf COPY --from=build /app/dist /usr/share/nginx/html +COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh +RUN chmod +x /docker-entrypoint.d/env.sh CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/Docker/dist/docker-compose.yaml b/Docker/dist/docker-compose.yaml index 56a7a3c78..c62fb2ea6 100644 --- a/Docker/dist/docker-compose.yaml +++ b/Docker/dist/docker-compose.yaml @@ -1,6 +1,8 @@ services: client: image: bluewaveuptime/uptime_client:latest + environment: + UPTIME_APP_API_BASE_URL: "http://localhost:5000/api/v1" ports: - "80:80" - "443:443" diff --git a/Docker/prod/client.Dockerfile b/Docker/prod/client.Dockerfile index cbdb75aa8..1619b5e41 100644 --- a/Docker/prod/client.Dockerfile +++ b/Docker/prod/client.Dockerfile @@ -13,5 +13,6 @@ RUN npm run build FROM nginx:1.27.1-alpine COPY --from=build /app/dist /usr/share/nginx/html - +COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh +RUN chmod +x /docker-entrypoint.d/env.sh CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/Docker/prod/docker-compose.yaml b/Docker/prod/docker-compose.yaml index fa29a0d4d..69202c8d7 100644 --- a/Docker/prod/docker-compose.yaml +++ b/Docker/prod/docker-compose.yaml @@ -1,6 +1,8 @@ services: client: image: uptime_client:latest + environment: + UPTIME_APP_API_BASE_URL: "http://localhost:5000/api/v1" ports: - "80:80" - "443:443" diff --git a/guides/users-guide/quickstart.md b/guides/users-guide/quickstart.md index 6bc6975c4..55e23f286 100644 --- a/guides/users-guide/quickstart.md +++ b/guides/users-guide/quickstart.md @@ -12,6 +12,15 @@ icon: sign-posts-wrench --- +## Quickstart for users (remote server) + +1. Download our [Docker compose file](https://github.com/bluewave-labs/bluewave-uptime/blob/develop/Docker/dist/docker-compose.yaml) +2. Edit the `UPTIME_APP_API_BASE_URL` variable in the docker-compose file to point to your remote server. +3. Run `docker compose up` to start the application +4. Now the application is running at `http://` + +--- + ## Quickstart for developers {% hint style="info" %}