ArduPilot / ArduPilot/UAVLogViewer

Host Production Setup

Open
#450 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
258
Forks
296
PR merge metrics
No merged PRs in 30d

Description

Hey,

I am trying to host a slightly tweaked version, but can't get it to work when not using the dev setup.

The app launches with my setup but when uploading a log it gets stuck on the loading animation.

I have tried running it inside a docker compose setup with nginx:

ngnix.conf
```

worker_processes 1;

events { worker_connections 1024; }

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;

location / {
try_files $uri $uri/ /index.html;
}
}
}

```

Dockerfile.prod
```
FROM node:20 AS build-stage

# Create app directory
WORKDIR /usr/src/app

# Install git (needed for submodules)
RUN apt-get update && apt-get install -y git

# Create a non-root user
RUN useradd -m -u 2000 nodeuser

# Copy package files first for better caching
COPY package*.json ./

# Install dependencies
RUN npm install

# Bundle app source
COPY . .

# Initialize and update git submodules
RUN git init
RUN git submodule init
RUN git submodule update

# Run the update-browserslist-db as suggested in the warning
RUN npx update-browserslist-db@latest

# Change ownership of the app directory to the non-root user
RUN chown -R nodeuser:nodeuser /usr/src/app

# Switch to non-root user
USER nodeuser

# Configure git to trust the mounted directory
RUN git config --global --add safe.directory /usr/src/app

# Build the Vue app
RUN npm run build

FROM nginx:alpine AS production-stage
COPY --from=build-stage /usr/src/app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

```

docker-compose-prod.yaml
```
version: "3.8"

services:
uavlogviewer:
build:
context: .
dockerfile: Dockerfile.prod
ports:
- "80:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
restart: unless-stopped
environment:
- NODE_ENV=production
```

Thanks for any help or pointers.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the stuck upload with docker-compose-prod.yaml and compare it with the development setup. Review Dockerfile.prod and nginx.conf, then trace the log-upload request during a production build. Done means an uploaded log finishes loading instead of remaining on the loading animation.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose, javascript, nginx
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.