diff --git a/doc/example-nginx-bisontrails.conf b/doc/example-nginx-bisontrails.conf deleted file mode 100644 index e35e7bc77..000000000 --- a/doc/example-nginx-bisontrails.conf +++ /dev/null @@ -1,45 +0,0 @@ -# generate YOUR_BASE64_USERPASS with `echo -n user:password | base64 -w0` -# replace YOUR_NODE and YOUR_BASE64_USERPASS -# docker run -v /path/to/nginx-bisontrails.conf:/etc/nginx/nginx.conf:ro -p 7899:7899 -p 7900:7900 -d docker.io/nginx - -worker_processes 1; - -events {} - -http { - include /etc/nginx/mime.types; - - rewrite_log on; - - keepalive_requests 2147483647; # int32 max - - client_max_body_size 0; - - upstream backend { - server YOUR_NODE:443; - keepalive 4; - } - - server { - listen 7900; - location / { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_pass https://backend/ws; - proxy_set_header Authorization "Basic YOUR_BASE64_USERPASS"; - proxy_set_header Host YOUR_NODE; - } - } - - server { - listen 7899; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_pass https://backend/rpc; - proxy_set_header Authorization "Basic YOUR_BASE64_USERPASS"; - proxy_set_header Host YOUR_NODE; - } - } -} diff --git a/doc/example-nginx-blockdaemon.conf b/doc/example-nginx-blockdaemon.conf deleted file mode 100644 index 0a124985d..000000000 --- a/doc/example-nginx-blockdaemon.conf +++ /dev/null @@ -1,62 +0,0 @@ -# replace YOUR_NODE and YOUR_AUTH_TOKEN_HERE -# docker run -v /path/to/nginx-blockdaemon.conf:/etc/nginx/nginx.conf:ro -p 7899:7899 -p 7900:7900 -d docker.io/nginx - -worker_processes 1; - -events {} - -http { - include /etc/nginx/mime.types; - - rewrite_log on; - - keepalive_requests 2147483647; # int32 max - - client_max_body_size 0; - - # Pythnet servers - server { - listen 7900; - server_name pythnet.localhost; - location / { - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_ssl_server_name on; - proxy_set_header Host "rpc.mainnet.pythnet.blockdaemon.tech"; - proxy_pass https://rpc.mainnet.pythnet.blockdaemon.tech:443/websocket; - } - } - server { - listen 7899; - server_name pythnet.localhost; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_ssl_server_name on; - proxy_set_header Host "rpc.mainnet.pythnet.blockdaemon.tech"; - proxy_pass https://rpc.mainnet.pythnet.blockdaemon.tech:443/; - } - } - - # Solana servers - server { - listen 7900; - server_name solana.localhost; - location / { - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_set_header Authorization "Bearer "; - proxy_pass https://YOUR_NODE.bdnodes.net:443/websocket; - } - } - server { - listen 7899; - server_name solana.localhost; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_set_header Authorization "Bearer "; - proxy_pass https://YOUR_NODE.bdnodes.net:443/; - } - } -} diff --git a/doc/example-nginx-figment.conf b/doc/example-nginx-figment.conf deleted file mode 100644 index a83466045..000000000 --- a/doc/example-nginx-figment.conf +++ /dev/null @@ -1,42 +0,0 @@ -# replace YOUR_AUTH_TOKEN_HERE -# docker run -v /path/to/nginx-figment.conf:/etc/nginx/nginx.conf:ro -p 7899:7899 -p 7900:7900 -d docker.io/nginx - -worker_processes 1; - -events {} - -http { - include /etc/nginx/mime.types; - - rewrite_log on; - - keepalive_requests 2147483647; # int32 max - - client_max_body_size 0; - - upstream backend { - server solana--mainnet--pyth.datahub.figment.io:443; - keepalive 4; - } - - server { - listen 7900; - location / { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_pass https://backend/apikey/YOUR_AUTH_TOKEN_HERE/; - proxy_set_header Host solana--mainnet--pyth.datahub.figment.io; - } - } - - server { - listen 7899; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_pass https://backend/apikey/YOUR_AUTH_TOKEN_HERE/; - proxy_set_header Host solana--mainnet--pyth.datahub.figment.io; - } - } -} diff --git a/doc/example-nginx-triton1.conf b/doc/example-nginx-triton1.conf deleted file mode 100644 index 19092fd91..000000000 --- a/doc/example-nginx-triton1.conf +++ /dev/null @@ -1,66 +0,0 @@ -# replace YOUR_NODE and YOUR_AUTH_TOKEN_HERE -# docker run -v /path/to/nginx-triton1.conf:/etc/nginx/nginx.conf:ro -p 7899:7899 -p 7900:7900 -d docker.io/nginx - -worker_processes 1; - -events {} - -http { - include /etc/nginx/mime.types; - - rewrite_log on; - - keepalive_requests 2147483647; # int32 max - - client_max_body_size 0; - - # Pythnet, listening on ports 7799:7800 - upstream pythnet_backend { - server YOUR_PYTHNET_NODE.rpcpool.com:443; - keepalive 4; - } - server { - listen 7800; - location / { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_pass https://pythnet_backend/YOUR_PYTHNET_AUTH_TOKEN_HERE/; - proxy_set_header Host YOUR_PYTHNET_NODE.rpcpool.com; - } - } - server { - listen 7799; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_pass https://pythnet_backend/YOUR_PYTHNET_AUTH_TOKEN_HERE/; - proxy_set_header Host YOUR_PYTHNET_NODE.rpcpool.com; - } - } - - # Solana Mainnet, listening on ports 7899:7900 - upstream mainnet_backend { - server YOUR_MAINNET_NODE.rpcpool.com:443; - keepalive 4; - } - server { - listen 7900; - location / { - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_pass https://mainnet_backend/YOUR_MAINNET_AUTH_TOKEN_HERE/; - proxy_set_header Host YOUR_MAINNET_NODE.rpcpool.com; - } - } - server { - listen 7899; - location / { - proxy_http_version 1.1; - proxy_set_header Connection ""; - proxy_pass https://mainnet_backend/YOUR_MAINNET_AUTH_TOKEN_HERE/; - proxy_set_header Host YOUR_MAINNET_NODE.rpcpool.com; - } - } -} diff --git a/doc/https-for-rpc-providers.md b/doc/https-for-rpc-providers.md deleted file mode 100644 index dcdad501f..000000000 --- a/doc/https-for-rpc-providers.md +++ /dev/null @@ -1,79 +0,0 @@ -# HTTPS connections to RPC providers - -The pyth-client code does not have native TLS support to connect to various RPC providers that require HTTPS connections in order to safeguard authentication credentials that a customer requires to access their services. - -This lack will be remedied in a future release but in order to address the problem, we have provided some example `nginx` configurations for three providers as well as a wrapper configuration that will permit a developer or operations tech to run `nginx` locally without superuser privileges and on high numbered ports. The configurations as provided expose the following ports and map to the following providers: - -| Port number | Provider | protocol notes | -| ---- | ------------ | ------------------------------- | -| 7800 | Blockdaemon | websocket only | -| 7900 | Blockdaemon | HTTP RPC and websocket | -| 7801 | Figment | websocket only | -| 7901 | Figment | HTTP RPC and websocket | -| 7802 | TritonOne | websocket only | -| 7902 | TritonOne | HTTP RPC and websocket | -| 7803 | BisonTrails | websocket only | -| 7903 | BisonTrails | HTTP RPC and websocket | - -## Running `nginx` as a standalone, unprivileged process - -1. Make sure `nginx` is installed on your machine, in your VM or, in your container. -2. Clone a copy of this repository or copy the `nginx-configs` directory to the machine in question. -3. `cd doc/nginx-configs` -4. In `standalone-dev-nginx.conf` replace `127.0.0.1` with the appropriate DNS resolver for your network, if necessary. This can usually be retrieved via `grep nameserver /etc/resolv.conf`. -5. For the RPC provider(s) which you are using, be sure to replace `YOUR_SERVER` and `REPLACE_ME_WITH_YOUR_AUTH_TOKEN` in the appropriate configuration file. -6. You can then run `nginx` as with the command `nginx -c $(pwd)/standalone-dev-nginx.conf -g 'daemon off;'` - -An example follows. - -``` -[pyth@pyth-dev-vm nginx-configs]$ nginx -c $(pwd)/standalone-dev-nginx.conf -g 'daemon off;' -nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) - -^C -[pyth@pyth-dev-vm nginx-configs]$ -``` - -There are a few caveats. - -1. On most Linux distributions, the error shown above about `/var/log/nginx/error_log` failing to open is normal. It's a hardcoded default for most builds. It can be safely ignored. -2. The full, absolute path must be provided for the configuration file. Any relative paths are assumed to be relative to `nginx`'s application data directory (usually `/usr/share/nginx/...`). - -You can test any of the HTTP RPC interface for the providers with the following command line. Replace `` with one of the port numbers in the table above. - -`curl http://localhost: -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}'` - -An example of the output expected: - -``` -[pyth@pyth-dev-vm nginx-configs]$ curl http://localhost:7901 -X POST -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","id":1,"method":"getHealth"}' -{"jsonrpc":"2.0","result":"ok","id":1} -[pyth@pyth-dev-vm nginx-configs]$ -``` - -You can test any of the websocket interface for the providers with the following command line. Replace `` with one of the port numbers in the table above. - -`curl --include --no-buffer --header "Connection: Upgrade" --header "Upgrade: websocket" --header "Host: api.mainnet-beta.solana.com" --header "Origin: https://api.mainnet-beta.solana.com" --header "Sec-WebSocket-Key: abcdefghijklmnop==" --header "Sec-WebSocket-Version: 13" http://localhost:/` - -An example to test the websocket interface: - -``` -[pyth@pyth-dev-vm nginx-configs]$ curl --include \ - --no-buffer \ - --header "Connection: Upgrade" \ - --header "Upgrade: websocket" \ - --header "Host: api.mainnet-beta.solana.com" \ - --header "Origin: https://api.mainnet-beta.solana.com" \ - --header "Sec-WebSocket-Key: abcdefghijklmnop==" \ - --header "Sec-WebSocket-Version: 13" \ - http://localhost:7801/ -HTTP/1.1 101 Switching Protocols -upgrade: websocket -connection: Upgrade -sec-websocket-accept: FX/kNn6LL8gnqQea2uak6E6sPOU= - -^C -[pyth@pyth-dev-vm nginx-configs]$ -``` - -The virtual server configurations found in `nginx-configs/...` are meant as a sample to be used reference material. Each `nginx` installation will require tweaking and fine tuning if it varies much from the software provided.