Files
OpenSign/assets/js/489b8a4d.f3a59ead.js
T

1 line
9.8 KiB
JavaScript

"use strict";(self.webpackChunkOpenSign_Docs=self.webpackChunkOpenSign_Docs||[]).push([[8781],{44907:(e,s,t)=>{t.r(s),t.d(s,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>c,metadata:()=>o,toc:()=>l});var n=t(85893),r=t(11151);const c={},i=void 0,o={id:"self-host/docker/run-locally",title:"run-locally",description:"Localhost(Docker)",source:"@site/docs/self-host/docker/run-locally.md",sourceDirName:"self-host/docker",slug:"/self-host/docker/run-locally",permalink:"/docs/self-host/docker/run-locally",draft:!1,unlisted:!1,editUrl:"https://github.com/opensignlabs/opensign/tree/feat-docs/docs/docs/self-host/docker/run-locally.md",tags:[],version:"current",frontMatter:{},sidebar:"selfhostSidebar",previous:{title:"Docker",permalink:"/docs/category/docker"},next:{title:"Digital Ocean",permalink:"/docs/self-host/One-click-Install/DigitalOcean"}},d={},l=[{value:"Localhost(Docker)",id:"localhostdocker",level:2}];function a(e){const s={a:"a",code:"code",h1:"h1",h2:"h2",li:"li",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.a)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s.h2,{id:"localhostdocker",children:"Localhost(Docker)"}),"\n",(0,n.jsx)(s.p,{children:"For local Setup we need to need following prerequisite:"}),"\n",(0,n.jsx)(s.p,{children:"Environment Varaibles:"}),"\n",(0,n.jsxs)(s.table,{children:[(0,n.jsx)(s.thead,{children:(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.th,{children:"Environment Varibale"}),(0,n.jsx)(s.th,{children:"Value"}),(0,n.jsx)(s.th,{children:"Description"})]})}),(0,n.jsxs)(s.tbody,{children:[(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"CI"}),(0,n.jsx)(s.td,{children:"false"}),(0,n.jsx)(s.td,{children:"Set CI to false while running the app locally"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"PUBLIC_URL"}),(0,n.jsx)(s.td,{children:(0,n.jsx)(s.a,{href:"http://localhost:3000",children:"http://localhost:3000"})}),(0,n.jsx)(s.td,{children:"Set it to the URL form where the app home page will be accessed"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"GENERATE_SOURCEMAP"}),(0,n.jsx)(s.td,{children:"false"}),(0,n.jsx)(s.td,{children:"Set it to true if you want to generate the Sourcemap for debugging"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"REACT_APP_SERVERURL"}),(0,n.jsx)(s.td,{children:(0,n.jsx)(s.a,{href:"http://localhost:8080/app",children:"http://localhost:8080/app"})}),(0,n.jsx)(s.td,{children:"Set it to the URL from where APIs will be accessible, for local development it should be localhost:3000/api/app (use your local port number instead)"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"REACT_APP_APPID"}),(0,n.jsx)(s.td,{children:"opensignstgn"}),(0,n.jsx)(s.td,{children:"A 12 character long random app identifier. The value of this should be same as APP_ID which is a variable used by backend API."})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"APP_ID"}),(0,n.jsx)(s.td,{children:"opensignstgn"}),(0,n.jsx)(s.td,{children:"A 12 character long random app identifier. The value of this should be same as REACT_APP_APPID which is a variable used by Frontend React App."})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"appName"}),(0,n.jsx)(s.td,{children:"open_sign_server"}),(0,n.jsx)(s.td,{children:"Name of the app. It will be visible in the verification emails sent out."})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"MASTER_KEY"}),(0,n.jsx)(s.td,{children:"XnAadwKxxByMr"}),(0,n.jsx)(s.td,{children:"A 12 character long random secret key that allows access to all the data. It is used in Parse dashboard config to view all the data in the database."})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"MONGODB_URI"}),(0,n.jsx)(s.td,{children:"mongodb://host.docker.internal:27017/OpenSignDB"}),(0,n.jsx)(s.td,{children:"Mongodb URI to connect to"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"PARSE_MOUNT"}),(0,n.jsx)(s.td,{children:"/app"}),(0,n.jsx)(s.td,{children:"Path on which APIs should be mounted. Do not change this. This variable shall be removed & value hardcoded in the source code in coming versions."})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"SERVER_URL"}),(0,n.jsx)(s.td,{children:(0,n.jsx)(s.a,{href:"http://127.0.0.1:8080/app",children:"http://127.0.0.1:8080/app"})}),(0,n.jsx)(s.td,{children:"Set it to the URL from where APIs will be accessible to the NodeJS functions, for local development it should be localhost:3000/api/app (use your local port number instead)"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"DO_SPACE"}),(0,n.jsx)(s.td,{children:"DOSPACENAME"}),(0,n.jsx)(s.td,{children:"Digital ocean space name or AWS S3 bucket name for uploading documents"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"DO_ENDPOINT"}),(0,n.jsx)(s.td,{children:"ams3.digitaloceanspaces.com"}),(0,n.jsx)(s.td,{children:"Digital ocean spaces endpoint or AWS S3 endpoint for uploading documents"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"DO_BASEURL"}),(0,n.jsx)(s.td,{children:(0,n.jsx)(s.a,{href:"https://DOSPACENAME.ams3.digitaloceanspaces.com",children:"https://DOSPACENAME.ams3.digitaloceanspaces.com"})}),(0,n.jsx)(s.td,{children:"Digital ocean baseurl or AWS S3 base URL"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"DO_ACCESS_KEY_ID"}),(0,n.jsx)(s.td,{children:"YOUR_S3_ACCESS_ID"}),(0,n.jsx)(s.td,{children:"Digital ocean spaces access key ID or AWS s3 Access key ID for uploading the docs"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"DO_SECRET_ACCESS_KEY"}),(0,n.jsx)(s.td,{children:"YOUR_S3_ACCESS_KEY"}),(0,n.jsx)(s.td,{children:"Digital ocean spaces secret access key or AWS s3 secret access key for uploading the docs"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"DO_REGION"}),(0,n.jsx)(s.td,{children:"YOUR_S3_REGION"}),(0,n.jsx)(s.td,{children:"Digital ocean spaces region or AWS s3 region"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"USE_LOCAL"}),(0,n.jsx)(s.td,{children:"FALSE"}),(0,n.jsx)(s.td,{children:"To use local file storage to save file"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"MAILGUN_API_KEY"}),(0,n.jsx)(s.td,{children:"YOUR_MAILGUNAPI_KEY"}),(0,n.jsx)(s.td,{children:"Mailgun API Key"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"MAILGUN_DOMAIN"}),(0,n.jsx)(s.td,{children:"YOUR_MAILGUNAPI_DOMAIN"}),(0,n.jsx)(s.td,{children:"Mailgun API Domain"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"MAILGUN_SENDER"}),(0,n.jsx)(s.td,{children:"-"}),(0,n.jsx)(s.td,{children:"Mailgun Sender Mail ID"})]}),(0,n.jsxs)(s.tr,{children:[(0,n.jsx)(s.td,{children:"PFX_BASE64"}),(0,n.jsx)(s.td,{children:"-"}),(0,n.jsxs)(s.td,{children:["Base64 encoded PFX or p12 document signing certificate file. You can generate base64 encoded self sign certificate using the passphrase ",(0,n.jsx)(s.code,{children:"emudhra"})]})]})]})]}),"\n",(0,n.jsx)(s.h1,{id:"steps-to-generate-self-sign-certificate",children:"Steps to Generate Self Sign Certificate"}),"\n",(0,n.jsx)(s.pre,{children:(0,n.jsx)(s.code,{children:"# execute below command and use passphrase emudhra\nopenssl genrsa -des3 -out ./cert/local_dev.key 2048\nopenssl req -key ./cert/local_dev.key -new -x509 -days 365 -out ./cert/local_dev.crt\nopenssl pkcs12 -inkey ./cert/local_dev.key -in ./cert/local_dev.crt -export -out ./cert/local_dev.pfx\nopenssl base64 -in ./cert/local_dev.pfx -out ./cert/base64_pfx\n"})}),"\n",(0,n.jsx)(s.h1,{id:"cors-configuration",children:"CORS Configuration"}),"\n",(0,n.jsxs)(s.p,{children:["As document storage is delegated to S3-compatible services that reside in a different host than the OpenSign one, document operations (loading, storing, deleting) are subject to ",(0,n.jsx)(s.a,{href:"https://en.wikipedia.org/wiki/Cross-origin_resource_sharing",children:"Cross-Origin Resource Sharing"})," restriction policies; as a consequence, OpenSign app may fail with (browser console) errors like the following:"]}),"\n",(0,n.jsx)(s.pre,{children:(0,n.jsx)(s.code,{children:"Access to fetch at 'https://foo.nyc3.digitaloceanspaces.com/exported_file_4627_0000-00-00T00%3A45%3A43.344Z.pdf'\nfrom origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header\nis present on the requested resource. If an opaque response serves your needs, set the request's mode to\n'no-cors' to fetch the resource with CORS disabled.\n"})}),"\n",(0,n.jsx)(s.p,{children:"In order to address this, your document storage system must be instructed to accept requests from other hosts; below the relevant documentation links:"}),"\n",(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsx)(s.li,{children:(0,n.jsx)(s.a,{href:"https://docs.digitalocean.com/products/spaces/how-to/configure-cors/",children:"How to Configure CORS on DigitalOcean Spaces"})}),"\n",(0,n.jsx)(s.li,{children:(0,n.jsx)(s.a,{href:"https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html",children:"Configuring cross-origin resource sharing on AWS S3"})}),"\n"]}),"\n",(0,n.jsx)(s.h1,{id:"build-local-environment",children:"Build Local Environment"}),"\n",(0,n.jsx)(s.p,{children:"Command to build project -"}),"\n",(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsxs)(s.li,{children:["Execute ",(0,n.jsx)(s.code,{children:"make build"})]}),"\n"]}),"\n",(0,n.jsx)(s.p,{children:"Command to run project -"}),"\n",(0,n.jsxs)(s.ul,{children:["\n",(0,n.jsxs)(s.li,{children:["Execute ",(0,n.jsx)(s.code,{children:"make run"})]}),"\n"]})]})}function h(e={}){const{wrapper:s}={...(0,r.a)(),...e.components};return s?(0,n.jsx)(s,{...e,children:(0,n.jsx)(a,{...e})}):a(e)}},11151:(e,s,t)=>{t.d(s,{Z:()=>o,a:()=>i});var n=t(67294);const r={},c=n.createContext(r);function i(e){const s=n.useContext(c);return n.useMemo((function(){return"function"==typeof e?e(s):{...s,...e}}),[s,e])}function o(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(c.Provider,{value:s},e.children)}}}]);