zrok/assets/js/f888b719.74db6bc3.js
2024-04-25 14:14:00 +00:00

1 line
36 KiB
JavaScript

"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8938],{2800:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>h,contentTitle:()=>d,default:()=>x,frontMatter:()=>c,metadata:()=>l,toc:()=>m});var r=s(5893),i=s(1151),o=s(4908),t=s(3298),a=s(7597);const c={title:"Getting Started with zrok",sidebar_label:"Getting Started",sidebar_position:10},d=void 0,l={id:"getting-started",title:"Getting Started with zrok",description:"What's a zrok?",source:"@site/../docs/getting-started.mdx",sourceDirName:".",slug:"/getting-started",permalink:"/docs/getting-started",draft:!1,unlisted:!1,editUrl:"https://github.com/openziti/zrok/blob/main/docs/../docs/getting-started.mdx",tags:[],version:"current",sidebarPosition:10,frontMatter:{title:"Getting Started with zrok",sidebar_label:"Getting Started",sidebar_position:10},sidebar:"tutorialSidebar",next:{title:"Concepts",permalink:"/docs/concepts/"}},h={},m=[{value:"What&#39;s a zrok?",id:"whats-a-zrok",level:2},{value:"Open Source",id:"open-source",level:2},{value:"Ziti native",id:"ziti-native",level:3},{value:"What&#39;s it for?",id:"whats-it-for",level:2},{value:"Installing the zrok Command",id:"installing-the-zrok-command",level:2},{value:"Generating an Invitation",id:"generating-an-invitation",level:2},{value:"Enabling Your zrok Environment",id:"enabling-your-zrok-environment",level:2},{value:"Sharing",id:"sharing",level:2},{value:"Ephemeral by Default",id:"ephemeral-by-default",level:3},{value:"Public Shares and Frontends",id:"public-shares-and-frontends",level:3},{value:"Private Shares",id:"private-shares",level:3},{value:"Proxy Backend Mode",id:"proxy-backend-mode",level:3},{value:"Web Backend Mode",id:"web-backend-mode",level:3},{value:"Reserved Shares",id:"reserved-shares",level:3},{value:"Concepts Review",id:"concepts-review",level:2},{value:"Instance and Account",id:"instance-and-account",level:3},{value:"Environment",id:"environment",level:3},{value:"Shares",id:"shares",level:3},{value:"Reserved Shares",id:"reserved-shares-1",level:3},{value:"Self-Hosting an Instance",id:"self-hosting-an-instance",level:2}];function u(e){const n={a:"a",admonition:"admonition",code:"code",em:"em",h2:"h2",h3:"h3",img:"img",p:"p",pre:"pre",...(0,i.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.h2,{id:"whats-a-zrok",children:"What's a zrok?"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"zrok"})," (",(0,r.jsx)(n.em,{children:"/zi\u02d0\u0279\u0252k/ ZEE-rock"}),") is a secure, open-source, self-hostable sharing platform that simplifies shielding and sharing network services or files. There's a hardened zrok-as-a-service offering available at ",(0,r.jsx)(n.a,{href:"https://zrok.io",children:"zrok.io"})," with a generous free tier."]}),"\n",(0,r.jsx)(n.h2,{id:"open-source",children:"Open Source"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"zrok"})," is licensed under Apache 2.0."]}),"\n",(0,r.jsxs)(n.p,{children:["Check ",(0,r.jsx)(n.a,{href:"https://github.com/orgs/openziti/projects/16",children:"the roadmap"})," if you're thinking about the future. We would love to hear your ideas for ",(0,r.jsx)(n.code,{children:"zrok"}),"!"]}),"\n",(0,r.jsxs)(n.p,{children:["The best ways to engage are ",(0,r.jsx)(n.a,{href:"https://openziti.discourse.group/",children:"Discourse"})," for questions and ",(0,r.jsx)(n.a,{href:"https://github.com/openziti/zrok/issues",children:"GitHub Issues"})," for documenting problems."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.a,{href:"/docs/concepts/opensource",children:"Read more about zrok open source"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"ziti-native",children:"Ziti native"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"zrok"})," is a ",(0,r.jsx)(n.em,{children:"Ziti Native Application"}),", built on the ",(0,r.jsx)(n.a,{href:"https://openziti.io",children:"OpenZiti"})," platform, and supported by the OpenZiti community and NetFoundry team."]}),"\n",(0,r.jsx)(n.h2,{id:"whats-it-for",children:"What's it for?"}),"\n",(0,r.jsxs)(n.p,{children:["Use ",(0,r.jsx)(n.code,{children:"zrok"})," to share a running service, like a web server or a network socket, or to share a directory of static files."]}),"\n",(0,r.jsxs)(n.p,{children:["If ",(0,r.jsx)(n.a,{href:"/docs/concepts/sharing-public",children:"sharing publicly"}),", you can reserve a subdomain, enable authentication options, or both. Public shares proxy HTTPS to your service or files."]}),"\n",(0,r.jsxs)(n.p,{children:["If ",(0,r.jsx)(n.a,{href:"/docs/concepts/sharing-private",children:"sharing privately"}),", only users with the share token can access your share. In addition to what you can share publicly, private shares can include TCP and UDP services."]}),"\n",(0,r.jsx)(n.h2,{id:"installing-the-zrok-command",children:"Installing the zrok Command"}),"\n",(0,r.jsx)(o.N,{children:(0,r.jsxs)("div",{className:a.Z.downloadContainer,children:[(0,r.jsx)(t.Z,{osName:"Windows",osLogo:"/img/logo-windows.svg",infoText:"Binary executable",guideLink:"/docs/guides/install/windows"}),(0,r.jsx)(t.Z,{osName:"macOS",osLogo:"/img/logo-apple.svg",infoText:"Binary executable",guideLink:"/docs/guides/install/macos"}),(0,r.jsx)(t.Z,{osName:"Linux",osLogo:"/img/logo-linux.svg",infoText:"DEB, RPM packages",guideLink:"/docs/guides/install/linux"})]})}),"\n",(0,r.jsx)(n.h2,{id:"generating-an-invitation",children:"Generating an Invitation"}),"\n",(0,r.jsx)(n.admonition,{type:"note",children:(0,r.jsxs)(n.p,{children:["If not using ",(0,r.jsx)(n.code,{children:"zrok.io"})," (zrok-as-a-service), you must configure the ",(0,r.jsx)(n.code,{children:"zrok"})," command to use your instance. See the ",(0,r.jsx)(n.a,{href:"/docs/guides/self-hosting/instance-configuration",children:"instance configuration guide"})," in the self-hosting section for details."]})}),"\n",(0,r.jsxs)(n.p,{children:["Invite yourself to ",(0,r.jsx)(n.code,{children:"zrok"})," by running the ",(0,r.jsx)(n.code,{children:"zrok invite"})," command:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"zrok invite\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Output"',children:"enter and confirm your email address...\n\n> user@domain.com\n> user@domain.com\n\n[ Submit ]\n\ninvitation sent to 'user@domain.com'!\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"zrok invite"})," command presents a small form that allows you to enter (and then confirm) your email address. Tabbing to the ",(0,r.jsx)(n.code,{children:"[ Submit ]"})," button will send the request to your configured ",(0,r.jsx)(n.code,{children:"zrok"})," service."]}),"\n",(0,r.jsxs)(n.p,{children:["Next, check the email where you sent the invite. You should receive a message asking you to click a link to create your ",(0,r.jsx)(n.code,{children:"zrok"})," account. When you click that link, you will be brought to a web page that will allow you to set a password for your new account:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Enter a Password",src:s(9744).Z+"",width:"1791",height:"1362"})}),"\n",(0,r.jsxs)(n.p,{children:["Enter a password and its confirmation, and click the ",(0,r.jsx)(n.code,{children:"Register Account"})," button. You'll see the following:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Successful Registration",src:s(242).Z+"",width:"1791",height:"1369"})}),"\n",(0,r.jsxs)(n.p,{children:['For now, we\'ll ignore the "enable your shell for zrok" section. Just click the ',(0,r.jsx)(n.code,{children:"zrok web portal"})," link:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Web Login",src:s(9509).Z+"",width:"1791",height:"1362"})}),"\n",(0,r.jsxs)(n.p,{children:["After clicking the ",(0,r.jsx)(n.code,{children:"Log In"})," button, you'll be brought into the ",(0,r.jsx)(n.code,{children:"zrok"})," ",(0,r.jsx)(n.em,{children:"web console"}),":"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Web Console; Empty",src:s(2945).Z+"",width:"1791",height:"1362"})}),"\n",(0,r.jsxs)(n.p,{children:["Congratulations! Your ",(0,r.jsx)(n.code,{children:"zrok"})," account is ready to go!"]}),"\n",(0,r.jsx)(n.h2,{id:"enabling-your-zrok-environment",children:"Enabling Your zrok Environment"}),"\n",(0,r.jsxs)(n.p,{children:["When your ",(0,r.jsx)(n.code,{children:"zrok"})," account was created, the service generated a ",(0,r.jsx)(n.em,{children:"secret token"})," that identifies and authenticates in a single step. Protect your secret token as if it were a password, or an important account number; it's a ",(0,r.jsx)(n.em,{children:"secret"}),", protect it."]}),"\n",(0,r.jsxs)(n.p,{children:["When we left off you had downloaded, extracted, and configured your ",(0,r.jsx)(n.code,{children:"zrok"})," environment. In order to use that environment with your account, you'll need to ",(0,r.jsx)(n.code,{children:"enable"})," it. Enabling an environment generates a secure identity and the necessary underlying security policies with the OpenZiti network hosting the ",(0,r.jsx)(n.code,{children:"zrok"})," service."]}),"\n",(0,r.jsxs)(n.p,{children:["From the web console, click on your email address in the upper right corner of the header. That drop down menu contains an ",(0,r.jsx)(n.code,{children:"Enable Your Environment"})," link. Click that link and a modal dialog will be shown like this:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Enable Modal Dialog",src:s(9042).Z+"",width:"1791",height:"1369"})}),"\n",(0,r.jsxs)(n.p,{children:["This dialog box shows you the ",(0,r.jsx)(n.code,{children:"zrok enable"})," command that you can use to enable any shell to work with your ",(0,r.jsx)(n.code,{children:"zrok"})," account with a single command."]}),"\n",(0,r.jsx)(n.p,{children:"Let's copy that command and paste it into your shell:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Example"',children:"$ zrok enable klFEoIi0QAg7 \n\u28fb contacting the zrok service...\n"})}),"\n",(0,r.jsx)(n.p,{children:"After a few seconds, the message will change and indicate that the enable operation succeeded:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Example"',children:"$ zrok enable klFEoIi0QAg7 \n\u28fb the zrok environment was successfully enabled...\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Now, if we run a ",(0,r.jsx)(n.code,{children:"zrok status"})," command, you will see the details of your environment:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-txt",children:"zrok status\n"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Output"',children:"Config:\n\n CONFIG VALUE SOURCE\n apiEndpoint https://api.staging.zrok.io env\n\nEnvironment:\n\n PROPERTY VALUE\n Secret Token <<SET>>\n Ziti Identity <<SET>>\n"})}),"\n",(0,r.jsx)(n.p,{children:"Excellent... our environment is now fully enabled."}),"\n",(0,r.jsxs)(n.p,{children:["If we return to the ",(0,r.jsx)(n.em,{children:"web console"}),", we'll now see the new environment reflected in the explorer view:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"New Environment in Web UI",src:s(5546).Z+"",width:"1791",height:"1369"})}),"\n",(0,r.jsxs)(n.p,{children:["In my case, the environment is named ",(0,r.jsx)(n.code,{children:"michael@ziti-lx"}),", which is the username of my shell and the hostname of the system the shell is running on."]}),"\n",(0,r.jsx)(n.admonition,{type:"note",children:(0,r.jsxs)(n.p,{children:["Should you want to use a non-default name for your environment, you can pass the ",(0,r.jsx)(n.code,{children:"-d"})," option to the ",(0,r.jsx)(n.code,{children:"zrok enable"})," command. See ",(0,r.jsx)(n.code,{children:"zrok enable --help"})," for details."]})}),"\n",(0,r.jsxs)(n.p,{children:["If you click on the environment node in the explorer in the ",(0,r.jsx)(n.em,{children:"web console"}),", the details panel shown at the bottom of the page will change:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Empty Environment",src:s(3858).Z+"",width:"1791",height:"1369"})}),"\n",(0,r.jsxs)(n.p,{children:["The explorer supports clicking, dragging, mouse wheel zooming, and selecting the nodes in the graph for more information (and available actions) for the selected node. If you ever get lost in the explorer, click the ",(0,r.jsx)(n.img,{alt:"Zoom to Fit",src:s(3843).Z+"",width:"30",height:"25"})," ",(0,r.jsx)(n.em,{children:"zoom to fit"})," icon in the lower right corner of the explorer."]}),"\n",(0,r.jsxs)(n.p,{children:["If we click on the ",(0,r.jsx)(n.code,{children:"Detail"})," tab for our environment, we'll see something like:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Environment Detail",src:s(2534).Z+"",width:"1791",height:"1369"})}),"\n",(0,r.jsx)(n.admonition,{type:"note",children:(0,r.jsxs)(n.p,{children:["With your ",(0,r.jsx)(n.code,{children:"zrok"})," account you can ",(0,r.jsx)(n.code,{children:"zrok enable"})," multiple environments. This will allow you to run ",(0,r.jsx)(n.code,{children:"zrok share"})," in one environment, and ",(0,r.jsx)(n.code,{children:"zrok access"})," in other environments."]})}),"\n",(0,r.jsx)(n.p,{children:"Your environment is fully ready to go. Now we can move on to the fun stuff..."}),"\n",(0,r.jsx)(n.h2,{id:"sharing",children:"Sharing"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"zrok"})," is designed to make sharing resources as effortless as possible, while providing a high degree of security and control."]}),"\n",(0,r.jsx)(n.h3,{id:"ephemeral-by-default",children:"Ephemeral by Default"}),"\n",(0,r.jsxs)(n.p,{children:["Shared resources are ",(0,r.jsx)(n.em,{children:"ephemeral"})," by default; as soon as you terminate the ",(0,r.jsx)(n.code,{children:"zrok share"})," command, the entire share is removed and is no longer available to any users. Identifiers for shared resources are randomly allocated when the share is created."]}),"\n",(0,r.jsx)(n.h3,{id:"public-shares-and-frontends",children:"Public Shares and Frontends"}),"\n",(0,r.jsxs)(n.p,{children:["Resources that are shared ",(0,r.jsx)(n.em,{children:"publicly"})," are exposed to any users on the internet who have access to the ",(0,r.jsx)(n.code,{children:"zrok"}),' instance\'s "frontend".']}),"\n",(0,r.jsx)(n.p,{children:"A frontend is an HTTPS listener exposed to the internet, that lets any user with your ephemeral share token access your publicly shared resources."}),"\n",(0,r.jsxs)(n.p,{children:["For example, I might create a public share using the ",(0,r.jsx)(n.code,{children:"zrok share public"})," command, which results in my ",(0,r.jsx)(n.code,{children:"zrok"})," instance exposing a URL like ",(0,r.jsx)(n.code,{children:"https://2ptgbr8tlfvk.share.zrok.io"})," to access my resources."]}),"\n",(0,r.jsxs)(n.p,{children:['In this case, my share was given the "share token" of ',(0,r.jsx)(n.code,{children:"2ptgbr8tlfvk"}),". That URL can be given to any user, allowing them to immediately access the shared resources directly from my local environment, all without exposing any access to my private, secure environment. The physical network location of my environment is not exposed to anonymous consumers of my resources."]}),"\n",(0,r.jsxs)(n.admonition,{type:"note",children:[(0,r.jsxs)(n.p,{children:["Here is the ",(0,r.jsx)(n.code,{children:"--help"})," output from ",(0,r.jsx)(n.code,{children:"zrok share public"}),":"]}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-text",children:"zrok share public\n"})}),(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Output"',children:'Error: accepts 1 arg(s), received 0\nUsage:\n zrok share public <target> [flags]\n\nFlags:\n --backend-mode string The backend mode {proxy, web, caddy, drive} (default "proxy")\n --basic-auth stringArray Basic authentication users (<username:password>,...)\n --frontends stringArray Selected frontends to use for the share (default [public])\n --headless Disable TUI and run headless\n -h, --help help for public\n --insecure Enable insecure TLS certificate validation for <target>\n\nGlobal Flags:\n -p, --panic Panic instead of showing pretty errors\n -v, --verbose Enable verbose logging\n\n[ERROR]: an error occurred (accepts 1 arg(s), received 0)\n'})}),(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"<target>"})," defines the path to the local resource that you intend to share. The form of ",(0,r.jsx)(n.code,{children:"<target>"})," depends on the ",(0,r.jsx)(n.code,{children:"--backend-mode"})," that you're using."]}),(0,r.jsxs)(n.p,{children:["In the case of ",(0,r.jsx)(n.code,{children:"--backend-mode proxy"}),", ",(0,r.jsx)(n.code,{children:"<target>"})," should be a URL to an HTTP endpoint."]}),(0,r.jsxs)(n.p,{children:["In the case of ",(0,r.jsx)(n.code,{children:"--backend-mode web"}),", ",(0,r.jsx)(n.code,{children:"<target>"}),' is the path to a file on disk that serves as the "root" of the file tree to be shared.']})]}),"\n",(0,r.jsx)(n.p,{children:"If we return to the web console, we see our share in the explorer:"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Web Console Share",src:s(6097).Z+"",width:"1791",height:"1369"})}),"\n",(0,r.jsxs)(n.p,{children:["If we click on our new share in the explorer, we can see the share details:\n",(0,r.jsx)(n.img,{alt:"Share Details",src:s(4647).Z+"",width:"1791",height:"1369"})]}),"\n",(0,r.jsxs)(n.p,{children:["If we click on the ",(0,r.jsx)(n.em,{children:"frontend endpoint"})," a new browser tab opens and we see the content of our share:\n",(0,r.jsx)(n.img,{alt:"Share Frontend",src:s(6254).Z+"",width:"1669",height:"1033"})]}),"\n",(0,r.jsx)(n.p,{children:"If we click on the environment in the explorer, we're shown all of the shares for that environment (including our new share), along with a spark line that shows the activity:"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Environment Spark Line",src:s(9737).Z+"",width:"1791",height:"1369"})}),"\n",(0,r.jsxs)(n.p,{children:["And as soon as I terminate the ",(0,r.jsx)(n.code,{children:"zrok share"})," client, the resources are removed from the ",(0,r.jsx)(n.code,{children:"zrok"})," environment."]}),"\n",(0,r.jsx)(n.p,{children:"If we try to reload the frontend endpoint in our web browser, we'll see:"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Not Found",src:s(5724).Z+"",width:"1556",height:"1229"})}),"\n",(0,r.jsx)(n.h3,{id:"private-shares",children:"Private Shares"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"zrok"})," also provides a powerful ",(0,r.jsx)(n.em,{children:"private"})," sharing model. If I execute the following command:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Example"',children:"$ zrok share private http://localhost:8080\n"})}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"zrok"})," service will respond with the following:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-buttonless",metastring:'title="Output"',children:"access your share with: zrok access private wvszln4dyz9q\n"})}),"\n",(0,r.jsxs)(n.p,{children:["Rather than allowing access to your service through a public frontend, a ",(0,r.jsx)(n.em,{children:"private"})," share is only exposed to the underlying OpenZiti network, and can only be accessed using the ",(0,r.jsx)(n.code,{children:"zrok access"})," command."]}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"zrok access private wvszln4dyz9q"})," command can be run by any ",(0,r.jsx)(n.code,{children:"zrok"})," user, allowing them to create and bind a local HTTP listener, that allows for private access to your shared resources."]}),"\n",(0,r.jsx)(n.h3,{id:"proxy-backend-mode",children:"Proxy Backend Mode"}),"\n",(0,r.jsxs)(n.p,{children:["Without specifying a ",(0,r.jsx)(n.em,{children:"backend mode"}),", the ",(0,r.jsx)(n.code,{children:"zrok share"})," command will assume that you're trying to share a ",(0,r.jsx)(n.code,{children:"proxy"})," resource. A ",(0,r.jsx)(n.code,{children:"proxy"})," resource is usually some private HTTP/HTTPS endpoint (like a development server, or a private application) running in your local environment. Usually such an endpoint would have no inbound connectivity except for however it is reachable from your local environment. It might be running on ",(0,r.jsx)(n.code,{children:"localhost"}),", or only listening on a private LAN segment behind a firewall."]}),"\n",(0,r.jsxs)(n.p,{children:["For these services a ",(0,r.jsx)(n.code,{children:"proxy"})," share will allow those endpoints to be reached, either ",(0,r.jsx)(n.em,{children:"publicly"})," or ",(0,r.jsx)(n.em,{children:"privately"})," through the ",(0,r.jsx)(n.code,{children:"zrok"})," service."]}),"\n",(0,r.jsx)(n.h3,{id:"web-backend-mode",children:"Web Backend Mode"}),"\n",(0,r.jsxs)(n.p,{children:["The ",(0,r.jsx)(n.code,{children:"zrok share"})," command accepts a ",(0,r.jsx)(n.code,{children:"--backend-mode"})," option. Besides ",(0,r.jsx)(n.code,{children:"proxy"}),", the current ",(0,r.jsx)(n.code,{children:"v0.3"})," release (as of this writing) also supports a ",(0,r.jsx)(n.code,{children:"web"})," mode. The ",(0,r.jsx)(n.code,{children:"web"})," mode allows you to specify a local folder on your filesystem, and instantly turns your ",(0,r.jsx)(n.code,{children:"zrok"})," client into a web server, exposing your web content either ",(0,r.jsx)(n.em,{children:"publicly"})," or ",(0,r.jsx)(n.em,{children:"privately"})," without having to a configure a web server."]}),"\n",(0,r.jsx)(n.h3,{id:"reserved-shares",children:"Reserved Shares"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"zrok"})," shares are ",(0,r.jsx)(n.em,{children:"ephemeral"}),' unless you specifically create a "reserved" share.']}),"\n",(0,r.jsxs)(n.p,{children:["A reserved share can be re-used multiple times; it will survive termination of the ",(0,r.jsx)(n.code,{children:"zrok share"})," command, allowing for longer-lasting semi-permanent access to shared resources."]}),"\n",(0,r.jsx)(n.p,{children:"The first step is to create the reserved share:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-txt",metastring:'title="Example"',children:"$ zrok reserve public --backend-mode web v0.3_getting_started\n[ 0.275] INFO main.(*reserveCommand).run: your reserved share token is 'mltwsinym1s2'\n[ 0.275] INFO main.(*reserveCommand).run: reserved frontend endpoint: https://mltwsinym1s2.share.zrok.io\n"})}),"\n",(0,r.jsxs)(n.p,{children:["I'm asking the ",(0,r.jsx)(n.code,{children:"zrok"})," service to reserve a share with a ",(0,r.jsx)(n.code,{children:"web"})," backend mode, pointing at my local ",(0,r.jsx)(n.code,{children:"docs"})," folder."]}),"\n",(0,r.jsxs)(n.p,{children:["You'll want to remember the share token (",(0,r.jsx)(n.code,{children:"mltwsinym1s2"})," in this case), and the frontend endpoint URL. If this were a ",(0,r.jsx)(n.em,{children:"private"})," reserved share, there would not be a frontend URL."]}),"\n",(0,r.jsx)(n.p,{children:"If we do nothing else, and then point a web browser at the frontend endpoint, we get:"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"Not Found",src:s(7369).Z+"",width:"1556",height:"1229"})}),"\n",(0,r.jsxs)(n.p,{children:["This is the ",(0,r.jsx)(n.code,{children:"404"})," error message returned by the ",(0,r.jsx)(n.code,{children:"zrok"})," frontend. We're getting this because we haven't yet started up a ",(0,r.jsx)(n.code,{children:"zrok share"})," for the service. Let's do that:"]}),"\n",(0,r.jsx)(n.p,{children:"This command:"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-txt",metastring:'title="Example"',children:"$ zrok share reserved mltwsinym1s2\n"})}),"\n",(0,r.jsx)(n.p,{children:"...results in a new share backend starting up and connecting to the existing reserved share:"}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"zrok share reserved",src:s(1577).Z+"",width:"951",height:"706"})}),"\n",(0,r.jsxs)(n.p,{children:["And now if we refresh the frontend endpoint URL in the web browser, we'll see an index of the ",(0,r.jsx)(n.code,{children:"docs"})," directory:"]}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.img,{alt:"zrok docs share",src:s(6254).Z+"",width:"1669",height:"1033"})}),"\n",(0,r.jsxs)(n.p,{children:["With the reserved share, we're free to stop and restart the ",(0,r.jsx)(n.code,{children:"zrok share reserved"})," command as many times as we want, without losing the token for our share."]}),"\n",(0,r.jsxs)(n.p,{children:["When we're done with the reserved share, we can ",(0,r.jsx)(n.em,{children:"release"})," it using this command:"]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-txt",metastring:'title="Example"',children:"$ zrok release mltwsinym1s2\n[ 0.230] INFO main.(*releaseCommand).run: reserved share 'mltwsinym1s2' released\n"})}),"\n",(0,r.jsx)(n.h2,{id:"concepts-review",children:"Concepts Review"}),"\n",(0,r.jsxs)(n.p,{children:["In summary, ",(0,r.jsx)(n.code,{children:"zrok"})," lets you easily and securely share resources with both general internet users (through ",(0,r.jsx)(n.em,{children:"public"})," sharing) and also with other ",(0,r.jsx)(n.code,{children:"zrok"})," users (through ",(0,r.jsx)(n.em,{children:"private"})," sharing)."]}),"\n",(0,r.jsxs)(n.p,{children:["Here's a quick review of the ",(0,r.jsx)(n.code,{children:"zrok"})," mental model and the vocabulary."]}),"\n",(0,r.jsx)(n.h3,{id:"instance-and-account",children:"Instance and Account"}),"\n",(0,r.jsxs)(n.p,{children:["You create an ",(0,r.jsx)(n.em,{children:"account"})," with a ",(0,r.jsx)(n.code,{children:"zrok"})," ",(0,r.jsx)(n.em,{children:"instance"}),". Your account is identified by a username and a password, which you use to log into the ",(0,r.jsx)(n.em,{children:"web console"}),". Your account also has a ",(0,r.jsx)(n.em,{children:"secret token"}),", which you will use to authenticate from the ",(0,r.jsx)(n.code,{children:"zrok"})," command-line to interact with the ",(0,r.jsx)(n.em,{children:"instance"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["You create a new ",(0,r.jsx)(n.em,{children:"account"})," with a ",(0,r.jsx)(n.code,{children:"zrok"})," ",(0,r.jsx)(n.em,{children:"instance"})," through the ",(0,r.jsx)(n.code,{children:"zrok invite"})," command."]}),"\n",(0,r.jsx)(n.h3,{id:"environment",children:"Environment"}),"\n",(0,r.jsxs)(n.p,{children:["Using your ",(0,r.jsx)(n.em,{children:"secret token"})," you use the ",(0,r.jsx)(n.code,{children:"zrok"})," command-line interface to create an ",(0,r.jsx)(n.em,{children:"environment"}),". An ",(0,r.jsx)(n.em,{children:"environment"})," corresponds to a single command-line user on a specific ",(0,r.jsx)(n.em,{children:"host system"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["You create a new ",(0,r.jsx)(n.em,{children:"environment"})," by using the ",(0,r.jsx)(n.code,{children:"zrok enable"})," command."]}),"\n",(0,r.jsx)(n.h3,{id:"shares",children:"Shares"}),"\n",(0,r.jsxs)(n.p,{children:["Once you've enabled an ",(0,r.jsx)(n.em,{children:"environment"}),", you then create one or more ",(0,r.jsx)(n.em,{children:"shares"}),". Shares have either a ",(0,r.jsx)(n.em,{children:"public"})," or ",(0,r.jsx)(n.em,{children:"private"})," ",(0,r.jsx)(n.em,{children:"sharing mode"}),". ",(0,r.jsx)(n.em,{children:"Shares"})," share a specific type of resource using a ",(0,r.jsx)(n.em,{children:"backend mode"}),". As of this writing ",(0,r.jsx)(n.code,{children:"zrok"})," supports a ",(0,r.jsx)(n.code,{children:"proxy"})," ",(0,r.jsx)(n.em,{children:"backend mode"})," to share local HTTP resources as a ",(0,r.jsx)(n.em,{children:"reverse proxy"}),". ",(0,r.jsx)(n.code,{children:"zrok"})," also supports a ",(0,r.jsx)(n.code,{children:"web"})," ",(0,r.jsx)(n.em,{children:"backend mode"})," to share local file and HTML resources by enabling a basic HTTP server."]}),"\n",(0,r.jsxs)(n.p,{children:["Every ",(0,r.jsx)(n.em,{children:"share"})," is identified by a ",(0,r.jsx)(n.em,{children:"share token"}),". ",(0,r.jsx)(n.em,{children:"Public shares"})," can be accessed through either a ",(0,r.jsx)(n.em,{children:"frontend"})," instance offered through the ",(0,r.jsx)(n.code,{children:"zrok"})," ",(0,r.jsx)(n.em,{children:"instance"}),", or through the ",(0,r.jsx)(n.code,{children:"zrok access"})," command. ",(0,r.jsx)(n.em,{children:"Private shares"})," can only be accessed through the ",(0,r.jsx)(n.code,{children:"zrok access"})," command."]}),"\n",(0,r.jsxs)(n.p,{children:["You use the ",(0,r.jsx)(n.code,{children:"zrok share"})," command to create and enable ",(0,r.jsx)(n.em,{children:"ephemeral shares"}),"."]}),"\n",(0,r.jsx)(n.h3,{id:"reserved-shares-1",children:"Reserved Shares"}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.code,{children:"zrok"})," supports creating ",(0,r.jsx)(n.em,{children:"shares"})," that have a consistent ",(0,r.jsx)(n.em,{children:"share token"})," that survives restarts of the ",(0,r.jsx)(n.code,{children:"zrok share"})," command. These are considered ",(0,r.jsx)(n.em,{children:"non-ephemeral"}),", and is callled a ",(0,r.jsx)(n.em,{children:"reserved share"}),"."]}),"\n",(0,r.jsxs)(n.p,{children:["You use the ",(0,r.jsx)(n.code,{children:"zrok reserve"})," command to create ",(0,r.jsx)(n.em,{children:"reserved shares"}),". Reserved shares last until you use the ",(0,r.jsx)(n.code,{children:"zrok release"})," command to delete them."]}),"\n",(0,r.jsx)(n.h2,{id:"self-hosting-an-instance",children:"Self-Hosting an Instance"}),"\n",(0,r.jsxs)(n.p,{children:["Interested in self-hosting your own ",(0,r.jsx)(n.code,{children:"zrok"})," instance? See the ",(0,r.jsx)(n.a,{href:"/docs/guides/self-hosting/linux",children:"self-hosting guide"})," for details."]})]})}function x(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(u,{...e})}):u(e)}},4908:(e,n,s)=>{s.d(n,{L:()=>t,N:()=>a});var r=s(7294),i=s(5893);const o=(0,r.createContext)([]),t=()=>(0,r.useContext)(o),a=e=>{let{children:n}=e;const[s,t]=(0,r.useState)([]);return(0,r.useEffect)((()=>{(async()=>{try{const e=await fetch("https://api.github.com/repos/openziti/zrok/releases/latest");if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);const n=(await e.json()).assets.map((e=>({name:e.name,url:e.browser_download_url,arch:e.name.replace(".tar.gz","").split("_")[3]})));console.log("Fetched assets:",n),t(n)}catch(e){console.error("Error fetching the release assets:",e)}})()}),[]),(0,i.jsx)(o.Provider,{value:s,children:n})}},3298:(e,n,s)=>{s.d(n,{Z:()=>c});s(7294);var r=s(4908),i=s(7597),o=s(2949),t=s(5893);const a=e=>{switch(e){case"amd64":return"x86_64";case"arm64":return"ARM64";case"armv7":return"ARM";default:return e.toUpperCase()}},c=e=>{let{osName:n,osLogo:s,infoText:c,guideLink:d}=e;const{colorMode:l}=(0,o.I)(),h=(0,r.L)();console.log("Assets in DownloadCard:",h);const m=(e=>{switch(e){case"Windows":return"windows";case"macOS":return"darwin";case"Linux":return"linux";default:return""}})(n),u=h.filter((e=>e.name.includes(m)));return console.log("Filtered assets for",n,"in DownloadCard:",u),(0,t.jsxs)("div",{className:i.Z.downloadCard,children:[(0,t.jsx)("div",{className:i.Z.imgContainer,children:(0,t.jsx)("img",{src:s,alt:`${n} logo`})}),(0,t.jsx)("h3",{children:n}),u.length>0&&(0,t.jsx)("ul",{children:u.map(((e,n)=>(0,t.jsx)("li",{className:i.Z.downloadButtons,children:(0,t.jsx)("a",{href:e.url,className:i.Z.downloadLinks,children:a(e.arch)})},n)))}),d&&(0,t.jsxs)("div",{className:i.Z.cardFooter,children:[(0,t.jsx)("p",{children:c}),(0,t.jsx)("a",{href:d,children:"GUIDE"}),(0,t.jsx)("p",{})]})]})}},7597:(e,n,s)=>{s.d(n,{Z:()=>r});const r={downloadContainer:"downloadContainer_nNgj",downloadCard:"downloadCard_D_EY",cardFooter:"cardFooter_Rhom",downloadButtons:"downloadButtons_NPAP",downloadLinks:"downloadLinks_thSu",imgContainer:"imgContainer_r0QA"}},9042:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_enable_modal-45da63a6907e930daaa4c798272ce5fa.png"},5724:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_not_found-fa3415937c341eb10e1eb98c9b063583.png"},242:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_registration_success-05e7e328284f6dc38cd993322698d38b.png"},7369:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_reserved_not_found-2519707e5cc3e635b7a6feb381c1d040.png"},1577:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_share_reserved-6bce67775ce2c41abb0ef13ee1fad972.png"},9744:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_verify-22a26d401b9a77a4278f3c0f54d2a981.png"},2945:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_console_empty-cce147eaf8e7bc83abe556336a4aea98.png"},9737:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_console_environment_spark-925c0709ed7a42f0a708ab0523cdeb5f.png"},6097:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_console_explorer_share-11236f68819da60014d5444e7429c189.png"},4647:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_console_share_detail-efeaa472d5e5c225a160f6d5647086b3.png"},6254:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_console_share_frontend-d7c0d6495493c00b94ae237339f2dc2d.png"},9509:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_login-a6161cc79e66932fab76994bdfb8f9c1.png"},2534:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_ui_empty_environment_detail-153c921ade86f924079947b0f734e3ff.png"},3858:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_ui_empty_shares-048c08c18477bcabb9fa8c1b58537012.png"},5546:(e,n,s)=>{s.d(n,{Z:()=>r});const r=s.p+"assets/images/zrok_web_ui_new_environment-414d8e8fc25b09f257cb40ba47d6acbb.png"},3843:(e,n,s)=>{s.d(n,{Z:()=>r});const r="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAZCAIAAACpVwlNAAAEr2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4KPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNS41LjAiPgogPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgeG1sbnM6dGlm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C6mewog5ttZBq7xcrf1OK95sy61ZgQaAIIx2lGgdRsPBcrXmSbYXstLyRmPkSWZh5HdaAODe3uipVlaZmk9IxdMcAHiam3DBRJCPCMJol+bfbuMxaJ7mjJLZZFxeb2Gku6mDTrJXjExeviILFqJF8WtpGOf5y5wn+gBcXI4F9z6rgwAAAABJRU5ErkJggg=="},1151:(e,n,s)=>{s.d(n,{Z:()=>a,a:()=>t});var r=s(7294);const i={},o=r.createContext(i);function t(e){const n=r.useContext(o);return r.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:t(e.components),r.createElement(o.Provider,{value:n},e.children)}}}]);