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

Add some documentation on developing the website #267

Merged
merged 2 commits into from
Oct 28, 2023
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
34 changes: 34 additions & 0 deletions origin_ui/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,40 @@ This ui is generated with Next.js.

## Development

### Local

In production builds the website is compiled and included with the code. This step
takes a couple minutes and is not well suited for development. Since the website
sits on top of the api the best way to develop just the website is to run the api
and the website separately and then use nginx to make them come from the same host
as they would in production.

#### To run the api:

```shell
# From repo root
goreleaser --clean --snapshot
docker run --rm -it -p 8444:8444 -w /app -v $PWD/dist/pelican_linux_arm64/:/app pelican-dev /bin/bash
```

```shell
# Inside the container
cp pelican osdf
./osdf origin serve -f https://osg-htc.org -v /tmp/stash/:/test
```

#### To run the website and the reverse proxy:

First make sure that the ports are correct in `dev/nginx.conf` so that they point to
the website and the api as expected. Then run the following command.

```shell
sh dev/run.sh
npm run dev
```

### Docker

```shell
docker build -t origin-ui .
```
Expand Down
38 changes: 38 additions & 0 deletions origin_ui/src/dev/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
user nginx;
worker_processes auto; ## Default: 1
worker_rlimit_nofile 8192;

error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;

events {
worker_connections 4096; ## Default: 1024
}

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

index index.html index.htm index.php;

server {
listen 8443;

location /api {
proxy_read_timeout 300s;
proxy_connect_timeout 10s;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass https://host.docker.internal:8444;
}

location /view {
proxy_read_timeout 300s;
proxy_connect_timeout 10s;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://host.docker.internal:3001;
}

gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
}
}
2 changes: 2 additions & 0 deletions origin_ui/src/dev/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker restart pelican-dev-proxy
docker run --name pelican-dev-proxy -it -p 8443:8443 -v $0/../nginx.conf:/etc/nginx/nginx.conf:ro -d nginx
Loading