[{"data":1,"prerenderedAt":1625},["ShallowReactive",2],{"doc:docs_en:\u002Fdocs\u002F03-cai-tren-server":3,"doc-nav:docs_en":1608},{"id":4,"title":5,"body":6,"description":1601,"extension":1602,"meta":1603,"navigation":813,"path":1604,"seo":1605,"stem":1606,"__hash__":1607},"docs_en\u002Fdocs\u002F03-cai-tren-server.md","3. Install Hexcore on a server (Ubuntu, Debian, RHEL family)",{"type":7,"value":8,"toc":1589},"minimark",[9,13,28,33,68,87,91,106,159,175,179,186,199,229,232,254,258,284,358,360,399,454,461,465,504,517,521,528,538,585,591,621,624,689,693,702,879,886,894,897,944,947,951,954,1033,1038,1225,1239,1277,1295,1316,1326,1421,1425,1443,1445,1459,1483,1487,1585],[10,11,5],"h1",{"id":12},"_3-install-hexcore-on-a-server-ubuntu-debian-rhel-family",[14,15,16,17,21,22,27],"p",{},"Goal: Hexcore runs as a service, restarts itself when the server reboots, and is reached at ",[18,19,20],"code",{},"https:\u002F\u002F\u003Cdomain>"," with valid TLS (needed for multi-machine heads and Trust Center). Finish ",[23,24,26],"a",{"href":25},"01-chuan-bi-may","1. Prepare your machine"," on the server first.",[29,30,32],"h2",{"id":31},"_31-overview","3.1 Overview",[34,35,40],"pre",{"className":36,"code":37,"language":38,"meta":39,"style":39},"language-mermaid shiki shiki-themes github-light github-dark","flowchart LR\n  I[\"Internet\"] -->|\"DNS to :443\"| P[\"Reverse proxy\u003Cbr\u002F>Caddy or nginx\u003Cbr\u002F>terminates TLS\"]\n  P -->|\"HTTP + WebSocket\"| H[\"Hexcore\u003Cbr\u002F>127.0.0.1:4000\"]\n  H -->|\"Docker\"| N[\"hydra-node\"]\n","mermaid","",[18,41,42,50,56,62],{"__ignoreMap":39},[43,44,47],"span",{"class":45,"line":46},"line",1,[43,48,49],{},"flowchart LR\n",[43,51,53],{"class":45,"line":52},2,[43,54,55],{},"  I[\"Internet\"] -->|\"DNS to :443\"| P[\"Reverse proxy\u003Cbr\u002F>Caddy or nginx\u003Cbr\u002F>terminates TLS\"]\n",[43,57,59],{"class":45,"line":58},3,[43,60,61],{},"  P -->|\"HTTP + WebSocket\"| H[\"Hexcore\u003Cbr\u002F>127.0.0.1:4000\"]\n",[43,63,65],{"class":45,"line":64},4,[43,66,67],{},"  H -->|\"Docker\"| N[\"hydra-node\"]\n",[69,70,71,80],"ul",{},[72,73,74,75,79],"li",{},"Hexcore does not handle TLS itself: the reverse proxy takes HTTPS on port 443, forwards to port 4000, and ",[76,77,78],"strong",{},"must forward WebSocket upgrades"," (the node console, the SDK client, and the multi-machine head tunnels).",[72,81,82,83,86],{},"Multi-machine heads in relay mode (the default) go through this same domain, so ",[76,84,85],{},"no extra ports"," are needed beyond 80 and 443.",[29,88,90],{"id":89},"_32-prepare-the-server","3.2 Prepare the server",[14,92,93,94,97,98,101,102,105],{},"Run Hexcore as a regular user with ",[18,95,96],{},"sudo",", ",[76,99,100],{},"not root"," (the node keys live in that user's ",[18,103,104],{},"~\u002F.hexcore","). Create a dedicated user if you want one:",[34,107,111],{"className":108,"code":109,"language":110,"meta":39,"style":39},"language-bash shiki shiki-themes github-light github-dark","sudo adduser hexcore          # Debian\u002FUbuntu; RHEL family: sudo useradd -m hexcore && sudo passwd hexcore\nsudo usermod -aG docker,sudo hexcore   # RHEL family uses the wheel group instead of sudo\nsu - hexcore\n","bash",[18,112,113,129,148],{"__ignoreMap":39},[43,114,115,118,122,125],{"class":45,"line":46},[43,116,96],{"class":117},"sScJk",[43,119,121],{"class":120},"sZZnC"," adduser",[43,123,124],{"class":120}," hexcore",[43,126,128],{"class":127},"sJ8bj","          # Debian\u002FUbuntu; RHEL family: sudo useradd -m hexcore && sudo passwd hexcore\n",[43,130,131,133,136,140,143,145],{"class":45,"line":52},[43,132,96],{"class":117},[43,134,135],{"class":120}," usermod",[43,137,139],{"class":138},"sj4cs"," -aG",[43,141,142],{"class":120}," docker,sudo",[43,144,124],{"class":120},[43,146,147],{"class":127},"   # RHEL family uses the wheel group instead of sudo\n",[43,149,150,153,156],{"class":45,"line":58},[43,151,152],{"class":117},"su",[43,154,155],{"class":120}," -",[43,157,158],{"class":120}," hexcore\n",[14,160,161,162,165,166,170,171,174],{},"Then install nvm, Node.js and Hexcore ",[76,163,164],{},"as this user",", following ",[23,167,169],{"href":168},"01-chuan-bi-may#13-install-nodejs-with-nvm-recommended","§1.3–§1.5",". Enable time sync: ",[18,172,173],{},"sudo timedatectl set-ntp true",".",[29,176,178],{"id":177},"_33-first-time-setup-from-the-terminal","3.3 First-time setup from the terminal",[14,180,181,182,185],{},"A server usually has no browser, so use ",[18,183,184],{},"hexcore init"," instead of the web setup link:",[34,187,189],{"className":108,"code":188,"language":110,"meta":39,"style":39},"hexcore init\n",[18,190,191],{"__ignoreMap":39},[43,192,193,196],{"class":45,"line":46},[43,194,195],{"class":117},"hexcore",[43,197,198],{"class":120}," init\n",[69,200,201,215],{},[72,202,203,204,207,208,211,212,174],{},"Network: a provider joining the Trust Center pilot picks ",[18,205,206],{},"preprod",". Chain backend: ",[18,209,210],{},"cardano-node"," if you have a synced node, otherwise ",[18,213,214],{},"blockfrost",[72,216,217,218,221,222,225,226,174],{},"Admin: if you leave the password empty, Hexcore prints a generated password ",[76,219,220],{},"once"," on first start (read it with ",[18,223,224],{},"hexcore logs","); change it with ",[18,227,228],{},"hexcore password",[14,230,231],{},"Check:",[34,233,235],{"className":108,"code":234,"language":110,"meta":39,"style":39},"hexcore config     # every value and the configuration layer that decided it\nhexcore doctor\n",[18,236,237,247],{"__ignoreMap":39},[43,238,239,241,244],{"class":45,"line":46},[43,240,195],{"class":117},[43,242,243],{"class":120}," config",[43,245,246],{"class":127},"     # every value and the configuration layer that decided it\n",[43,248,249,251],{"class":45,"line":52},[43,250,195],{"class":117},[43,252,253],{"class":120}," doctor\n",[29,255,257],{"id":256},"_34-run-hexcore-as-a-service-systemd","3.4 Run Hexcore as a service (systemd)",[34,259,261],{"className":108,"code":260,"language":110,"meta":39,"style":39},"HOST=127.0.0.1 hexcore service install\n",[18,262,263],{"__ignoreMap":39},[43,264,265,269,273,276,278,281],{"class":45,"line":46},[43,266,268],{"class":267},"sVt8B","HOST",[43,270,272],{"class":271},"szBVR","=",[43,274,275],{"class":120},"127.0.0.1",[43,277,124],{"class":117},[43,279,280],{"class":120}," service",[43,282,283],{"class":120}," install\n",[69,285,286,296,351],{},[72,287,288,291,292,295],{},[18,289,290],{},"HOST=127.0.0.1"," lets only the reverse proxy on the same machine reach port 4000 (the default is ",[18,293,294],{},"0.0.0.0",").",[72,297,298,299,304,305,308,309],{},"Run it ",[76,300,301,302],{},"without ",[18,303,96],{},": Hexcore prepares the unit file and ",[76,306,307],{},"prints"," the commands that need root, run exactly those, usually:",[34,310,312],{"className":108,"code":311,"language":110,"meta":39,"style":39},"sudo cp ~\u002F.hexcore\u002Fhexcore.service \u002Fetc\u002Fsystemd\u002Fsystem\u002Fhexcore.service\nsudo systemctl daemon-reload\nsudo systemctl enable --now hexcore\n",[18,313,314,327,337],{"__ignoreMap":39},[43,315,316,318,321,324],{"class":45,"line":46},[43,317,96],{"class":117},[43,319,320],{"class":120}," cp",[43,322,323],{"class":120}," ~\u002F.hexcore\u002Fhexcore.service",[43,325,326],{"class":120}," \u002Fetc\u002Fsystemd\u002Fsystem\u002Fhexcore.service\n",[43,328,329,331,334],{"class":45,"line":52},[43,330,96],{"class":117},[43,332,333],{"class":120}," systemctl",[43,335,336],{"class":120}," daemon-reload\n",[43,338,339,341,343,346,349],{"class":45,"line":58},[43,340,96],{"class":117},[43,342,333],{"class":120},[43,344,345],{"class":120}," enable",[43,347,348],{"class":138}," --now",[43,350,158],{"class":120},[72,352,353,354,357],{},"The service uses the exact ",[18,355,356],{},"node"," binary present at install time: if you change the Node.js version, reinstall Hexcore and rerun the command above.",[14,359,231],{},[34,361,363],{"className":108,"code":362,"language":110,"meta":39,"style":39},"hexcore status                 # whether it is running, version, URL\nhexcore logs -f                # follow the log (journalctl under systemd)\ncurl -s http:\u002F\u002F127.0.0.1:4000\u002Fhealth\n",[18,364,365,375,388],{"__ignoreMap":39},[43,366,367,369,372],{"class":45,"line":46},[43,368,195],{"class":117},[43,370,371],{"class":120}," status",[43,373,374],{"class":127},"                 # whether it is running, version, URL\n",[43,376,377,379,382,385],{"class":45,"line":52},[43,378,195],{"class":117},[43,380,381],{"class":120}," logs",[43,383,384],{"class":138}," -f",[43,386,387],{"class":127},"                # follow the log (journalctl under systemd)\n",[43,389,390,393,396],{"class":45,"line":58},[43,391,392],{"class":117},"curl",[43,394,395],{"class":138}," -s",[43,397,398],{"class":120}," http:\u002F\u002F127.0.0.1:4000\u002Fhealth\n",[400,401,402,415],"table",{},[403,404,405],"thead",{},[406,407,408,412],"tr",{},[409,410,411],"th",{},"Task",[409,413,414],{},"Command",[416,417,418,430,440],"tbody",{},[406,419,420,424],{},[421,422,423],"td",{},"Stop Hexcore (heads keep running)",[421,425,426,429],{},[18,427,428],{},"hexcore stop"," (systemd does not restart it)",[406,431,432,435],{},[421,433,434],{},"Start again after stopping",[421,436,437],{},[18,438,439],{},"sudo systemctl start hexcore",[406,441,442,445],{},[421,443,444],{},"Remove the service (keeps config, keys, heads)",[421,446,447,450,451,453],{},[18,448,449],{},"hexcore service uninstall",", then run the ",[18,452,96],{}," commands it prints",[14,455,456,457,460],{},"No systemd: ",[18,458,459],{},"hexcore start --detach"," (does not restart after a reboot).",[29,462,464],{"id":463},"_35-domain-and-dns","3.5 Domain and DNS",[466,467,468,474,485],"ol",{},[72,469,470,471,174],{},"Pick a subdomain, for example ",[18,472,473],{},"hexcore.example.com",[72,475,476,477,480,481,484],{},"Create an ",[76,478,479],{},"A"," record pointing to the server's public IPv4 (add an ",[76,482,483],{},"AAAA"," record if it has IPv6 and the proxy listens on IPv6).",[72,486,487,488],{},"Wait until it resolves to the right IP:",[34,489,491],{"className":108,"code":490,"language":110,"meta":39,"style":39},"dig +short hexcore.example.com\n",[18,492,493],{"__ignoreMap":39},[43,494,495,498,501],{"class":45,"line":46},[43,496,497],{"class":117},"dig",[43,499,500],{"class":120}," +short",[43,502,503],{"class":120}," hexcore.example.com\n",[14,505,506,507,510,511,295],{},"Cloudflare: keep the record ",[76,508,509],{},"DNS only"," (grey cloud), as proxy mode (orange cloud) has not been measured against multi-machine head tunnels (",[23,512,516],{"href":513,"rel":514},"https:\u002F\u002Fgithub.com\u002FVtechcom\u002Fhexcore-v2\u002Fissues\u002F26",[515],"nofollow","#26",[29,518,520],{"id":519},"_36-firewall","3.6 Firewall",[14,522,523,524,527],{},"Open only SSH, 80 (Let's Encrypt validation, redirect to HTTPS) and 443, and ",[76,525,526],{},"do not"," open port 4000.",[14,529,530,533,534,537],{},[76,531,532],{},"Ubuntu, Debian (ufw)",": allow SSH ",[76,535,536],{},"before"," enabling ufw, or you lock yourself out of the server:",[34,539,541],{"className":108,"code":540,"language":110,"meta":39,"style":39},"sudo ufw allow OpenSSH\nsudo ufw allow 80,443\u002Ftcp\nsudo ufw enable\nsudo ufw status\n",[18,542,543,556,567,576],{"__ignoreMap":39},[43,544,545,547,550,553],{"class":45,"line":46},[43,546,96],{"class":117},[43,548,549],{"class":120}," ufw",[43,551,552],{"class":120}," allow",[43,554,555],{"class":120}," OpenSSH\n",[43,557,558,560,562,564],{"class":45,"line":52},[43,559,96],{"class":117},[43,561,549],{"class":120},[43,563,552],{"class":120},[43,565,566],{"class":120}," 80,443\u002Ftcp\n",[43,568,569,571,573],{"class":45,"line":58},[43,570,96],{"class":117},[43,572,549],{"class":120},[43,574,575],{"class":120}," enable\n",[43,577,578,580,582],{"class":45,"line":64},[43,579,96],{"class":117},[43,581,549],{"class":120},[43,583,584],{"class":120}," status\n",[14,586,587,590],{},[76,588,589],{},"RHEL family (firewalld)",":",[34,592,594],{"className":108,"code":593,"language":110,"meta":39,"style":39},"sudo firewall-cmd --permanent --add-service=http --add-service=https\nsudo firewall-cmd --reload\n",[18,595,596,612],{"__ignoreMap":39},[43,597,598,600,603,606,609],{"class":45,"line":46},[43,599,96],{"class":117},[43,601,602],{"class":120}," firewall-cmd",[43,604,605],{"class":138}," --permanent",[43,607,608],{"class":138}," --add-service=http",[43,610,611],{"class":138}," --add-service=https\n",[43,613,614,616,618],{"class":45,"line":52},[43,615,96],{"class":117},[43,617,602],{"class":120},[43,619,620],{"class":138}," --reload\n",[14,622,623],{},"Two things to know about Docker and firewalls:",[69,625,626,638],{},[72,627,628,631,632,634,635,637],{},[76,629,630],{},"Ports published by Docker bypass ufw and firewalld."," The node API is published only on ",[18,633,275],{},", so it is safe, but P2P ports (single-machine heads, multi-machine heads in direct mode) are published on ",[18,636,294],{},", reachable from the Internet even when ufw blocks them. To block them for certain, use your cloud provider's security group.",[72,639,640,643,644,647,648,685,688],{},[76,641,642],{},"ufw blocks traffic from containers to the host by default",", and relay heads need that path: the ",[76,645,646],{},"Start"," button stops and prints the exact command to run, for example:",[34,649,651],{"className":108,"code":650,"language":110,"meta":39,"style":39},"sudo ufw allow from 10.0.30.0\u002F24 to 10.0.0.1 port 47000:56999 proto tcp\n",[18,652,653],{"__ignoreMap":39},[43,654,655,657,659,661,664,667,670,673,676,679,682],{"class":45,"line":46},[43,656,96],{"class":117},[43,658,549],{"class":120},[43,660,552],{"class":120},[43,662,663],{"class":120}," from",[43,665,666],{"class":120}," 10.0.30.0\u002F24",[43,668,669],{"class":120}," to",[43,671,672],{"class":138}," 10.0.0.1",[43,674,675],{"class":120}," port",[43,677,678],{"class":120}," 47000:56999",[43,680,681],{"class":120}," proto",[43,683,684],{"class":120}," tcp\n",[686,687],"br",{},"Run it, then click Start again.",[29,690,692],{"id":691},"_37-reverse-proxy-option-1-caddy-recommended","3.7 Reverse proxy, option 1: Caddy (recommended)",[14,694,695,696,701],{},"Caddy requests and renews Let's Encrypt certificates itself and proxies WebSocket with no extra configuration. Install (per ",[23,697,700],{"href":698,"rel":699},"https:\u002F\u002Fcaddyserver.com\u002Fdocs\u002Finstall",[515],"caddyserver.com\u002Fdocs\u002Finstall","):",[34,703,705],{"className":108,"code":704,"language":110,"meta":39,"style":39},"# Ubuntu, Debian\nsudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl\ncurl -1sLf 'https:\u002F\u002Fdl.cloudsmith.io\u002Fpublic\u002Fcaddy\u002Fstable\u002Fgpg.key' | sudo gpg --dearmor -o \u002Fusr\u002Fshare\u002Fkeyrings\u002Fcaddy-stable-archive-keyring.gpg\ncurl -1sLf 'https:\u002F\u002Fdl.cloudsmith.io\u002Fpublic\u002Fcaddy\u002Fstable\u002Fdebian.deb.txt' | sudo tee \u002Fetc\u002Fapt\u002Fsources.list.d\u002Fcaddy-stable.list\nsudo apt update && sudo apt install -y caddy\n\n# Rocky, AlmaLinux, CentOS Stream, RHEL\nsudo dnf install -y 'dnf-command(copr)'\nsudo dnf copr enable -y @caddy\u002Fcaddy\nsudo dnf install -y caddy\nsudo systemctl enable --now caddy\n",[18,706,707,712,737,765,784,808,815,821,836,853,866],{"__ignoreMap":39},[43,708,709],{"class":45,"line":46},[43,710,711],{"class":127},"# Ubuntu, Debian\n",[43,713,714,716,719,722,725,728,731,734],{"class":45,"line":52},[43,715,96],{"class":117},[43,717,718],{"class":120}," apt",[43,720,721],{"class":120}," install",[43,723,724],{"class":138}," -y",[43,726,727],{"class":120}," debian-keyring",[43,729,730],{"class":120}," debian-archive-keyring",[43,732,733],{"class":120}," apt-transport-https",[43,735,736],{"class":120}," curl\n",[43,738,739,741,744,747,750,753,756,759,762],{"class":45,"line":58},[43,740,392],{"class":117},[43,742,743],{"class":138}," -1sLf",[43,745,746],{"class":120}," 'https:\u002F\u002Fdl.cloudsmith.io\u002Fpublic\u002Fcaddy\u002Fstable\u002Fgpg.key'",[43,748,749],{"class":271}," |",[43,751,752],{"class":117}," sudo",[43,754,755],{"class":120}," gpg",[43,757,758],{"class":138}," --dearmor",[43,760,761],{"class":138}," -o",[43,763,764],{"class":120}," \u002Fusr\u002Fshare\u002Fkeyrings\u002Fcaddy-stable-archive-keyring.gpg\n",[43,766,767,769,771,774,776,778,781],{"class":45,"line":64},[43,768,392],{"class":117},[43,770,743],{"class":138},[43,772,773],{"class":120}," 'https:\u002F\u002Fdl.cloudsmith.io\u002Fpublic\u002Fcaddy\u002Fstable\u002Fdebian.deb.txt'",[43,775,749],{"class":271},[43,777,752],{"class":117},[43,779,780],{"class":120}," tee",[43,782,783],{"class":120}," \u002Fetc\u002Fapt\u002Fsources.list.d\u002Fcaddy-stable.list\n",[43,785,787,789,791,794,797,799,801,803,805],{"class":45,"line":786},5,[43,788,96],{"class":117},[43,790,718],{"class":120},[43,792,793],{"class":120}," update",[43,795,796],{"class":267}," && ",[43,798,96],{"class":117},[43,800,718],{"class":120},[43,802,721],{"class":120},[43,804,724],{"class":138},[43,806,807],{"class":120}," caddy\n",[43,809,811],{"class":45,"line":810},6,[43,812,814],{"emptyLinePlaceholder":813},true,"\n",[43,816,818],{"class":45,"line":817},7,[43,819,820],{"class":127},"# Rocky, AlmaLinux, CentOS Stream, RHEL\n",[43,822,824,826,829,831,833],{"class":45,"line":823},8,[43,825,96],{"class":117},[43,827,828],{"class":120}," dnf",[43,830,721],{"class":120},[43,832,724],{"class":138},[43,834,835],{"class":120}," 'dnf-command(copr)'\n",[43,837,839,841,843,846,848,850],{"class":45,"line":838},9,[43,840,96],{"class":117},[43,842,828],{"class":120},[43,844,845],{"class":120}," copr",[43,847,345],{"class":120},[43,849,724],{"class":138},[43,851,852],{"class":120}," @caddy\u002Fcaddy\n",[43,854,856,858,860,862,864],{"class":45,"line":855},10,[43,857,96],{"class":117},[43,859,828],{"class":120},[43,861,721],{"class":120},[43,863,724],{"class":138},[43,865,807],{"class":120},[43,867,869,871,873,875,877],{"class":45,"line":868},11,[43,870,96],{"class":117},[43,872,333],{"class":120},[43,874,345],{"class":120},[43,876,348],{"class":138},[43,878,807],{"class":120},[14,880,881,882,885],{},"Write ",[18,883,884],{},"\u002Fetc\u002Fcaddy\u002FCaddyfile"," (replace the domain):",[34,887,892],{"className":888,"code":890,"language":891},[889],"language-text","hexcore.example.com {\n    reverse_proxy 127.0.0.1:4000\n}\n","text",[18,893,890],{"__ignoreMap":39},[14,895,896],{},"Apply:",[34,898,900],{"className":108,"code":899,"language":110,"meta":39,"style":39},"sudo caddy validate --config \u002Fetc\u002Fcaddy\u002FCaddyfile\nsudo systemctl reload caddy\njournalctl -u caddy -f      # watch the certificate request\n",[18,901,902,918,929],{"__ignoreMap":39},[43,903,904,906,909,912,915],{"class":45,"line":46},[43,905,96],{"class":117},[43,907,908],{"class":120}," caddy",[43,910,911],{"class":120}," validate",[43,913,914],{"class":138}," --config",[43,916,917],{"class":120}," \u002Fetc\u002Fcaddy\u002FCaddyfile\n",[43,919,920,922,924,927],{"class":45,"line":52},[43,921,96],{"class":117},[43,923,333],{"class":120},[43,925,926],{"class":120}," reload",[43,928,807],{"class":120},[43,930,931,934,937,939,941],{"class":45,"line":58},[43,932,933],{"class":117},"journalctl",[43,935,936],{"class":138}," -u",[43,938,908],{"class":120},[43,940,384],{"class":138},[43,942,943],{"class":127},"      # watch the certificate request\n",[14,945,946],{},"Caddy can only get a certificate once DNS is correct and ports 80 and 443 are open.",[29,948,950],{"id":949},"_38-reverse-proxy-option-2-nginx-certbot","3.8 Reverse proxy, option 2: nginx + certbot",[14,952,953],{},"Install:",[34,955,957],{"className":108,"code":956,"language":110,"meta":39,"style":39},"# Ubuntu, Debian\nsudo apt install -y nginx certbot python3-certbot-nginx\n\n# Rocky, AlmaLinux, CentOS Stream, RHEL (certbot comes from EPEL)\nsudo dnf install -y epel-release\nsudo dnf install -y nginx certbot python3-certbot-nginx\nsudo systemctl enable --now nginx\n",[18,958,959,963,982,986,991,1004,1020],{"__ignoreMap":39},[43,960,961],{"class":45,"line":46},[43,962,711],{"class":127},[43,964,965,967,969,971,973,976,979],{"class":45,"line":52},[43,966,96],{"class":117},[43,968,718],{"class":120},[43,970,721],{"class":120},[43,972,724],{"class":138},[43,974,975],{"class":120}," nginx",[43,977,978],{"class":120}," certbot",[43,980,981],{"class":120}," python3-certbot-nginx\n",[43,983,984],{"class":45,"line":58},[43,985,814],{"emptyLinePlaceholder":813},[43,987,988],{"class":45,"line":64},[43,989,990],{"class":127},"# Rocky, AlmaLinux, CentOS Stream, RHEL (certbot comes from EPEL)\n",[43,992,993,995,997,999,1001],{"class":45,"line":786},[43,994,96],{"class":117},[43,996,828],{"class":120},[43,998,721],{"class":120},[43,1000,724],{"class":138},[43,1002,1003],{"class":120}," epel-release\n",[43,1005,1006,1008,1010,1012,1014,1016,1018],{"class":45,"line":810},[43,1007,96],{"class":117},[43,1009,828],{"class":120},[43,1011,721],{"class":120},[43,1013,724],{"class":138},[43,1015,975],{"class":120},[43,1017,978],{"class":120},[43,1019,981],{"class":120},[43,1021,1022,1024,1026,1028,1030],{"class":45,"line":817},[43,1023,96],{"class":117},[43,1025,333],{"class":120},[43,1027,345],{"class":120},[43,1029,348],{"class":138},[43,1031,1032],{"class":120}," nginx\n",[14,1034,881,1035,885],{},[18,1036,1037],{},"\u002Fetc\u002Fnginx\u002Fconf.d\u002Fhexcore.conf",[34,1039,1043],{"className":1040,"code":1041,"language":1042,"meta":39,"style":39},"language-nginx shiki shiki-themes github-light github-dark","map $http_upgrade $connection_upgrade {\n    default upgrade;\n    ''      close;\n}\n\nserver {\n    listen 80;\n    server_name hexcore.example.com;\n\n    location \u002F {\n        proxy_pass http:\u002F\u002F127.0.0.1:4000;\n        proxy_http_version 1.1;\n        proxy_set_header Upgrade $http_upgrade;\n        proxy_set_header Connection $connection_upgrade;\n        proxy_set_header Host $host;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n        # Console and tunnels can stay open for hours; the 60-second default would cut them\n        proxy_read_timeout 1h;\n        proxy_send_timeout 1h;\n    }\n}\n","nginx",[18,1044,1045,1060,1068,1076,1081,1085,1093,1104,1112,1116,1127,1135,1146,1155,1163,1171,1179,1187,1193,1204,1214,1220],{"__ignoreMap":39},[43,1046,1047,1050,1053,1057],{"class":45,"line":46},[43,1048,1049],{"class":271},"map",[43,1051,1052],{"class":267}," $",[43,1054,1056],{"class":1055},"s4XuR","http_upgrade",[43,1058,1059],{"class":267}," $connection_upgrade {\n",[43,1061,1062,1065],{"class":45,"line":52},[43,1063,1064],{"class":138},"    default",[43,1066,1067],{"class":267}," upgrade;\n",[43,1069,1070,1073],{"class":45,"line":58},[43,1071,1072],{"class":120},"    ''",[43,1074,1075],{"class":267},"      close;\n",[43,1077,1078],{"class":45,"line":64},[43,1079,1080],{"class":267},"}\n",[43,1082,1083],{"class":45,"line":786},[43,1084,814],{"emptyLinePlaceholder":813},[43,1086,1087,1090],{"class":45,"line":810},[43,1088,1089],{"class":271},"server",[43,1091,1092],{"class":267}," {\n",[43,1094,1095,1098,1101],{"class":45,"line":817},[43,1096,1097],{"class":271},"    listen ",[43,1099,1100],{"class":138},"80",[43,1102,1103],{"class":267},";\n",[43,1105,1106,1109],{"class":45,"line":823},[43,1107,1108],{"class":271},"    server_name ",[43,1110,1111],{"class":267},"hexcore.example.com;\n",[43,1113,1114],{"class":45,"line":838},[43,1115,814],{"emptyLinePlaceholder":813},[43,1117,1118,1121,1124],{"class":45,"line":855},[43,1119,1120],{"class":271},"    location",[43,1122,1123],{"class":117}," \u002F ",[43,1125,1126],{"class":267},"{\n",[43,1128,1129,1132],{"class":45,"line":868},[43,1130,1131],{"class":271},"        proxy_pass ",[43,1133,1134],{"class":267},"http:\u002F\u002F127.0.0.1:4000;\n",[43,1136,1138,1141,1144],{"class":45,"line":1137},12,[43,1139,1140],{"class":271},"        proxy_http_version ",[43,1142,1143],{"class":138},"1.1",[43,1145,1103],{"class":267},[43,1147,1149,1152],{"class":45,"line":1148},13,[43,1150,1151],{"class":271},"        proxy_set_header ",[43,1153,1154],{"class":267},"Upgrade $http_upgrade;\n",[43,1156,1158,1160],{"class":45,"line":1157},14,[43,1159,1151],{"class":271},[43,1161,1162],{"class":267},"Connection $connection_upgrade;\n",[43,1164,1166,1168],{"class":45,"line":1165},15,[43,1167,1151],{"class":271},[43,1169,1170],{"class":267},"Host $host;\n",[43,1172,1174,1176],{"class":45,"line":1173},16,[43,1175,1151],{"class":271},[43,1177,1178],{"class":267},"X-Forwarded-For $proxy_add_x_forwarded_for;\n",[43,1180,1182,1184],{"class":45,"line":1181},17,[43,1183,1151],{"class":271},[43,1185,1186],{"class":267},"X-Forwarded-Proto $scheme;\n",[43,1188,1190],{"class":45,"line":1189},18,[43,1191,1192],{"class":127},"        # Console and tunnels can stay open for hours; the 60-second default would cut them\n",[43,1194,1196,1199,1202],{"class":45,"line":1195},19,[43,1197,1198],{"class":271},"        proxy_read_timeout ",[43,1200,1201],{"class":138},"1h",[43,1203,1103],{"class":267},[43,1205,1207,1210,1212],{"class":45,"line":1206},20,[43,1208,1209],{"class":271},"        proxy_send_timeout ",[43,1211,1201],{"class":138},[43,1213,1103],{"class":267},[43,1215,1217],{"class":45,"line":1216},21,[43,1218,1219],{"class":267},"    }\n",[43,1221,1223],{"class":45,"line":1222},22,[43,1224,1080],{"class":267},[14,1226,1227,1228,1231,1232,1234,1235,1238],{},"If nginx reports ",[18,1229,1230],{},"duplicate \"map\" variable \"$connection_upgrade\"",", delete the ",[18,1233,1049],{}," block above. Then request the certificate (certbot adds ",[18,1236,1237],{},"listen 443 ssl"," and the HTTPS redirect itself):",[34,1240,1242],{"className":108,"code":1241,"language":110,"meta":39,"style":39},"sudo nginx -t && sudo systemctl reload nginx\nsudo certbot --nginx -d hexcore.example.com\n",[18,1243,1244,1263],{"__ignoreMap":39},[43,1245,1246,1248,1250,1253,1255,1257,1259,1261],{"class":45,"line":46},[43,1247,96],{"class":117},[43,1249,975],{"class":120},[43,1251,1252],{"class":138}," -t",[43,1254,796],{"class":267},[43,1256,96],{"class":117},[43,1258,333],{"class":120},[43,1260,926],{"class":120},[43,1262,1032],{"class":120},[43,1264,1265,1267,1269,1272,1275],{"class":45,"line":52},[43,1266,96],{"class":117},[43,1268,978],{"class":120},[43,1270,1271],{"class":138}," --nginx",[43,1273,1274],{"class":138}," -d",[43,1276,503],{"class":120},[14,1278,1279,1282,1283,1286,1287,1290,1291,1294],{},[76,1280,1281],{},"SELinux on the RHEL family"," blocks nginx from connecting to ",[18,1284,1285],{},"127.0.0.1:4000",": ",[18,1288,1289],{},"502 Bad Gateway",", and the log has ",[18,1292,1293],{},"connect() to 127.0.0.1:4000 failed (13: Permission denied)",". Allow it with:",[34,1296,1298],{"className":108,"code":1297,"language":110,"meta":39,"style":39},"sudo setsebool -P httpd_can_network_connect 1\n",[18,1299,1300],{"__ignoreMap":39},[43,1301,1302,1304,1307,1310,1313],{"class":45,"line":46},[43,1303,96],{"class":117},[43,1305,1306],{"class":120}," setsebool",[43,1308,1309],{"class":138}," -P",[43,1311,1312],{"class":120}," httpd_can_network_connect",[43,1314,1315],{"class":138}," 1\n",[14,1317,1318,1321,1322,1325],{},[76,1319,1320],{},"Keep tokens out of the access log."," A token in the query string (",[18,1323,1324],{},"?X-Api-Key=hxn_…",") is written to nginx's access log. To avoid that, log the head routes without the query (the browser console is not affected, since it uses a single-use 30-second ticket):",[34,1327,1329],{"className":1040,"code":1328,"language":1042,"meta":39,"style":39},"# in the http block (for example at the top of hexcore.conf)\nlog_format hexcore '$remote_addr [$time_local] \"$request_method $uri\" $status';\n\n# in the server block, add a separate location with the same proxy_* lines as location \u002F\nlocation \u002Fapi\u002Fheads\u002F {\n    access_log \u002Fvar\u002Flog\u002Fnginx\u002Faccess.log hexcore;\n    proxy_pass http:\u002F\u002F127.0.0.1:4000;\n    # … the same proxy_* lines as location \u002F above\n}\n",[18,1330,1331,1336,1378,1382,1387,1397,1405,1412,1417],{"__ignoreMap":39},[43,1332,1333],{"class":45,"line":46},[43,1334,1335],{"class":127},"# in the http block (for example at the top of hexcore.conf)\n",[43,1337,1338,1341,1344,1347,1350,1353,1356,1359,1362,1364,1367,1370,1373,1376],{"class":45,"line":52},[43,1339,1340],{"class":271},"log_format ",[43,1342,1343],{"class":267},"hexcore ",[43,1345,1346],{"class":120},"'$",[43,1348,1349],{"class":267},"remote_addr",[43,1351,1352],{"class":120}," [$",[43,1354,1355],{"class":267},"time_local",[43,1357,1358],{"class":120},"] \"$",[43,1360,1361],{"class":267},"request_method",[43,1363,1052],{"class":120},[43,1365,1366],{"class":267},"uri",[43,1368,1369],{"class":120},"\" $",[43,1371,1372],{"class":267},"status",[43,1374,1375],{"class":120},"'",[43,1377,1103],{"class":267},[43,1379,1380],{"class":45,"line":58},[43,1381,814],{"emptyLinePlaceholder":813},[43,1383,1384],{"class":45,"line":64},[43,1385,1386],{"class":127},"# in the server block, add a separate location with the same proxy_* lines as location \u002F\n",[43,1388,1389,1392,1395],{"class":45,"line":786},[43,1390,1391],{"class":271},"location",[43,1393,1394],{"class":117}," \u002Fapi\u002Fheads\u002F ",[43,1396,1126],{"class":267},[43,1398,1399,1402],{"class":45,"line":810},[43,1400,1401],{"class":271},"    access_log ",[43,1403,1404],{"class":267},"\u002Fvar\u002Flog\u002Fnginx\u002Faccess.log hexcore;\n",[43,1406,1407,1410],{"class":45,"line":817},[43,1408,1409],{"class":271},"    proxy_pass ",[43,1411,1134],{"class":267},[43,1413,1414],{"class":45,"line":823},[43,1415,1416],{"class":127},"    # … the same proxy_* lines as location \u002F above\n",[43,1418,1419],{"class":45,"line":838},[43,1420,1080],{"class":267},[29,1422,1424],{"id":1423},"_39-set-the-public-url-and-verify","3.9 Set the Public URL and verify",[14,1426,1427,1428,1431,1432,1435,1436,1435,1439,1442],{},"Sign in at ",[18,1429,1430],{},"https:\u002F\u002Fhexcore.example.com",", go to ",[76,1433,1434],{},"Settings"," → ",[76,1437,1438],{},"Public URL",[76,1440,1441],{},"Use page's address"," → save (origin only, no path). Other Hexcores reach this machine at that address; without it, relay heads and invitations do not work and Trust Center cannot verify your domain.",[14,1444,231],{},[34,1446,1448],{"className":108,"code":1447,"language":110,"meta":39,"style":39},"curl -s https:\u002F\u002Fhexcore.example.com\u002Fhealth\n",[18,1449,1450],{"__ignoreMap":39},[43,1451,1452,1454,1456],{"class":45,"line":46},[43,1453,392],{"class":117},[43,1455,395],{"class":138},[43,1457,1458],{"class":120}," https:\u002F\u002Fhexcore.example.com\u002Fhealth\n",[69,1460,1461,1464,1471],{},[72,1462,1463],{},"It returns JSON with the Hexcore and Docker status: the proxy works.",[72,1465,1466,1467,1470],{},"The ",[76,1468,1469],{},"Console"," of a running node connects through the domain: WebSocket passes through.",[72,1472,1473,1474,1478,1479,1482],{},"After connecting Trust Center (",[23,1475,1477],{"href":1476},"04-provider-trust-center","part 4","), ",[18,1480,1481],{},"https:\u002F\u002Fhexcore.example.com\u002F.well-known\u002Fhexcore\u002Ftrust-center.json"," returns the connector's public key (before that, a 404 is normal).",[29,1484,1486],{"id":1485},"_310-maintenance","3.10 Maintenance",[69,1488,1489,1498,1567],{},[72,1490,1491,1286,1494,1497],{},[76,1492,1493],{},"Update",[18,1495,1496],{},"hexcore update",". The new version starts alongside the old one, the old one drains open connections (up to 2 minutes), and it rolls back automatically if the new version is unstable in the first minute. The CLI may stay silent during the 60-second watch: it is not hung.",[72,1499,1500,1505,1506,1564,1566],{},[76,1501,1502,1503],{},"Back up ",[18,1504,104],{},": it holds every node's keys (including the Cardano keys of funded addresses), the Trust Center connector key and the database. Stop Hexcore before copying so the SQLite copy is consistent (heads keep running):",[34,1507,1509],{"className":108,"code":1508,"language":110,"meta":39,"style":39},"hexcore stop\ntar czf hexcore-backup-$(date +%F).tgz -C ~ .hexcore\nsudo systemctl start hexcore\n",[18,1510,1511,1518,1553],{"__ignoreMap":39},[43,1512,1513,1515],{"class":45,"line":46},[43,1514,195],{"class":117},[43,1516,1517],{"class":120}," stop\n",[43,1519,1520,1523,1526,1529,1532,1535,1538,1541,1544,1547,1550],{"class":45,"line":52},[43,1521,1522],{"class":117},"tar",[43,1524,1525],{"class":120}," czf",[43,1527,1528],{"class":120}," hexcore-backup-",[43,1530,1531],{"class":267},"$(",[43,1533,1534],{"class":117},"date",[43,1536,1537],{"class":120}," +%F",[43,1539,1540],{"class":267},")",[43,1542,1543],{"class":120},".tgz",[43,1545,1546],{"class":138}," -C",[43,1548,1549],{"class":120}," ~",[43,1551,1552],{"class":120}," .hexcore\n",[43,1554,1555,1557,1559,1562],{"class":45,"line":58},[43,1556,96],{"class":117},[43,1558,333],{"class":120},[43,1560,1561],{"class":120}," start",[43,1563,158],{"class":120},[686,1565],{},"Store the copy off the server and restrict who can read it: whoever has this file has the node keys.",[72,1568,1569,1286,1572,1575,1576,1578,1579,1582,1583,295],{},[76,1570,1571],{},"Check regularly",[18,1573,1574],{},"hexcore doctor",", especially after changing Docker or the firewall; doctor and ",[76,1577,1434],{}," warn if a node API is published publicly (",[18,1580,1581],{},"NODE_PORT_BIND"," other than ",[18,1584,275],{},[1586,1587,1588],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":39,"searchDepth":52,"depth":52,"links":1590},[1591,1592,1593,1594,1595,1596,1597,1598,1599,1600],{"id":31,"depth":52,"text":32},{"id":89,"depth":52,"text":90},{"id":177,"depth":52,"text":178},{"id":256,"depth":52,"text":257},{"id":463,"depth":52,"text":464},{"id":519,"depth":52,"text":520},{"id":691,"depth":52,"text":692},{"id":949,"depth":52,"text":950},{"id":1423,"depth":52,"text":1424},{"id":1485,"depth":52,"text":1486},"Goal: Hexcore runs as a service, restarts itself when the server reboots, and is reached at https:\u002F\u002F\u003Cdomain> with valid TLS (needed for multi-machine heads and Trust Center). Finish 1. Prepare your machine on the server first.","md",{},"\u002Fdocs\u002F03-cai-tren-server",{"title":5,"description":1601},"docs\u002F03-cai-tren-server","hFtvA_oGVlkr9lOiEe7gTvz-IL0gKqKnv_8apOz9QWM",[1609,1612,1615,1616,1619,1622],{"path":1610,"title":1611},"\u002Fdocs\u002F01-chuan-bi-may","1. Prepare your machine and install the Hexcore CLI",{"path":1613,"title":1614},"\u002Fdocs\u002F02-developer-dapp","2. Guide for DApp developers",{"path":1604,"title":5},{"path":1617,"title":1618},"\u002Fdocs\u002F04-provider-trust-center","4. Guide for providers joining Hydra Trust Center",{"path":1620,"title":1621},"\u002Fdocs\u002F05-xu-ly-su-co","5. Troubleshooting",{"path":1623,"title":1624},"\u002Fdocs\u002Freadme","Hexcore v2 user guide",1795426328408]