[{"data":1,"prerenderedAt":608},["ShallowReactive",2],{"docs:/docs/self-hosting":3},{"id":4,"title":5,"body":6,"description":601,"extension":602,"meta":603,"navigation":210,"path":604,"seo":605,"stem":606,"__hash__":607},"docs/docs/self-hosting.md","Self-Hosting",{"type":7,"value":8,"toc":592},"minimark",[9,13,17,63,71,76,79,121,124,170,177,180,273,290,295,298,330,341,413,417,424,433,476,483,491,495,507,511,578,582,585,588],[10,11,5],"h1",{"id":12},"self-hosting",[14,15,16],"p",{},"NoLag is open source. The broker and the authorization layer behind it are both\nApache 2.0 and both on GitHub, so you can run as much or as little of it as you\nwant.",[18,19,20,33],"table",{},[21,22,23],"thead",{},[24,25,26,30],"tr",{},[27,28,29],"th",{},"Repository",[27,31,32],{},"What it is",[34,35,36,51],"tbody",{},[24,37,38,48],{},[39,40,41],"td",{},[42,43,47],"a",{"href":44,"rel":45},"https://github.com/NoLagApp/kraken",[46],"nofollow","NoLagApp/kraken",[39,49,50],{},"The broker. WebSocket and MQTT ingress, topics, rooms, presence, QoS, replay.",[24,52,53,60],{},[39,54,55],{},[42,56,59],{"href":57,"rel":58},"https://github.com/NoLagApp/nolag-core",[46],"NoLagApp/nolag-core",[39,61,62],{},"The authorization and configuration layer. Projects, apps, rooms, actors, tokens, signing keys.",[14,64,65,66,70],{},"There are three ways to run it, and the difference is only ",[67,68,69],"em",{},"who holds what",".",[72,73,75],"h2",{"id":74},"option-1-the-whole-stack-on-your-machine","Option 1: the whole stack, on your machine",[14,77,78],{},"Everything local. Nothing contacts NoLag, and you do not need an account.",[80,81,86],"pre",{"className":82,"code":83,"language":84,"meta":85,"style":85},"language-bash shiki shiki-themes github-light github-dark","git clone https://github.com/NoLagApp/nolag-core\ncd nolag-core\n./quickstart/quickstart.sh\n","bash","",[87,88,89,105,115],"code",{"__ignoreMap":85},[90,91,94,98,102],"span",{"class":92,"line":93},"line",1,[90,95,97],{"class":96},"sScJk","git",[90,99,101],{"class":100},"sZZnC"," clone",[90,103,104],{"class":100}," https://github.com/NoLagApp/nolag-core\n",[90,106,108,112],{"class":92,"line":107},2,[90,109,111],{"class":110},"sj4cs","cd",[90,113,114],{"class":100}," nolag-core\n",[90,116,118],{"class":92,"line":117},3,[90,119,120],{"class":96},"./quickstart/quickstart.sh\n",[14,122,123],{},"That brings up Postgres, core, kraken and an admin UI, and seeds a demo project.\nThe first run compiles kraken from source and takes a few minutes; after that it\nis seconds.",[18,125,126,134],{},[21,127,128],{},[24,129,130,132],{},[27,131],{},[27,133],{},[34,135,136,146,160],{},[24,137,138,141],{},[39,139,140],{},"Admin UI",[39,142,143],{},[87,144,145],{},"http://localhost:3401",[24,147,148,151],{},[39,149,150],{},"Core API",[39,152,153,156,157],{},[87,154,155],{},"http://localhost:3400",", OpenAPI at ",[87,158,159],{},"/swagger",[24,161,162,165],{},[39,163,164],{},"Broker",[39,166,167],{},[87,168,169],{},"ws://localhost:8410/ws",[14,171,172,173,176],{},"Access tokens for the demo project are written to ",[87,174,175],{},"quickstart/credentials.json",".\nThey are shown once, because core stores only their hashes.",[14,178,179],{},"Connecting is then identical to connecting to hosted NoLag, with a different\nURL:",[80,181,185],{"className":182,"code":183,"language":184,"meta":85,"style":85},"language-js shiki shiki-themes github-light github-dark","import { NoLag } from \"@nolag/js-sdk\";\n\nconst client = NoLag(TOKEN, { url: \"ws://localhost:8410/ws\" });\nawait client.connect();\nclient.subscribe(\"my-app/general/messages\");\n","js",[87,186,187,206,212,241,256],{"__ignoreMap":85},[90,188,189,193,197,200,203],{"class":92,"line":93},[90,190,192],{"class":191},"szBVR","import",[90,194,196],{"class":195},"sVt8B"," { NoLag } ",[90,198,199],{"class":191},"from",[90,201,202],{"class":100}," \"@nolag/js-sdk\"",[90,204,205],{"class":195},";\n",[90,207,208],{"class":92,"line":107},[90,209,211],{"emptyLinePlaceholder":210},true,"\n",[90,213,214,217,220,223,226,229,232,235,238],{"class":92,"line":117},[90,215,216],{"class":191},"const",[90,218,219],{"class":110}," client",[90,221,222],{"class":191}," =",[90,224,225],{"class":96}," NoLag",[90,227,228],{"class":195},"(",[90,230,231],{"class":110},"TOKEN",[90,233,234],{"class":195},", { url: ",[90,236,237],{"class":100},"\"ws://localhost:8410/ws\"",[90,239,240],{"class":195}," });\n",[90,242,244,247,250,253],{"class":92,"line":243},4,[90,245,246],{"class":191},"await",[90,248,249],{"class":195}," client.",[90,251,252],{"class":96},"connect",[90,254,255],{"class":195},"();\n",[90,257,259,262,265,267,270],{"class":92,"line":258},5,[90,260,261],{"class":195},"client.",[90,263,264],{"class":96},"subscribe",[90,266,228],{"class":195},[90,268,269],{"class":100},"\"my-app/general/messages\"",[90,271,272],{"class":195},");\n",[274,275,277],"callout",{"type":276},"warning",[14,278,279,280,283,284,289],{},"The quickstart is a demonstration, not a production deployment. The example host\nauthenticates nobody, which is why every port binds to ",[87,281,282],{},"127.0.0.1",". Read\n",[42,285,288],{"href":286,"rel":287},"https://github.com/NoLagApp/nolag-core#what-the-quickstart-is-not",[46],"what the quickstart is not","\nbefore pointing anything real at it.",[291,292,294],"h3",{"id":293},"just-the-broker","Just the broker",[14,296,297],{},"If you only want the broker and intend to supply your own auth, kraken runs on\nits own with no database and no external message broker:",[80,299,301],{"className":82,"code":300,"language":84,"meta":85,"style":85},"git clone https://github.com/NoLagApp/kraken\ncd kraken\ndocker compose up\n",[87,302,303,312,319],{"__ignoreMap":85},[90,304,305,307,309],{"class":92,"line":93},[90,306,97],{"class":96},[90,308,101],{"class":100},[90,310,311],{"class":100}," https://github.com/NoLagApp/kraken\n",[90,313,314,316],{"class":92,"line":107},[90,315,111],{"class":110},[90,317,318],{"class":100}," kraken\n",[90,320,321,324,327],{"class":92,"line":117},[90,322,323],{"class":96},"docker",[90,325,326],{"class":100}," compose",[90,328,329],{"class":100}," up\n",[14,331,332,333,336,337,340],{},"That gives you a complete realtime backend on ",[87,334,335],{},"ws://localhost:8080/ws",", with\ntokens read from ",[87,338,339],{},"examples/auth.json",". Four things are pluggable, and each has a\nzero-dependency default:",[18,342,343,356],{},[21,344,345],{},[24,346,347,350,353],{},[27,348,349],{},"Slot",[27,351,352],{},"Default",[27,354,355],{},"Swap in",[34,357,358,372,386,400],{},[24,359,360,363,369],{},[39,361,362],{},"Auth",[39,364,365,368],{},[87,366,367],{},"static"," (token file)",[39,370,371],{},"your control plane or IdP",[24,373,374,377,383],{},[39,375,376],{},"Broker fan-out",[39,378,379,382],{},[87,380,381],{},"syn"," (built in)",[39,384,385],{},"EMQX, Mosquitto, VerneMQ",[24,387,388,391,397],{},[39,389,390],{},"Store",[39,392,393,396],{},[87,394,395],{},"ets"," (in memory)",[39,398,399],{},"your database",[24,401,402,405,410],{},[39,403,404],{},"Control",[39,406,407],{},[87,408,409],{},"noop",[39,411,412],{},"your billing or quota system",[72,414,416],{"id":415},"option-2-your-broker-our-control-plane","Option 2: your broker, our control plane",[14,418,419,420,70],{},"Run kraken yourself, and let NoLag answer the authorization questions. Token\nvalidation, ACLs, rooms, presence and quota come from NoLag, while fan-out and\nmessage history stay on your infrastructure, so ",[421,422,423],"strong",{},"NoLag never sees a message\npayload",[14,425,426,427,432],{},"Mint a link key in the ",[42,428,431],{"href":429,"rel":430},"https://portal.nolag.app",[46],"portal",", then:",[80,434,436],{"className":82,"code":435,"language":84,"meta":85,"style":85},"NOLAG_LINK_KEY=nlg_link_xxxx.\u003Csecret> \\\n  docker compose -f docker-compose.cloud.yml up\n",[87,437,438,461],{"__ignoreMap":85},[90,439,440,443,446,449,452,455,458],{"class":92,"line":93},[90,441,442],{"class":195},"NOLAG_LINK_KEY",[90,444,445],{"class":191},"=",[90,447,448],{"class":100},"nlg_link_xxxx.",[90,450,451],{"class":191},"\u003C",[90,453,454],{"class":100},"secret",[90,456,457],{"class":191},">",[90,459,460],{"class":96}," \\\n",[90,462,463,466,468,471,474],{"class":92,"line":107},[90,464,465],{"class":100},"  docker",[90,467,326],{"class":100},[90,469,470],{"class":110}," -f",[90,472,473],{"class":100}," docker-compose.cloud.yml",[90,475,329],{"class":100},[14,477,478,479,482],{},"One environment variable is the whole difference. This is the middle ground\nbetween the ",[87,480,481],{},"auth.json"," quickstart and the fully hosted product, and it is the\nright answer if you cannot send data to a third party but would rather not build\nan auth control plane either.",[14,484,485,490],{},[42,486,489],{"href":487,"rel":488},"https://github.com/NoLagApp/kraken/blob/main/docs/CLOUD.md",[46],"docs/CLOUD.md"," in\nthe kraken repository sets out exactly what NoLag does and does not receive.",[72,492,494],{"id":493},"option-3-hosted","Option 3: hosted",[14,496,497,498,502,503,70],{},"We run all of it. No infrastructure, and you get the portal, usage dashboards,\nreplay and billing. See ",[42,499,501],{"href":500},"/pricing","pricing",", or start with the\n",[42,504,506],{"href":505},"/docs/getting-started","quick start",[72,508,510],{"id":509},"which-one","Which one",[18,512,513,528],{},[21,514,515],{},[24,516,517,519,522,525],{},[27,518],{},[27,520,521],{},"Data stays with you",[27,523,524],{},"You run infrastructure",[27,526,527],{},"You build auth",[34,529,530,543,554,567],{},[24,531,532,535,538,540],{},[39,533,534],{},"Whole stack",[39,536,537],{},"yes",[39,539,537],{},[39,541,542],{},"no, core does it",[24,544,545,548,550,552],{},[39,546,547],{},"Broker only",[39,549,537],{},[39,551,537],{},[39,553,537],{},[24,555,556,559,561,564],{},[39,557,558],{},"Linked",[39,560,537],{},[39,562,563],{},"broker only",[39,565,566],{},"no",[24,568,569,572,574,576],{},[39,570,571],{},"Hosted",[39,573,566],{},[39,575,566],{},[39,577,566],{},[72,579,581],{"id":580},"what-is-not-open-source","What is not open source",[14,583,584],{},"The hosted portal, usage metering and billing are not. Everything that exists\nonly because someone runs NoLag as a commercial service lives outside the two\nrepositories above.",[14,586,587],{},"We are not currently accepting external code contributions. Issues and bug\nreports are welcome.",[589,590,591],"style",{},"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 .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}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 .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}",{"title":85,"searchDepth":107,"depth":107,"links":593},[594,597,598,599,600],{"id":74,"depth":107,"text":75,"children":595},[596],{"id":293,"depth":117,"text":294},{"id":415,"depth":107,"text":416},{"id":493,"depth":107,"text":494},{"id":509,"depth":107,"text":510},{"id":580,"depth":107,"text":581},"Run NoLag yourself. Three ways: the whole stack on your own machine, your broker with NoLag as the control plane, or fully hosted. Both kraken and nolag-core are Apache 2.0.","md",{},"/docs/self-hosting",{"title":5,"description":601},"docs/self-hosting","k3lnaQSC4MiPFDpms5NRycDh4XnzJLVgu-EkVH05104",1788160344778]