Files
OpenSign/assets/js/489b8a4d.4b0fa446.js
T

1 line
13 KiB
JavaScript

"use strict";(self.webpackChunkOpenSign_Docs=self.webpackChunkOpenSign_Docs||[]).push([[8781],{44907:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>i,default:()=>h,frontMatter:()=>r,metadata:()=>c,toc:()=>l});var t=s(85893),o=s(11151);const r={title:"Self-host OpenSign\u2122 with Docker on Linux/MacOS/Windows"},i=void 0,c={id:"self-host/docker/run-locally",title:"Self-host OpenSign\u2122 with Docker on Linux/MacOS/Windows",description:"Steps to run OpenSign\u2122 with docker on Linux/MacOS/Windows:",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:"Self-host OpenSign\u2122 with Docker on Linux/MacOS/Windows"},sidebar:"selfhostSidebar",previous:{title:"Localhost OpenSign\u2122 Setup with Docker on Windows",permalink:"/docs/self-host/docker/run-locally-windows"},next:{title:"Cloud Storage",permalink:"/docs/category/cloud-storage"}},d={},l=[{value:"Steps to run OpenSign\u2122 with docker on Linux/MacOS/Windows:",id:"steps-to-run-opensign-with-docker-on-linuxmacoswindows",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 a(e){const n={a:"a",code:"code",em:"em",h1:"h1",h2:"h2",li:"li",ol:"ol",p:"p",pre:"pre",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,o.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"steps-to-run-opensign-with-docker-on-linuxmacoswindows",children:"Steps to run OpenSign\u2122 with docker on Linux/MacOS/Windows:"}),"\n",(0,t.jsxs)(n.ol,{children:["\n",(0,t.jsx)(n.li,{children:"Firstly, install Docker and ensure it is running before proceeding to the next steps. Make sure that you have NodeJS & GIT installed on your machine."}),"\n",(0,t.jsx)(n.li,{children:"Now, open the terminal and type the following command:"}),"\n"]}),"\n",(0,t.jsx)(n.p,{children:"Command for linux/MacOS"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"export HOST_URL=https://opensign.yourdomain.com && curl --remote-name-all https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/docker-compose.yml https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/Caddyfile https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/.env.local_dev && mv .env.local_dev .env.prod && docker compose up --force-recreate\n"})}),"\n",(0,t.jsx)(n.p,{children:"Command for Windows (Powershell)"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'$env:HOST_URL="https://opensign.yourdomain.com"; Invoke-WebRequest -Uri https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/docker-compose.yml -OutFile docker-compose.yml; Invoke-WebRequest -Uri https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/Caddyfile -OutFile Caddyfile; Invoke-WebRequest -Uri https://raw.githubusercontent.com/OpenSignLabs/OpenSign/docker_beta/.env.local_dev -OutFile .env.local_dev; Rename-Item -Path .env.local_dev -NewName .env.prod; docker compose up --force-recreate\n'})}),"\n",(0,t.jsx)(n.p,{children:"and Hit Enter start the containers automatically. Make sure that you replace the host URL with your subdomain from where OpenSign will be accessible. You need to point the subdomain to the server you are running these commands by adding the necessary A record to your DNS."}),"\n",(0,t.jsxs)(n.ol,{start:"3",children:["\n",(0,t.jsxs)(n.li,{children:["If you want to test it locally, remove ",(0,t.jsx)(n.code,{children:"export HOST_URL=https://opensign.yourdomain.com &&"})," for Linux/MacOS and ",(0,t.jsx)(n.code,{children:'$env:HOST_URL="https://opensign.yourdomain.com";'})," for Windows. Once deployed successfully, follow the steps from the screenshots."]}),"\n"]}),"\n",(0,t.jsx)("div",{children:(0,t.jsx)("img",{width:"937",alt:"localhost",src:"https://github.com/user-attachments/assets/f5de1882-64d0-44ea-86e3-3a7c8405272c"})}),"\n",(0,t.jsx)("div",{children:(0,t.jsx)("img",{width:"935",alt:"proceedtolocalhost",src:"https://github.com/user-attachments/assets/33f975b9-4a9a-431e-a869-72e38f3b6754"})}),"\n",(0,t.jsx)(n.p,{children:(0,t.jsx)(n.em,{children:"Note: If you wish to incorporate our latest features into your Docker container, follow the steps again after stopping existing containers."})}),"\n",(0,t.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,t.jsx)(n.p,{children:"To set up OpenSign\u2122 locally using Docker, the following prerequisites are required:"}),"\n",(0,t.jsx)(n.p,{children:'Add below Environment Varaibles to the ".env.prod" file that is automatically created in order to personalize your installation:'}),"\n",(0,t.jsxs)(n.table,{children:[(0,t.jsx)(n.thead,{children:(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.th,{children:"Environment Varibale"}),(0,t.jsx)(n.th,{children:"Value"}),(0,t.jsx)(n.th,{children:"Description"})]})}),(0,t.jsxs)(n.tbody,{children:[(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"PUBLIC_URL"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.a,{href:"https://localhost:3001",children:"https://localhost:3001"})}),(0,t.jsx)(n.td,{children:"Set it to the URL form where the app home page will be accessed"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"APP_ID"}),(0,t.jsx)(n.td,{children:"opensign"}),(0,t.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,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"appName"}),(0,t.jsx)(n.td,{children:"open_sign_server"}),(0,t.jsx)(n.td,{children:"Name of the app. It will be visible in the verification emails sent out."})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"MASTER_KEY"}),(0,t.jsx)(n.td,{children:"XnAadwKxxByMr"}),(0,t.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,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"MONGODB_URI"}),(0,t.jsx)(n.td,{children:"mongodb://mongo-container:27017/OpenSignDB"}),(0,t.jsx)(n.td,{children:"Mongodb URI to connect to"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"PARSE_MOUNT"}),(0,t.jsx)(n.td,{children:"/app"}),(0,t.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,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"SERVER_URL"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.a,{href:"http://localhost:8080/app",children:"http://localhost:8080/app"})}),(0,t.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,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"DO_SPACE"}),(0,t.jsx)(n.td,{children:"DOSPACENAME"}),(0,t.jsx)(n.td,{children:"Digital ocean space name or AWS S3 bucket name for uploading documents"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"DO_ENDPOINT"}),(0,t.jsx)(n.td,{children:"ams3.digitaloceanspaces.com"}),(0,t.jsx)(n.td,{children:"Digital ocean spaces endpoint or AWS S3 endpoint for uploading documents"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"DO_BASEURL"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.a,{href:"https://dospace.ams3.digitaloceanspaces.com",children:"https://dospace.ams3.digitaloceanspaces.com"})}),(0,t.jsx)(n.td,{children:"Digital ocean baseurl or AWS S3 base URL"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"DO_ACCESS_KEY_ID"}),(0,t.jsx)(n.td,{children:"YOUR_S3_ACCESS_ID"}),(0,t.jsx)(n.td,{children:"Digital ocean spaces access key ID or AWS s3 Access key ID for uploading the docs"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"DO_SECRET_ACCESS_KEY"}),(0,t.jsx)(n.td,{children:"YOUR_S3_ACCESS_KEY"}),(0,t.jsx)(n.td,{children:"Digital ocean spaces secret access key or AWS s3 secret access key for uploading the docs"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"DO_REGION"}),(0,t.jsx)(n.td,{children:"YOUR_S3_REGION"}),(0,t.jsx)(n.td,{children:"Digital ocean spaces region or AWS s3 region"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"USE_LOCAL"}),(0,t.jsx)(n.td,{children:"true"}),(0,t.jsx)(n.td,{children:"To use local file storage to save file"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"MAILGUN_API_KEY"}),(0,t.jsx)(n.td,{children:"YOUR_MAILGUNAPI_KEY"}),(0,t.jsx)(n.td,{children:"Mailgun API Key"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"MAILGUN_DOMAIN"}),(0,t.jsx)(n.td,{children:"YOUR_MAILGUNAPI_DOMAIN"}),(0,t.jsx)(n.td,{children:"Mailgun API Domain"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"MAILGUN_SENDER"}),(0,t.jsx)(n.td,{children:"-"}),(0,t.jsx)(n.td,{children:"Mailgun Sender Mail ID"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"SMTP_ENABLE"}),(0,t.jsx)(n.td,{children:"false"}),(0,t.jsx)(n.td,{children:"to enable SMTP"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"SMTP_HOST"}),(0,t.jsx)(n.td,{children:"smtp.yourhost.com"}),(0,t.jsx)(n.td,{children:"Provide smtp host"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"SMTP_PORT"}),(0,t.jsx)(n.td,{children:"443"}),(0,t.jsx)(n.td,{children:"Provide smtp port number"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"SMTP_USER_EMAIL"}),(0,t.jsx)(n.td,{children:(0,t.jsx)(n.a,{href:"mailto:mailer@yourdomain.com",children:"mailer@yourdomain.com"})}),(0,t.jsx)(n.td,{children:"Provide user email of smtp"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"SMTP_PASS"}),(0,t.jsx)(n.td,{children:"password"}),(0,t.jsx)(n.td,{children:"Provide smtp password"})]}),(0,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"PFX_BASE64"}),(0,t.jsx)(n.td,{children:"-"}),(0,t.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,t.jsxs)(n.tr,{children:[(0,t.jsx)(n.td,{children:"PASS_PHRASE"}),(0,t.jsx)(n.td,{children:"opensign"}),(0,t.jsx)(n.td,{children:"Pass phrase of PFX or p12 document signing certificate file."})]})]})]}),"\n",(0,t.jsx)(n.h1,{id:"steps-to-generate-self-sign-certificate",children:"Steps to Generate Self Sign Certificate"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"# execute below command and use passphrase 'opensign'\nopenssl genrsa -des3 -out ./local_dev.key 2048\nopenssl req -key ./local_dev.key -new -x509 -days 365 -out ./local_dev.crt\nopenssl pkcs12 -inkey ./local_dev.key -in ./local_dev.crt -export -out ./local_dev.pfx\nopenssl base64 -in ./local_dev.pfx -out ./base64_pfx\n"})}),"\n",(0,t.jsx)(n.h1,{id:"cors-configuration",children:"CORS Configuration"}),"\n",(0,t.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,t.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,t.jsx)(n.pre,{children:(0,t.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,t.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,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://docs.digitalocean.com/products/spaces/how-to/configure-cors/",children:"How to Configure CORS on DigitalOcean Spaces"})}),"\n",(0,t.jsx)(n.li,{children:(0,t.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 h(e={}){const{wrapper:n}={...(0,o.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},11151:(e,n,s)=>{s.d(n,{Z:()=>c,a:()=>i});var t=s(67294);const o={},r=t.createContext(o);function i(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function c(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:i(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]);