mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-31 20:29:40 +02:00
1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
"use strict";(self.webpackChunkOpenSign_Docs=self.webpackChunkOpenSign_Docs||[]).push([[8781],{44907:(e,n,t)=>{t.r(n),t.d(n,{assets:()=>a,contentTitle:()=>l,default:()=>x,frontMatter:()=>c,metadata:()=>d,toc:()=>h});var s=t(85893),i=t(11151),o=t(22004),r=t.n(o);const c={title:"Localhost Setup with Docker"},l=void 0,d={id:"self-host/docker/run-locally",title:"Localhost Setup with Docker",description:"Steps to run OpenSign\u2122 with docker in macos/linux:",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:{title:"Localhost Setup with Docker"},sidebar:"selfhostSidebar",previous:{title:"Docker",permalink:"/docs/category/docker"},next:{title:"Digital Ocean",permalink:"/docs/self-host/One-click-Install/DigitalOcean"}},a={},h=[{value:"Steps to run OpenSign\u2122 with docker in macos/linux:",id:"steps-to-run-opensign-with-docker-in-macoslinux",level:2},{value:"Steps to run OpenSign\u2122 with docker in windows:",id:"steps-to-run-opensign-with-docker-in-windows",level:2},{value:"Information About ENV variables which are used to setup OpenSign\u2122 with Docker on Localhost",id:"information-about-env-variables-which-are-used-to-setup-opensign-with-docker-on-localhost",level:2}];function p(e){const n={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,i.a)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"steps-to-run-opensign-with-docker-in-macoslinux",children:"Steps to run OpenSign\u2122 with docker in macos/linux:"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsx)(n.li,{children:"Firstly install docker and make sure it is running while moving to next steps."}),"\n",(0,s.jsxs)(n.li,{children:["Now open terminal then type ",(0,s.jsx)(n.code,{children:"git clone https://github.com/OpenSignLabs/OpenSign"})," and hit ",(0,s.jsx)(n.code,{children:"Enter"})," it will clone OpenSign project in your local."]}),"\n",(0,s.jsxs)(n.li,{children:["Then type ",(0,s.jsx)(n.code,{children:"cd OpenSign"})," command and hit ",(0,s.jsx)(n.code,{children:"Enter"})," it will open OpenSign project in terminal."]}),"\n",(0,s.jsxs)(n.li,{children:["Then type ",(0,s.jsx)(n.code,{children:"make build"})," command it will start create container image. It will take sometime to build and start."]}),"\n",(0,s.jsx)(n.li,{children:"Next time if you want to run docker image just open docker and run opensign container by clicking on play button from actions."}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.em,{children:"Note: If you want our updated feature in your docker container just delete opensign container and just follow steps again."})}),"\n",(0,s.jsx)(n.h2,{id:"steps-to-run-opensign-with-docker-in-windows",children:"Steps to run OpenSign\u2122 with docker in windows:"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsx)(n.li,{children:"Setup WSL 2 in windows. To install WSL 2 refer below video"}),"\n"]}),"\n",(0,s.jsx)("div",{children:(0,s.jsx)(r(),{playing:!0,controls:!0,url:"https://youtu.be/1kFFwknneD8?si=FKriXPwFqZPLUagI"})}),"\n",(0,s.jsxs)(n.ol,{start:"2",children:["\n",(0,s.jsx)(n.li,{children:"Now install docker desktop in windows and open docker desktop."}),"\n",(0,s.jsxs)(n.li,{children:["Enable wsl in docker desktop by moving on this location ",(0,s.jsx)(n.code,{children:"Setting > Resources > WSL Inegration"})," and click on check box and then click on ",(0,s.jsx)(n.code,{children:"apply & restart"})," button and now minimize it."]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:"https://legadratw3d.ams3.cdn.digitaloceanspaces.com/Screenshot%202024-02-23%20201448.png",alt:"docker"})}),"\n",(0,s.jsxs)(n.ol,{start:"4",children:["\n",(0,s.jsxs)(n.li,{children:["Go to your desired destination in your windows then open powershell in that folder using ",(0,s.jsx)(n.code,{children:"Shift + right click of mouse"})," and select ",(0,s.jsx)(n.code,{children:"Open Powershell window here"})," from options."]}),"\n",(0,s.jsxs)(n.li,{children:["Open powershell and type ",(0,s.jsx)(n.code,{children:"git clone https://github.com/OpenSignLabs/OpenSign"})," and hit ",(0,s.jsx)(n.code,{children:"Enter"})," it will clone OpenSign project in you local."]}),"\n",(0,s.jsxs)(n.li,{children:["Then open OpenSign folder with vs code and go to ",(0,s.jsx)(n.code,{children:"apps > mongo > mongo-init.sh"})," and change type of this file from ",(0,s.jsx)(n.code,{children:"CRLF"})," to ",(0,s.jsx)(n.code,{children:"LF"})," and then save this file and close vs code."]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:"https://legadratw3d.ams3.cdn.digitaloceanspaces.com/Screenshot%202024-02-23%20175944.png",alt:"docker"})}),"\n",(0,s.jsxs)(n.ol,{start:"7",children:["\n",(0,s.jsxs)(n.li,{children:["Open ubuntu/WSL terminal and write command to navigate to folder where you have clone OpenSign project for e.g. ",(0,s.jsx)(n.code,{children:"cd mnt/c/testing/docker/OpenSign"})," and hit ",(0,s.jsx)(n.code,{children:"Enter"}),"."]}),"\n",(0,s.jsxs)(n.li,{children:["Now type command ",(0,s.jsx)(n.code,{children:"Make build"})," and it will start build image for docker, it will take some time to build and start. for more specific steps watch below video."]}),"\n",(0,s.jsx)(n.li,{children:"Next time if you want to run docker image just open docker and run opensign container by clicking on play button from actions."}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:(0,s.jsx)(n.em,{children:"Note: If you want our updated feature in your docker container just delete opensign container and just follow steps from 2 step again."})}),"\n",(0,s.jsx)("div",{children:(0,s.jsx)(r(),{playing:!0,controls:!0,url:"https://www.youtube.com/watch?v=GY_OP697EiU"})}),"\n",(0,s.jsx)(n.h2,{id:"information-about-env-variables-which-are-used-to-setup-opensign-with-docker-on-localhost",children:"Information About ENV variables which are used to setup OpenSign\u2122 with Docker on Localhost"}),"\n",(0,s.jsx)(n.p,{children:"To set up OpenSign\u2122 locally using Docker, the following prerequisites are required:"}),"\n",(0,s.jsx)(n.p,{children:"Environment Varaibles:"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Environment Varibale"}),(0,s.jsx)(n.th,{children:"Value"}),(0,s.jsx)(n.th,{children:"Description"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"CI"}),(0,s.jsx)(n.td,{children:"false"}),(0,s.jsx)(n.td,{children:"Set CI to false while running the app locally"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"PUBLIC_URL"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.a,{href:"http://localhost:3000",children:"http://localhost:3000"})}),(0,s.jsx)(n.td,{children:"Set it to the URL form where the app home page will be accessed"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"GENERATE_SOURCEMAP"}),(0,s.jsx)(n.td,{children:"false"}),(0,s.jsx)(n.td,{children:"Set it to true if you want to generate the Sourcemap for debugging"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"REACT_APP_SERVERURL"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.a,{href:"http://localhost:8080/app",children:"http://localhost:8080/app"})}),(0,s.jsx)(n.td,{children:"Set it to the URL from where APIs will be accessible, for local development it should be localhost:8080/app (use your local port number instead)"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"REACT_APP_APPID"}),(0,s.jsx)(n.td,{children:"opensignstgn"}),(0,s.jsx)(n.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,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"APP_ID"}),(0,s.jsx)(n.td,{children:"opensignstgn"}),(0,s.jsx)(n.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,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"appName"}),(0,s.jsx)(n.td,{children:"open_sign_server"}),(0,s.jsx)(n.td,{children:"Name of the app. It will be visible in the verification emails sent out."})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"MASTER_KEY"}),(0,s.jsx)(n.td,{children:"XnAadwKxxByMr"}),(0,s.jsx)(n.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,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"MONGODB_URI"}),(0,s.jsx)(n.td,{children:"mongodb://host.docker.internal:27017/OpenSignDB"}),(0,s.jsx)(n.td,{children:"Mongodb URI to connect to"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"PARSE_MOUNT"}),(0,s.jsx)(n.td,{children:"/app"}),(0,s.jsx)(n.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,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"SERVER_URL"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.a,{href:"http://localhost:8080/app",children:"http://localhost:8080/app"})}),(0,s.jsx)(n.td,{children:"Set it to the URL from where APIs will be accessible to the NodeJS functions, for local development it should be localhost:8080/app (use your local port number instead)"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"DO_SPACE"}),(0,s.jsx)(n.td,{children:"DOSPACENAME"}),(0,s.jsx)(n.td,{children:"Digital ocean space name or AWS S3 bucket name for uploading documents"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"DO_ENDPOINT"}),(0,s.jsx)(n.td,{children:"ams3.digitaloceanspaces.com"}),(0,s.jsx)(n.td,{children:"Digital ocean spaces endpoint or AWS S3 endpoint for uploading documents"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"DO_BASEURL"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.a,{href:"https://DOSPACENAME.ams3.digitaloceanspaces.com",children:"https://DOSPACENAME.ams3.digitaloceanspaces.com"})}),(0,s.jsx)(n.td,{children:"Digital ocean baseurl or AWS S3 base URL"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"DO_ACCESS_KEY_ID"}),(0,s.jsx)(n.td,{children:"YOUR_S3_ACCESS_ID"}),(0,s.jsx)(n.td,{children:"Digital ocean spaces access key ID or AWS s3 Access key ID for uploading the docs"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"DO_SECRET_ACCESS_KEY"}),(0,s.jsx)(n.td,{children:"YOUR_S3_ACCESS_KEY"}),(0,s.jsx)(n.td,{children:"Digital ocean spaces secret access key or AWS s3 secret access key for uploading the docs"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"DO_REGION"}),(0,s.jsx)(n.td,{children:"YOUR_S3_REGION"}),(0,s.jsx)(n.td,{children:"Digital ocean spaces region or AWS s3 region"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"USE_LOCAL"}),(0,s.jsx)(n.td,{children:"FALSE"}),(0,s.jsx)(n.td,{children:"To use local file storage to save file"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"MAILGUN_API_KEY"}),(0,s.jsx)(n.td,{children:"YOUR_MAILGUNAPI_KEY"}),(0,s.jsx)(n.td,{children:"Mailgun API Key"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"MAILGUN_DOMAIN"}),(0,s.jsx)(n.td,{children:"YOUR_MAILGUNAPI_DOMAIN"}),(0,s.jsx)(n.td,{children:"Mailgun API Domain"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"MAILGUN_SENDER"}),(0,s.jsx)(n.td,{children:"-"}),(0,s.jsx)(n.td,{children:"Mailgun Sender Mail ID"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"PFX_BASE64"}),(0,s.jsx)(n.td,{children:"-"}),(0,s.jsx)(n.td,{children:"Base64 encoded PFX or p12 document signing certificate file. You can generate base64 encoded self sign certificate using the passphrase."})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"PASS_PHRASE"}),(0,s.jsx)(n.td,{children:"opensign"}),(0,s.jsx)(n.td,{children:"Pass phrase of PFX or p12 document signing certificate file."})]})]})]}),"\n",(0,s.jsx)(n.h1,{id:"steps-to-generate-self-sign-certificate",children:"Steps to Generate Self Sign Certificate"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"# execute below command and use passphrase 'opensign'\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,s.jsx)(n.h1,{id:"cors-configuration",children:"CORS Configuration"}),"\n",(0,s.jsxs)(n.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,s.jsx)(n.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,s.jsx)(n.pre,{children:(0,s.jsx)(n.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,s.jsx)(n.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,s.jsxs)(n.ul,{children:["\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://docs.digitalocean.com/products/spaces/how-to/configure-cors/",children:"How to Configure CORS on DigitalOcean Spaces"})}),"\n",(0,s.jsx)(n.li,{children:(0,s.jsx)(n.a,{href:"https://docs.aws.amazon.com/AmazonS3/latest/userguide/enabling-cors-examples.html",children:"Configuring cross-origin resource sharing on AWS S3"})}),"\n"]})]})}function x(e={}){const{wrapper:n}={...(0,i.a)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}}}]); |