PageSourceSearch

https://pocketbase.io/_app/immutable/nodes/38.jIExh6J0.js

js pocketbase.io collected 2026-09-25 14:57:28 UTC 33,447 bytes, 188 lines download raw bytes

1import{s as on,d as s,n as V,i as a,b as f,x as nt,p as I,c,r as v,g as i,e as N,f as z,h as m,j as p,t as D}from"../chunks/scheduler.DQkMsCme.js";import{S as pn,i as un,d as C,t as w,a as P,m as M,c as T,b as L}from"../chunks/index.DidmSOuj.js";import{H as X}from"../chunks/HeadingLink.DDyitwi-.js";import{C as cn}from"../chunks/CommonHelper.ucxL7p6H.js";import{C as Q}from"../chunks/CodeBlock.DLjOsXzZ.js";import{A as Fe}from"../chunks/Accordion.Cdcg7mt0.js";import{T as mn}from"../chunks/Toc.Bk0cdD5b.js";function fn(E){let n,h=`By default, PocketBase uses the internal Unix <code>sendmail</code> command for sending emails.
2            <br/>
3            While it&#39;s OK for development, it&#39;s not very useful for production, because your emails most likely will get
4            marked as spam or even fail to deliver.`,r,o,d=`To avoid deliverability issues, consider using a local SMTP server or an external mail service like
5            <a href="https://www.mailersend.com/" target="_blank" rel="noreferrer noopener">MailerSend</a>,
6            <a href="https://www.brevo.com/" target="_blank" rel="noreferrer noopener">Brevo</a>,
7            <a href="https://sendgrid.com/" target="_blank" rel="noreferrer noopener">SendGrid</a>,
8            <a href="https://www.mailgun.com/" target="_blank" rel="noreferrer noopener">Mailgun</a>,
9            <a href="https://aws.amazon.com/ses/" target="_blank" rel="noreferrer noopener">AWS SES</a>, etc.`,t,l,O,$,b="Dashboard > Settings > Mail settings",A,B,_,y,g,x;return{c(){n=m("p"),n.innerHTML=h,r=p(),o=m("p"),o.innerHTML=d,t=p(),l=m("p"),O=D(`Once you've decided on a mail service, you could configure the PocketBase SMTP settings from the
10            `),$=m("em"),A=D(b),B=p(),_=D(":"),y=p(),g=m("img"),this.h()},l(k){n=c(k,"P",{"data-svelte-h":!0}),v(n)!=="svelte-1dw3mak"&&(n.innerHTML=h),r=i(k),o=c(k,"P",{"data-svelte-h":!0}),v(o)!=="svelte-v7sncc"&&(o.innerHTML=d),t=i(k),l=c(k,"P",{});var S=N(l);O=z(S,`Once you've decided on a mail service, you could configure the PocketBase SMTP settings from the
11            `),$=c(S,"EM",{});var J=N($);A=z(J,b),B=i(J),J.forEach(s),_=z(S,":"),S.forEach(s),y=i(k),g=c(k,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){nt(g.src,x="/images/screenshots/smtp-settings.png")||I(g,"src",x),I(g,"alt","SMTP settings screenshot"),I(g,"class","screenshot m-b-xs")},m(k,S){a(k,n,S),a(k,r,S),a(k,o,S),a(k,t,S),a(k,l,S),f(l,O),f(l,$),f($,A),f($,B),f(l,_),a(k,y,S),a(k,g,S)},p:V,d(k){k&&(s(n),s(r),s(o),s(t),s(l),s(y),s(g))}}}function dn(E){let n,h,r,o="highly recommended",d;return n=new X({props:{title:"Use SMTP mail server",tag:"strong"}}),{c(){L(n.$$.fragment),h=p(),r=m("span"),r.textContent=o,this.h()},l(t){T(n.$$.fragment,t),h=i(t),r=c(t,"SPAN",{class:!0,"data-svelte-h":!0}),v(r)!=="svelte-vv5oyj"&&(r.textContent=o),this.h()},h(){I(r,"class","label label-danger txt-bold m-l-auto")},m(t,l){M(n,t,l),a(t,h,l),a(t,r,l),d=!0},p:V,i(t){d||(P(n.$$.fragment,t),d=!0)},o(t){w(n.$$.fragment,t),d=!1},d(t){t&&(s(h),s(r)),C(n,t)}}}function hn(E){let n,h=`To minimize the risk of API abuse (e.g. excessive auth or record create requests) it is recommended to set
12            up a rate limiter.`,r,o,d=`PocketBase v0.23.0+ comes with a simple builtin rate limiter that should cover most of the cases but you
13            are also free to use any external one via reverse proxy if you need more advanced options.`,t,l,O,$,b="Dashboard > Settings > Application",A,B,_,y,g;return{c(){n=m("p"),n.textContent=h,r=p(),o=m("p"),o.textContent=d,t=p(),l=m("p"),O=D(`You can configure the builtin rate limiter from the
14            `),$=m("em"),A=D(b),B=D(":"),_=p(),y=m("img"),this.h()},l(x){n=c(x,"P",{"data-svelte-h":!0}),v(n)!=="svelte-1eh2gb7"&&(n.textContent=h),r=i(x),o=c(x,"P",{"data-svelte-h":!0}),v(o)!=="svelte-1e55ypu"&&(o.textContent=d),t=i(x),l=c(x,"P",{});var k=N(l);O=z(k,`You can configure the builtin rate limiter from the
15            `),$=c(k,"EM",{});var S=N($);A=z(S,b),B=z(S,":"),S.forEach(s),k.forEach(s),_=i(x),y=c(x,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){nt(y.src,g="/images/screenshots/rate-limit-settings.png")||I(y,"src",g),I(y,"alt","Rate limit settings screenshot"),I(y,"class","screenshot m-b-xs")},m(x,k){a(x,n,k),a(x,r,k),a(x,o,k),a(x,t,k),a(x,l,k),f(l,O),f(l,$),f($,A),f($,B),a(x,_,k),a(x,y,k)},p:V,d(x){x&&(s(n),s(r),s(o),s(t),s(l),s(_),s(y))}}}function $n(E){let n,h,r,o="highly recommended",d;return n=new X({props:{title:"Enable rate limiter",tag:"strong"}}),{c(){L(n.$$.fragment),h=p(),r=m("span"),r.textContent=o,this.h()},l(t){T(n.$$.fragment,t),h=i(t),r=c(t,"SPAN",{class:!0,"data-svelte-h":!0}),v(r)!=="svelte-vv5oyj"&&(r.textContent=o),this.h()},h(){I(r,"class","label label-danger txt-bold m-l-auto")},m(t,l){M(n,t,l),a(t,h,l),a(t,r,l),d=!0},p:V,i(t){d||(P(n.$$.fragment,t),d=!0)},o(t){w(n.$$.fragment,t),d=!1},d(t){t&&(s(h),s(r)),C(n,t)}}}
15function gn(E){let n,h="PocketBase v0.38.0+ added support for superuser IPs whitelist that can greatly help hardening the security of your application because even in case a malicious actor got their hands on a superuser auth token they will not be able to use it and will get 403 error.",r,o,d="The IPs whitelist setting can be conveniently enabled from the <em>Dashboard &gt; Settings &gt; Application &gt; Superuser IPs</em>:",t,l,O,$,b,A="In case your IP changes, you can also reset/change the whitelist setting using the <code>superuser ips</code> console command:",B,_,y;return _=new Q({props:{language:"html",content:`
16                # note: --dir is optional and defaults to pb_data next to the executable
17
18                # clear whitelisted IPs
19                ./pocketbase superuser ips --dir=/path/to/your/pb_data
20
21                # OR change the whitelisted IPs to 127.0.0.1 and 10.0.0.0 (replace with your real IP)
22                ./pocketbase superuser ips 127.0.0.1 10.0.0.0 --dir=/path/to/your/pb_data
23            `}}),{c(){n=m("p"),n.textContent=h,r=p(),o=m("p"),o.innerHTML=d,t=p(),l=m("img"),$=p(),b=m("p"),b.innerHTML=A,B=p(),L(_.$$.fragment),this.h()},l(g){n=c(g,"P",{"data-svelte-h":!0}),v(n)!=="svelte-16kwbby"&&(n.textContent=h),r=i(g),o=c(g,"P",{"data-svelte-h":!0}),v(o)!=="svelte-edqgr7"&&(o.innerHTML=d),t=i(g),l=c(g,"IMG",{src:!0,alt:!0,class:!0}),$=i(g),b=c(g,"P",{"data-svelte-h":!0}),v(b)!=="svelte-in9bgo"&&(b.innerHTML=A),B=i(g),T(_.$$.fragment,g),this.h()},h(){nt(l.src,O="/images/screenshots/superusers_ips.png")||I(l,"src",O),I(l,"alt","Superusers IPs whitelist screenshot"),I(l,"class","screenshot m-b-xs")},m(g,x){a(g,n,x),a(g,r,x),a(g,o,x),a(g,t,x),a(g,l,x),a(g,$,x),a(g,b,x),a(g,B,x),M(_,g,x),y=!0},p:V,i(g){y||(P(_.$$.fragment,g),y=!0)},o(g){w(_.$$.fragment,g),y=!1},d(g){g&&(s(n),s(r),s(o),s(t),s(l),s($),s(b),s(B)),C(_,g)}}}function vn(E){let n,h,r,o="highly recommended",d;return n=new X({props:{title:"Restrict superusers to specific IPs/subnets",tag:"strong"}}),{c(){L(n.$$.fragment),h=p(),r=m("span"),r.textContent=o,this.h()},l(t){T(n.$$.fragment,t),h=i(t),r=c(t,"SPAN",{class:!0,"data-svelte-h":!0}),v(r)!=="svelte-vv5oyj"&&(r.textContent=o),this.h()},h(){I(r,"class","label label-danger txt-bold m-l-auto")},m(t,l){M(n,t,l),a(t,h,l),a(t,r,l),d=!0},p:V,i(t){d||(P(n.$$.fragment,t),d=!0)},o(t){w(n.$$.fragment,t),d=!1},d(t){t&&(s(h),s(r)),C(n,t)}}}function bn(E){let n,h=`As an additional layer of security you can enable the MFA and OTP options for the <code>_superusers</code>
24            collection, which will enforce an additional one-time password (email code) requirement when authenticating
25            as superuser.`,r,o,d=`In case of email deliverability issues, you can also generate an OTP manually using the
26            <code>./pocketbase superuser otp [email protected]</code> command.`,t,l,O;return{c(){n=m("p"),n.innerHTML=h,r=p(),o=m("p"),o.innerHTML=d,t=p(),l=m("img"),this.h()},l($){n=c($,"P",{"data-svelte-h":!0}),v(n)!=="svelte-1y2r9tz"&&(n.innerHTML=h),r=i($),o=c($,"P",{"data-svelte-h":!0}),v(o)!=="svelte-89zg69"&&(o.innerHTML=d),t=i($),l=c($,"IMG",{src:!0,alt:!0,class:!0}),this.h()},h(){nt(l.src,O="/images/screenshots/superusers_mfa.png")||I(l,"src",O),I(l,"alt","Superusers MFA settings screenshot"),I(l,"class","screenshot m-b-xs")},m($,b){a($,n,b),a($,r,b),a($,o,b),a($,t,b),a($,l,b)},p:V,d($){$&&(s(n),s(r),s(o),s(t),s(l))}}}function _n(E){let n,h,r,o="optional",d;return n=new X({props:{title:"Enable MFA for superusers",tag:"strong"}}),{c(){L(n.$$.fragment),h=p(),r=m("span"),r.textContent=o,this.h()},l(t){T(n.$$.fragment,t),h=i(t),r=c(t,"SPAN",{class:!0,"data-svelte-h":!0}),v(r)!=="svelte-1p4b7fa"&&(r.textContent=o),this.h()},h(){I(r,"class","label label-warning txt-bold m-l-auto")},m(t,l){M(n,t,l),a(t,h,l),a(t,r,l),d=!0},p:V,i(t){d||(P(n.$$.fragment,t),d=!0)},o(t){w(n.$$.fragment,t),d=!1},d(t){t&&(s(h),s(r)),C(n,t)}}}function xn(E){let n,h="The below instructions are for Linux but other operating systems have similar mechanism.",r,o,d=`Unix uses <em>&quot;file descriptors&quot;</em> also for network connections and most systems have a default limit
27            of ~ 1024.
28            <br/>
29            If your application has a lot of concurrent realtime connections, it is possible that at some point you would
30            get an error such as: <code>Too many open files</code>.`,t,l,O=`One way to mitigate this is to check your current account resource limits by running
31            <code>ulimit -a</code> and find the parameter you want to change. For example, if you want to increase the
32            open files limit (<em>-n</em>), you could run
33            <code>ulimit -n 4096</code> before starting PocketBase OR adjust the <code>LimitNOFILE</code> option in your systemd service file.`;return{c(){n=m("p"),n.textContent=h,r=p(),o=m("p"),o.innerHTML=d,t=p(),l=m("p"),l.innerHTML=O,this.h()},l($){n=c($,"P",{class:!0,"data-svelte-h":!0}),v(n)!=="svelte-19ke1oz"&&(n.textContent=h),r=i($),o=c($,"P",{"data-svelte-h":!0}),v(o)!=="svelte-fmm62r"&&(o.innerHTML=d),t=i($),l=c($,"P",{"data-svelte-h":!0}),v(l)!=="svelte-82lh4o"&&(l.innerHTML=O),this.h()},h(){I(n,"class","txt-hint txt-bold")},m($,b){a($,n,b),a($,r,b),a($,o,b),a($,t,b),a($,l,b)},p:V,d($){$&&(s(n),s(r),s(o),s(t),s(l))}}}function yn(E){let n,h,r,o="optional",d;return n=new X({props:{title:"Increase the open file descriptors limit",tag:"strong"}}),{c(){L(n.$$.fragment),h=p(),r=m("span"),r.textContent=o,this.h()},l(t){T(n.$$.fragment,t),h=i(t),r=c(t,"SPAN",{class:!0,"data-svelte-h":!0}),v(r)!=="svelte-1p4b7fa"&&(r.textContent=o),this.h()},h(){I(r,"class","label label-warning txt-bold m-l-auto")},m(t,l){M(n,t,l),a(t,h,l),a(t,r,l),d=!0},p:V,i(t){d||(P(n.$$.fragment,t),d=!0)},o(t){w(n.$$.fragment,t),d=!1},d(t){t&&(s(h),s(r)),C(n,t)}}}function kn(E){let n,h=`If you are running in a memory constrained environment and/or allow upload of large files, defining the
34            <a href="https://pkg.go.dev/runtime#hdr-Environment_Variables" target="_blank" rel="noopener"><code>GOMEMLIMIT</code></a>
35            environment variable could help preventing out-of-memory (OOM) termination of your process. It is a &quot;soft limit&quot;
36            meaning that the memory usage could still exceed it in some situations, but it instructs the GC to be more
37            &quot;aggressive&quot; and run more often if needed. For example: <code>GOMEMLIMIT=512MiB</code>.`,r,o,d=`If after <code>GOMEMLIMIT</code> you are still experiencing OOM errors, you can try to enable swap
38            partitioning (if not already) or open a
39            <a href="https://github.com/pocketbase/pocketbase/discussions" target="_blank" rel="noopener">Q&amp;A discussion</a>
40            with some steps to reproduce the error in case it is something that we can improve in PocketBase.`;return{c(){n=m("p"),n.innerHTML=h,r=p(),o=m("p"),o.innerHTML=d},l(t){n=c(t,"P",{"data-svelte-h":!0}),v(n)!=="svelte-1uky8le"&&(n.innerHTML=h),r=i(t),o=c(t,"P",{"data-svelte-h":!0}),v(o)!=="svelte-mi4fv8"&&(o.innerHTML=d)},m(t,l){a(t,n,l),a(t,r,l),a(t,o,l)},p:V,d(t){t&&(s(n),s(r),s(o))}}}function Cn(E){let n,h,r,o="optional",d;return n=new X({props:{title:"Set GOMEMLIMIT",tag:"strong"}}),{c(){L(n.$$.fragment),h=p(),r=m("span"),r.textContent=o,this.h()},l(t){T(n.$$.fragment,t),h=i(t),r=c(t,"SPAN",{class:!0,"data-svelte-h":!0}),v(r)!=="svelte-1p4b7fa"&&(r.textContent=o),this.h()},h(){I(r,"class","label label-warning txt-bold m-l-auto")},m(t,l){M(n,t,l),a(t,h,l),a(t,r,l),d=!0},p:V,i(t){d||(P(n.$$.fragment,t),d=!0)},o(t){w(n.$$.fragment,t),d=!1},d(t){t&&(s(h),s(r)),C(n,t)}}}function wn(E){let n,h="It is fine to ignore the below if you are not sure whether you need it.",r,o,d=`By default, PocketBase stores the applications settings in the database as plain JSON text, including the
41            SMTP password and S3 storage credentials.`,t,l,O=`While this is not a security issue on its own (PocketBase applications live entirely on a single server
42            and it is expected only authorized users to have access to your server and application data), in some
43            situations it may be a good idea to store the settings encrypted in case someone get their hands on your
44            database file (e.g. from an external stored backup).`,$,b,A="To store your PocketBase settings encrypted:",B,_,y,g,x,k="set a random 32 characters",S,J,Z,U,Ye,ee,te,je=cn.randomString(32)+"",ne,se,Ve,be,Y,Xe=`Start the application with <code>--encryptionEnv=YOUR_ENV_VAR</code> flag.
45                <br/> <span class="txt-hint">e.g. <code>pocketbase serve --encryptionEnv=PB_ENCRYPTION_KEY</code></span>`;return{c(){n=m("p"),n.textContent=h,r=p(),o=m("p"),o.textContent=d,t=p(),l=m("p"),l.textContent=O,$=p(),b=m("p"),b.textContent=A,B=p(),_=m("ol"),y=m("li"),g=D("Create a new environment variable and "),x=m("strong"),x.textContent=k,S=D(` string as its value.
46                `),J=m("br"),Z=p(),U=m("span"),Ye=D(`e.g. add
47                    `),ee=m("code"),te=D('export PB_ENCRYPTION_KEY="'),ne=D(je),se=D('"'),Ve=D(`
48                    in your shell profile file`),be=p(),Y=m("li"),Y.innerHTML=Xe,this.h()},l(H){n=c(H,"P",{class:!0,"data-svelte-h":!0}),v(n)!=="svelte-bmvz0q"&&(n.textContent=h),r=i(H),o=c(H,"P",{"data-svelte-h":!0}),v(o)!=="svelte-ejvmz3"&&(o.textContent=d),t=i(H),l=c(H,"P",{"data-svelte-h":!0}),v(l)!=="svelte-ywra35"&&(l.textContent=O),$=i(H),b=c(H,"P",{"data-svelte-h":!0}),v(b)!=="svelte-u7lib5"&&(b.textContent=A),B=i(H),_=c(H,"OL",{});var q=N(_);y=c(q,"LI",{class:!0});var re=N(y);g=z(re,"Create a new environment variable and "),x=c(re,"STRONG",{"data-svelte-h":!0}),v(x)!=="svelte-1wjp855"&&(x.textContent=k),S=z(re,` string as its value.
49                `),J=c(re,"BR",{}),Z=i(re),U=c(re,"SPAN",{class:!0});var le=N(U);Ye=z(le,`e.g. add
50                    `),ee=c(le,"CODE",{});var W=N(ee);te=z(W,'export PB_ENCRYPTION_KEY="'),ne=z(W,je),se=z(W,'"'),W.forEach(s),Ve=z(le,`
51                    in your shell profile file`),le.forEach(s),re.forEach(s),be=i(q),Y=c(q,"LI",{"data-svelte-h":!0}),v(Y)!=="svelte-1u1vbj5"&&(Y.innerHTML=Xe),q.forEach(s),this.h()},h(){I(n,"class","txt-bold txt-hint"),I(U,"class","txt-hint"),I(y,"class","m-b-10")},m(H,q){a(H,n,q),a(H,r,q),a(H,o,q),a(H,t,q),a(H,l,q),a(H,$,q),a(H,b,q),a(H,B,q),a(H,_,q),f(_,y),f(y,g),f(y,x),f(y,S),f(y,J),f(y,Z),f(y,U),f(U,Ye),f(U,ee),f(ee,te),f(ee,ne),f(ee,se),f(U,Ve),f(_,be),f(_,Y)},p:V,d(H){H&&(s(n),s(r),s(o),s(t),s(l),s($),s(b),s(B),s(_))}}}function Pn(E){let n,h,r,o="optional",d;return n=new X({props:{title:"Enable settings encryption",tag:"strong"}}),{c(){L(n.$$.fragment),h=p(),r=m("span"),r.textContent=o,this.h()},l(t){T(n.$$.fragment,t),h=i(t),r=c(t,"SPAN",{class:!0,"data-svelte-h":!0}),v(r)!=="svelte-1p4b7fa"&&(r.textContent=o),this.h()},h(){I(r,"class","label label-warning txt-bold m-l-auto")},m(t,l){M(n,t,l),a(t,h,l),a(t,r,l),d=!0},p:V,i(t){d||(P(n.$$.fragment,t),d=!0)},o(t){w(n.$$.fragment,t),d=!1},d(t){t&&(s(h),s(r)),C(n,t)}}}function Mn(E){let n,h,r,o,d,t,l,O=`One of the best PocketBase features is that it&#39;s completely portable. This means that it doesn&#39;t require
52    any external dependency and
53    <strong>could be deployed by just uploading the executable on your server</strong>.`,$,b,A=`Here is an example of starting a production HTTPS server (auto managed TLS with Let's Encrypt) on a clean
54    Ubuntu 22.04 installation.`,B,_,y,g,x="Consider the following app directory structure:",k,S,J,Z,U,Ye=`Upload the binary and anything else required by your application to your remote server, for
55            example using
56            <strong>rsync</strong>:`,ee,te,je,ne,se,Ve="Start a SSH session with your server:",be,Y,Xe,H,q,re="Start the executable (specifying a domain name will issue a Let's encrypt certificate for it)",le,W,kt,_e,We,Gt=`Notice that in the above example we are logged in as <strong>root</strong> which allows us to
57                bind to the
58                <strong>privileged 80 and 443 ports</strong>.
59                <br/>
60                For <strong>non-root</strong> users usually you&#39;ll need special privileges to be able to do
61                that. You have several options depending on your OS 
61- <code>authbind</code>,
62                <code>setcap</code>,
63                <code>iptables</code>, <code>sysctl</code>, etc. Here is an example using <code>setcap</code>:`,Ct,xe,wt,G,Ke,Ft="(Optional) Systemd service",Pt,Qe,Yt=`You can skip step 3 and create a <strong>Systemd service</strong>
64            to allow your application to start/restart on its own.
65            <br/>
66            Here is an example service file (usually created in
67            <code>/lib/systemd/system/pocketbase.service</code>):`,Mt,ye,Tt,Je,jt="After that we just have to enable it and start the service using <code>systemctl</code>:",Lt,ke,Ht,Ce,Ze,Vt=`You can find a link to the Web UI installer in the <code>/root/pb/std.log</code>, but
68                alternatively you can also create the first superuser explicitly via the
69                <code>superuser</code> PocketBase command:`,It,we,st,Pe,rt,Me,Xt=`If you plan on hosting multiple applications on a single server or need finer network controls, you can
70    always put PocketBase behind a reverse proxy such as
71    <em>NGINX</em>, <em>Apache</em>, <em>Caddy</em>, etc.
72    <br/> <em>Just note that when using a reverse proxy you may need to set up the &quot;User IP proxy headers&quot; in the
73        PocketBase settings so that the application can extract and log the actual visitor/client IP (the
74        headers are usually <code>X-Real-IP</code>, <code>X-Forwarded-For</code>).</em>`,at,Te,Wt="Here is a minimal <em>NGINX</em> example configuration:",lt,Le,ot,He,Kt="Corresponding <em>Caddy</em> configuration is:",it,Ie,pt,Se,ut,Ee,Qt=`Some hosts (e.g. <a href="https://fly.io" target="_blank" rel="noopener noreferrer">fly.io</a>) use Docker
75    for deployments. PocketBase doesn&#39;t have an official Docker image, but you could use the below minimal
76    Dockerfile as an example:`,ct,Oe,mt,oe,Jt="To persist your data you need to mount a volume at <code>/pb/pb_data</code>.",ft,ie,Zt=`<em>For a full example you could check the
77        <a href="https://github.com/pocketbase/pocketbase/discussions/537" target="_blank" rel="noopener noreferrer">&quot;Host for free on Fly.io&quot;</a>
78        guide.</em>`,dt,Be,ht,qe,en=`To backup/restore your application it is enough to manually copy/replace your <code>pb_data</code>
79    directory
80    <em>(for transactional safety make sure that the application is not running)</em>.`,$t,K,St,et,tn="Settings",Et,nn=">",Ot,Bt,tt,sn="Backups",qt,gt,pe,rn,vt,Re,an=`Backups can be stored locally (default) or in a S3 compatible storage (<em>it is recommended to use a separate bucket only for the backups</em>). The generated backup represents a full snapshot as ZIP archive of your <code>pb_data</code> directory (including
81    the locally stored uploaded files but excluding any local backups or files uploaded to S3).`,bt,ue,ln=`<div class="icon"><i class="ri-error-warning-line"></i></div> <div class="content"><p class="txt-bold">Please note that during the backup the performance could be slightly degraded and some queries may take longer to complete than usual.</p> <p>Depending on the size of your <code>pb_data</code> this could be a very slow operation and it is
82            advised in case of large <code>pb_data</code> (e.g. 5GB+) to consider a different backup strategy
83            <em class="txt-sm">(see an example
84                <a href="https://github.com/pocketbase/pocketbase/discussions/4254#backups" target="_blank" rel="noopener noreferrer">backup.sh script</a>
85                that combines <code>sqlite3 .backup</code> + <code>rsync</code>)
86            </em>.</p></div>`,_t,Ne,xt,R,ce,Rt,me,Nt,fe,At,de,zt,he,Dt,$e,Ut,ge,yt;return n=new mn({}),r=new X({props:{title:"Deployment strategies"}}),d=new X({props:{title:"Minimal setup",tag:"h5"}}),S=new Q({props:{language:"html",content:`
87                myapp/
88                    pb_migrations/
89                    pb_hooks/
90                    pocketbase
91            `}}),te=new Q({props:{content:`
92                rsync -avz -e ssh /local/path/to/myapp root@YOUR_SERVER_IP:/root/pb
93            `}}),Y=new Q({props:{content:`
94                ssh root@YOUR_SERVER_IP
95            `}}),W=new Q({props:{content:`
96              [root@dev ~]$ /root/pb/pocketbase serve yourdomain.com
97            `}}),xe=new Q({props:{content:`
98                    [myuser@dev ~]$ sudo setcap 'cap_net_bind_service=+ep' /root/pb/pocketbase
99                `}}),ye=new Q({props:{content:`
100                [Unit]
101                Description = pocketbase
102
103                [Service]
104                Type             = simple
105                User             = root
106                Group            = root
107                LimitNOFILE      = 4096
108                Restart          = always
109                RestartSec       = 5s
110                StandardOutput   = append:/root/pb/std.log
111                StandardError    = append:/root/pb/std.log
112                WorkingDirectory = /root/pb
113                ExecStart        = /root/pb/pocketbase serve yourdomain.com
114
115                [Install]
116                WantedBy = multi-user.target
117            `}}),ke=new Q({props:{content:`
118                [root@dev ~]$ systemctl enable pocketbase.service
119                [root@dev ~]$ systemctl start pocketbase
120            `}}),we=new Q({props:{content:`
121                    [root@dev ~]$ /root/pb/pocketbase superuser create EMAIL PASS
122                `}}),Pe=new X({props:{title:"Using reverse proxy",tag:"h5"}}),Le=new Q({props:{language:"html",content:`
123    server {
124        listen 80;
125        server_name example.com;
126        client_max_body_size 10M;
127
128        location / {
129            # check http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
130            proxy_set_header Connection '';
131            proxy_http_version 1.1;
132            proxy_read_timeout 360s;
133
134            proxy_set_header Host $host;
135            proxy_set_header X-Real-IP $remote_addr;
136            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
137            proxy_set_header X-Forwarded-Proto $scheme;
138
139            # enable if you are serving under a subpath location
140            #
141            # note that it is better to use a subdomain when possible because of
142            # the same-origin isolation for localStorage and other resources
143            # rewrite /yourSubpath/(.*) /$1  break;
144
145            proxy_pass http://127.0.0.1:8090;
146        }
147    }
148    `}}),Ie=new Q({props:{language:"html",content:`
149    example.com {
150        request_body {
151            max_size 10MB
152        }
153        reverse_proxy 127.0.0.1:8090 {
154            transport http {
155                read_timeout 360s
156            }
157        }
158    }
159    `}}),Se=new X({props:{title:"Using Docker",tag:"h5"}}),Oe=new Q({props:{language:"html",content:`
160        FROM alpine:latest
161
162        ARG PB_VERSION=`+("v0.40.4".startsWith("v")?"v0.40.4".substring(1):"v0.40.4")+`
163
164        RUN apk add --no-cache \\
165            unzip \\
166            ca-certificates
167
168        # download and unzip PocketBase
169        ADD https://github.com/pocketbase/pocketbase/releases/download/v\${PB_VERSION}/pocketbase_\${PB_VERSION}_linux_amd64.zip /tmp/pb.zip
170        RUN unzip /tmp/pb.zip -d /pb/
171
172        # uncomment to copy the local pb_migrations dir into the image
173        # COPY ./pb_migrations /pb/pb_migrations
174
175        # uncomment to copy the local pb_hooks dir into the image
176        # COPY ./pb_hooks /pb/pb_hooks
177
178        EXPOSE 8080
179
180        # start PocketBase
181        CMD ["/pb/pocketbase", "serve", "--http=0.0.0.0:8080"]
182    `}}),Be=new X({props:{title:"Backup and Restore"}}),Ne=new X({props:{title:"Recommendations"}}),ce=new Fe({props:{single:!0,$$slots:{header:[dn],default:[fn]},$$scope:{ctx:E}}}),me=new Fe({props:{single:!0,$$slots:{header:[$n],default:[hn]},$$scope:{ctx:E}}}),fe=new Fe({props:{single:!0,$$slots:{header:[vn],default:[gn]},$$scope:{ctx:E}}}),de=new Fe({props:{single:!0,$$slots:{header:[_n],default:[bn]},$$scope:{ctx:E}}}),he=new Fe({props:{single:!0,$$slots:{header:[yn],default:[xn]},$$scope:{ctx:E}}}),$e=new Fe({props:{single:!0,$$slots:{header:[Cn],default:[kn]},$$scope:{ctx:E}}}),ge=new Fe({props:{single:!0,$$slots:{header:[Pn],default:[wn]},$$scope:{ctx:E}}}),{c(){L(n.$$.fragment),h=p(),L(r.$$.fragment),o=p(),L(d.$$.fragment),t=p(),l=m("p"),l.innerHTML=O,$=p(),b=m("p"),b.textContent=A,B=p(),_=m("ol"),y=m("li"),g=m("p"),g.textContent=x,k=p(),L(S.$$.fragment),J=p(),Z=m("li"),U=m("p"),U.innerHTML=Ye,ee=p(),L(te.$$.fragment),je=p(),ne=m("li"),se=m("p"),se.textContent=Ve,be=p(),L(Y.$$.fragment),Xe=p(),H=m("li"),q=m("p"),q.textContent=re,le=p(),L(W.$$.fragment),kt=p(),_e=m("blockquote"),We=m("p"),We.innerHTML=Gt,Ct=p(),L(xe.$$.fragment),wt=p(),G=m("li"),Ke=m("p"),Ke.textContent=Ft,Pt=p(),Qe=m("p"),Qe.innerHTML=Yt,Mt=p(),L(ye.$$.fragment),Tt=p(),Je=m("p"),Je.innerHTML=jt,Lt=p(),L(ke.$$.fragment),Ht=p(),Ce=m("blockquote"),Ze=m("p"),Ze.innerHTML=Vt,It=p(),L(we.$$.fragment),st=p(),L(Pe.$$.fragment),rt=p(),Me=m("p"),Me.innerHTML=Xt,at=p(),Te=m("p"),Te.innerHTML=Wt,lt=p(),L(Le.$$.fragment),ot=p(),He=m("p"),He.innerHTML=Kt,it=p(),L(Ie.$$.fragment),pt=p(),L(Se.$$.fragment),ut=p(),Ee=m("p"),Ee.innerHTML=Qt,ct=p(),L(Oe.$$.fragment),mt=p(),oe=m("p"),oe.innerHTML=Jt,ft=p(),ie=m("p"),ie.innerHTML=Zt,dt=p(),L(Be.$$.fragment),ht=p(),qe=m("p"),qe.innerHTML=en,$t=p(),K=m("p"),St=D(`To make things slightly easier, PocketBase v0.16+ comes with builtin backups and restore APIs that could
183    be accessed from the Dashboard (
184    `),et=m("em"),et.textContent=tn,Et=p(),Ot=D(nn),Bt=p(),tt=m("em"),tt.textContent=sn,qt=D(`
185    ):`),gt=p(),pe=m("img"),vt=p(),Re=m("p"),Re.innerHTML=an,bt=p(),ue=m("div"),ue.innerHTML=ln,_t=p(),L(Ne.$$.fragment),xt=p(),R=m("div"),L(ce.$$.fragment),Rt=p(),L(me.$$.fragment),Nt=p(),L(fe.$$.fragment),At=p(),L(de.$$.fragment),zt=p(),L(he.$$.fragment),Dt=p(),L($e.$$.fragment),Ut=p(),L(ge.$$.fragment),this.h()},l(e){T(n.$$.fragment,e),h=i(e),T(r.$$.fragment,e),o=i(e),T(d.$$.fragment,e),t=i(e),l=c(e,"P",{"data-svelte-h":!0}),v(l)!=="svelte-1u4aub4"&&(l.innerHTML=O),$=i(e),b=c(e,"P",{"data-svelte-h":!0}),v(b)!=="svelte-1lxik3s"&&(b.textContent=A),B=i(e),_=c(e,"OL",{});var u=N(_);y=c(u,"LI",{});var Ae=N(y);g=c(Ae,"P",{"data-svelte-h":!0}),v(g)!=="svelte-r5oc0s"&&(g.textContent=x),k=i(Ae),T(S.$$.fragment,Ae),Ae.forEach(s),J=i(u),Z=c(u,"LI",{});var ze=N(Z);U=c(ze,"P",{"data-svelte-h":!0}),v(U)!=="svelte-qiypfw"&&(U.innerHTML=Ye),ee=i(ze),T(te.$$.fragment,ze),ze.forEach(s),je=i(u),ne=c(u,"LI",{});var De=N(ne);se=c(De,"P",{"data-svelte-h":!0}),v(se)!=="svelte-a9mlxl"&&(se.textContent=Ve),be=i(De),T(Y.$$.fragment,De),De.forEach(s),Xe=i(u),H=c(u,"LI",{});var ae=N(H);q=c(ae,"P",{"data-svelte-h":!0}),v(q)!=="svelte-edfwua"&&(q.textContent=re),le=i(ae),T(W.$$.fragment,ae),kt=i(ae),_e=c(ae,"BLOCKQUOTE",{});var Ue=N(_e);We=c(Ue,"P",{"data-svelte-h":!0}),v(We)!=="svelte-h6xbpg"&&(We.innerHTML=Gt),Ct=i(Ue),T(xe.$$.fragment,Ue),Ue.forEach(s),ae.forEach(s),wt=i(u),G=c(u,"LI",{});var F=N(G);Ke=c(F,"P",{"data-svelte-h":!0}
185),v(Ke)!=="svelte-1bafj7x"&&(Ke.textContent=Ft),Pt=i(F),Qe=c(F,"P",{"data-svelte-h":!0}),v(Qe)!=="svelte-119pyzh"&&(Qe.innerHTML=Yt),Mt=i(F),T(ye.$$.fragment,F),Tt=i(F),Je=c(F,"P",{"data-svelte-h":!0}),v(Je)!=="svelte-xrof42"&&(Je.innerHTML=jt),Lt=i(F),T(ke.$$.fragment,F),Ht=i(F),Ce=c(F,"BLOCKQUOTE",{});var Ge=N(Ce);Ze=c(Ge,"P",{"data-svelte-h":!0}),v(Ze)!=="svelte-1nv9bc5"&&(Ze.innerHTML=Vt),It=i(Ge),T(we.$$.fragment,Ge),Ge.forEach(s),F.forEach(s),u.forEach(s),st=i(e),T(Pe.$$.fragment,e),rt=i(e),Me=c(e,"P",{"data-svelte-h":!0}),v(Me)!=="svelte-13xvg3j"&&(Me.innerHTML=Xt),at=i(e),Te=c(e,"P",{"data-svelte-h":!0}),v(Te)!=="svelte-i5yqa3"&&(Te.innerHTML=Wt),lt=i(e),T(Le.$$.fragment,e),ot=i(e),He=c(e,"P",{"data-svelte-h":!0}),v(He)!=="svelte-wxqarr"&&(He.innerHTML=Kt),it=i(e),T(Ie.$$.fragment,e),pt=i(e),T(Se.$$.fragment,e),ut=i(e),Ee=c(e,"P",{"data-svelte-h":!0}),v(Ee)!=="svelte-edle8j"&&(Ee.innerHTML=Qt),ct=i(e),T(Oe.$$.fragment,e),mt=i(e),oe=c(e,"P",{class:!0,"data-svelte-h":!0}),v(oe)!=="svelte-1twozwg"&&(oe.innerHTML=Jt),ft=i(e),ie=c(e,"P",{class:!0,"data-svelte-h":!0}),v(ie)!=="svelte-116956o"&&(ie.innerHTML=Zt),dt=i(e),T(Be.$$.fragment,e),ht=i(e),qe=c(e,"P",{"data-svelte-h":!0}),v(qe)!=="svelte-5xic0z"&&(qe.innerHTML=en),$t=i(e),K=c(e,"P",{});var ve=N(K);St=z(ve,`To make things slightly easier, PocketBase v0.16+ comes with builtin backups and restore APIs that could
186    be accessed from the Dashboard (
187    `),et=c(ve,"EM",{"data-svelte-h":!0}),v(et)!=="svelte-5h5n3z"&&(et.textContent=tn),Et=i(ve),Ot=z(ve,nn),Bt=i(ve),tt=c(ve,"EM",{"data-svelte-h":!0}),v(tt)!=="svelte-1gmx8n3"&&(tt.textContent=sn),qt=z(ve,`
188    ):`),ve.forEach(s),gt=i(e),pe=c(e,"IMG",{src:!0,alt:!0,class:!0}),vt=i(e),Re=c(e,"P",{"data-svelte-h":!0}),v(Re)!=="svelte-6t1z69"&&(Re.innerHTML=an),bt=i(e),ue=c(e,"DIV",{class:!0,"data-svelte-h":!0}),v(ue)!=="svelte-1i76v7k"&&(ue.innerHTML=ln),_t=i(e),T(Ne.$$.fragment,e),xt=i(e),R=c(e,"DIV",{class:!0});var j=N(R);T(ce.$$.fragment,j),Rt=i(j),T(me.$$.fragment,j),Nt=i(j),T(fe.$$.fragment,j),At=i(j),T(de.$$.fragment,j),zt=i(j),T(he.$$.fragment,j),Dt=i(j),T($e.$$.fragment,j),Ut=i(j),T(ge.$$.fragment,j),j.forEach(s),this.h()},h(){y.value="0",I(oe,"class","txt-bold"),I(ie,"class","txt-hint"),nt(pe.src,rn="/images/screenshots/backups.png")||I(pe,"src",rn),I(pe,"alt","Backups settings screenshot"),I(pe,"class","screenshot m-b-xs"),I(ue,"class","alert alert-warning m-b-xs"),I(R,"class","accordions")},m(e,u){M(n,e,u),a(e,h,u),M(r,e,u),a(e,o,u),M(d,e,u),a(e,t,u),a(e,l,u),a(e,$,u),a(e,b,u),a(e,B,u),a(e,_,u),f(_,y),f(y,g),f(y,k),M(S,y,null),f(_,J),f(_,Z),f(Z,U),f(Z,ee),M(te,Z,null),f(_,je),f(_,ne),f(ne,se),f(ne,be),M(Y,ne,null),f(_,Xe),f(_,H),f(H,q),f(H,le),M(W,H,null),f(H,kt),f(H,_e),f(_e,We),f(_e,Ct),M(xe,_e,null),f(_,wt),f(_,G),f(G,Ke),f(G,Pt),f(G,Qe),f(G,Mt),M(ye,G,null),f(G,Tt),f(G,Je),f(G,Lt),M(ke,G,null),f(G,Ht),f(G,Ce),f(Ce,Ze),f(Ce,It),M(we,Ce,null),a(e,st,u),M(Pe,e,u),a(e,rt,u),a(e,Me,u),a(e,at,u),a(e,Te,u),a(e,lt,u),M(Le,e,u),a(e,ot,u),a(e,He,u),a(e,it,u),M(Ie,e,u),a(e,pt,u),M(Se,e,u),a(e,ut,u),a(e,Ee,u),a(e,ct,u),M(Oe,e,u),a(e,mt,u),a(e,oe,u),a(e,ft,u),a(e,ie,u),a(e,dt,u),M(Be,e,u),a(e,ht,u),a(e,qe,u),a(e,$t,u),a(e,K,u),f(K,St),f(K,et),f(K,Et),f(K,Ot),f(K,Bt),f(K,tt),f(K,qt),a(e,gt,u),a(e,pe,u),a(e,vt,u),a(e,Re,u),a(e,bt,u),a(e,ue,u),a(e,_t,u),M(Ne,e,u),a(e,xt,u),a(e,R,u),M(ce,R,null),f(R,Rt),M(me,R,null),f(R,Nt),M(fe,R,null),f(R,At),M(de,R,null),f(R,zt),M(he,R,null),f(R,Dt),M($e,R,null),f(R,Ut),M(ge,R,null),yt=!0},p(e,[u]){const Ae={};u&1&&(Ae.$$scope={dirty:u,ctx:e}),ce.$set(Ae);const ze={};u&1&&(ze.$$scope={dirty:u,ctx:e}),me.$set(ze);const De={};u&1&&(De.$$scope={dirty:u,ctx:e}),fe.$set(De);const ae={};u&1&&(ae.$$scope={dirty:u,ctx:e}),de.$set(ae);const Ue={};u&1&&(Ue.$$scope={dirty:u,ctx:e}),he.$set(Ue);const F={};u&1&&(F.$$scope={dirty:u,ctx:e}),$e.$set(F);const Ge={};u&1&&(Ge.$$scope={dirty:u,ctx:e}),ge.$set(Ge)},i(e){yt||(P(n.$$.fragment,e),P(r.$$.fragment,e),P(d.$$.fragment,e),P(S.$$.fragment,e),P(te.$$.fragment,e),P(Y.$$.fragment,e),P(W.$$.fragment,e),P(xe.$$.fragment,e),P(ye.$$.fragment,e),P(ke.$$.fragment,e),P(we.$$.fragment,e),P(Pe.$$.fragment,e),P(Le.$$.fragment,e),P(Ie.$$.fragment,e),P(Se.$$.fragment,e),P(Oe.$$.fragment,e),P(Be.$$.fragment,e),P(Ne.$$.fragment,e),P(ce.$$.fragment,e),P(me.$$.fragment,e),P(fe.$$.fragment,e),P(de.$$.fragment,e),P(he.$$.fragment,e),P($e.$$.fragment,e),P(ge.$$.fragment,e),yt=!0)},o(e){w(n.$$.fragment,e),w(r.$$.fragment,e),w(d.$$.fragment,e),w(S.$$.fragment,e),w(te.$$.fragment,e),w(Y.$$.fragment,e),w(W.$$.fragment,e),w(xe.$$.fragment,e),w(ye.$$.fragment,e),w(ke.$$.fragment,e),w(we.$$.fragment,e),w(Pe.$$.fragment,e),w(Le.$$.fragment,e),w(Ie.$$.fragment,e),w(Se.$$.fragment,e),w(Oe.$$.fragment,e),w(Be.$$.fragment,e),w(Ne.$$.fragment,e),w(ce.$$.fragment,e),w(me.$$.fragment,e),w(fe.$$.fragment,e),w(de.$$.fragment,e),w(he.$$.fragment,e),w($e.$$.fragment,e),w(ge.$$.fragment,e),yt=!1},d(e){e&&(s(h),s(o),s(t),s(l),s($),s(b),s(B),s(_),s(st),s(rt),s(Me),s(at),s(Te),s(lt),s(ot),s(He),s(it),s(pt),s(ut),s(Ee),s(ct),s(mt),s(oe),s(ft),s(ie),s(dt),s(ht),s(qe),s($t),s(K),s(gt),s(pe),s(vt),s(Re),s(bt),s(ue),s(_t),s(xt),s(R)),C(n,e),C(r,e),C(d,e),C(S),C(te),C(Y),C(W),C(xe),C(ye),C(ke),C(we),C(Pe,e),C(Le,e),C(Ie,e),C(Se,e),C(Oe,e),C(Be,e),C(Ne,e),C(ce),C(me),C(fe),C(de),C(he),C($e),C(ge)}}}class Bn extends pn{constructor(n){super(),un(this,n,null,Mn,on,{})}}export{Bn as component};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.