Skip to content

Commit

Permalink
Merge pull request #267 from CannonLock/dev-documentation
Browse files Browse the repository at this point in the history
Add some documentation on developing the website
  • Loading branch information
bbockelm authored Oct 28, 2023
2 parents 7a2aae7 + 061aeae commit 3d8b3b6
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
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

0 comments on commit 3d8b3b6

Please sign in to comment.