The following instructions are for Ubuntu 22.10, other operating systems may vary. These instructions include automated SSL configuration with LetsEncrypt.
PREREQUISITES
- Update core dependencies
sudo apt-get update
- Install docker-compose
curl -SL https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose && sudo chmod +x /usr/local/bin/docker-compose
- Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh && chmod +x get-docker.sh && ./get-docker.sh
- Install git
sudo apt-get install git-all
- Install nginx
sudo apt install nginx
- Stop apache2 instance (enabled by default)
sudo systemctl stop apache2
FIREWALL CONFIGURATION
* Warning: Failure to configure SSH as the first UFW rule, will lock you out of the instance
- Make sure UFW is installed by running
apt updateandapt install ufw - Allow SSH in the first position in UFW by running
sudo ufw allow OpenSSH* - Allow HTTP, and HTTPS by running
sudo ufw allow http,sudo ufw allow https - Finalize changes and enable firewall
sudo ufw enable
DEPLOYMENT
- Clone the repository and enter the directory
git clone https://github.com/ArcanePrivacy/Relayer.git && cd Relayer
- Clone the example environment file
.env.exampleto configure for the preferred network -cp .env.example .env, then fill.envfile.
- Set
PRIVATE_KEYfor your relayer address. Accepted formats: base58, JSON byte array ([159,24,...]), comma-separated bytes (159,24,...), or0x-prefixed hex (64-byte key). - Set
RELAYER_FEEto what you would like to charge as your fee (remember 0.3% is deducted from your staked relayer balance) - Set
RANGE_API_KEY(you can get key from here) - Set
RPC_URL— for example Helius (https://devnet.helius-rpc.com/?api-key=...orhttps://mainnet.helius-rpc.com/?api-key=...matchingNET_ID) - Set
REDIS_PASSWORD - Set
NET_ID=devnetif you're running relayer on devnet
- Clone the reverse-proxy environment file
.env.proxy.exampleto configure your domain/TLS -cp .env.proxy.example .env.proxy, then fill.env.proxy.
- Set
VIRTUAL_HOSTandLETSENCRYPT_HOSTto your domain address- add a A record DNS record with the value assigned to your instance IP address to configure the domain
- Uncomment the
env_filelines (remove#) for the associated network services indocker-compose.yml - Build and deploy the docker source by specifying the network through:
sudo apt install npmnpm run builddocker-compose up -d
- Visit your domain address and check the
/statusendpoint and ensure there is no errors in thestatusfield
NGINX REVERSE PROXY
- Copy the pre-modified nginx policy as your default policy
cp arcane.conf /etc/nginx/sites-available/default
- Append the default nginx configuration to include streams
echo "stream { map_hash_bucket_size 128; map_hash_max_size 128; include /etc/nginx/conf.d/streams/*.conf; }" >> /etc/nginx/nginx.conf
- Create the stream configuration
mkdir /etc/nginx/conf.d/streams && cp arcane-stream.conf /etc/nginx/conf.d/streams/arcane-stream.conf
- Start nginx to make sure the configuration is correct
sudo systemctl restart nginx
- Stop nginx
sudo systemctl stop nginx
npm icp .env.example .env- Modify
.envas needed npm run start- Go to
http://127.0.0.1:8000 - In order to execute withdraw request, you can run following command
curl -X POST -H 'content-type:application/json' --data '<input data>' http://127.0.0.1:8000/relayRelayer should return a transaction hash.