{"id":1109,"date":"2025-01-15T22:45:08","date_gmt":"2025-01-15T22:45:08","guid":{"rendered":"https:\/\/thomas.w-p.me.uk\/blog\/?p=1109"},"modified":"2025-01-16T16:40:31","modified_gmt":"2025-01-16T16:40:31","slug":"multiple-paperless-instances","status":"publish","type":"post","link":"https:\/\/thomas.w-p.me.uk\/blog\/2025\/01\/multiple-paperless-instances\/","title":{"rendered":"Multiple Paperless Instances"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">This nearly killed me, I thought I had nuked everything but in the end it was way easier and simpler than I had feared.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Assuming you used one of the default .yaml and .env files from the <a href=\"https:\/\/github.com\/paperless-ngx\/\">paperless-ngx github<\/a> you first need to add a database. I use portainer so went to the db shell and then did this to log in, list them, create a new one, check it is there and quit:<\/p>\n\n\n\n<pre class=\"wp-block-code has-90-a-4-ae-color has-text-color has-875-rem-font-size\"><code>psql -U paperless\n\\l\nCREATE DATABASE mynewdb;\n\\l\n\\q\nexit<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next I needed to make a new env file. I just Save As&#8230; with the existing one and called it docker-compose-mynewone.env and added these lines:<\/p>\n\n\n\n<pre class=\"wp-block-code has-90-a-4-ae-color has-text-color has-875-rem-font-size\"><code>PAPERLESS_DBNAME=mynewdb\nPAPERLESS_SECRET_KEY=an+all+new+random+set+of+characters\nPAPERLESS_URL=https:\/\/mynewpapaerless.myfinedomain.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The .yaml file needs one new section &#8211; I copied the webserver one and only changed these lines (the first instance is on 8010). The \/1 on the end of the PAPERLESS_REDIS means use a second database and you need all new volumes or things go awry (I found this out the hard way).<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#FAFAFA\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"  webserver-newone:\n    ports:\n      - &quot;8011:8000&quot;\n    env_file: docker-compose-mynewone.env\n    environment:\n      PAPERLESS_REDIS: redis:\/\/broker:6379\/1\n    volumes:\n      - data-new:\/usr\/src\/paperless\/data\n      - media-new:\/usr\/src\/paperless\/media\n      - .\/export-new:\/usr\/src\/paperless\/export\n      - .\/consume-new:\/usr\/src\/paperless\/consume\" style=\"color:#90A4AE;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE\">  webserver<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #E2931D\">newone<\/span><span style=\"color: #39ADB5\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">    <\/span><span style=\"color: #E2931D\">ports<\/span><span style=\"color: #39ADB5\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">&quot;<\/span><span style=\"color: #91B859\">8011:8000<\/span><span style=\"color: #39ADB5\">&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">    <\/span><span style=\"color: #E2931D\">env_file<\/span><span style=\"color: #39ADB5\">:<\/span><span style=\"color: #90A4AE\"> docker<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\">compose<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\">mynewone<\/span><span style=\"color: #39ADB5\">.<\/span><span style=\"color: #90A4AE\">env<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">    <\/span><span style=\"color: #E2931D\">environment<\/span><span style=\"color: #39ADB5\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #E2931D\">PAPERLESS_REDIS<\/span><span style=\"color: #39ADB5\">:<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #E2931D\">redis<\/span><span style=\"color: #39ADB5\">:<\/span><span style=\"color: #90A4AE; font-style: italic\">\/\/broker:6379\/1<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">    <\/span><span style=\"color: #E2931D\">volumes<\/span><span style=\"color: #39ADB5\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\"> data<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #E2931D\">new<\/span><span style=\"color: #39ADB5\">:\/<\/span><span style=\"color: #90A4AE\">usr<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">src<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">paperless<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">data<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\"> media<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #E2931D\">new<\/span><span style=\"color: #39ADB5\">:\/<\/span><span style=\"color: #90A4AE\">usr<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">src<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">paperless<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">media<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">.\/<\/span><span style=\"color: #9C3EDA\">export<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #E2931D\">new<\/span><span style=\"color: #39ADB5\">:\/<\/span><span style=\"color: #90A4AE\">usr<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">src<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">paperless<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #9C3EDA\">export<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #39ADB5\">.\/<\/span><span style=\"color: #90A4AE\">consume<\/span><span style=\"color: #39ADB5\">-<\/span><span style=\"color: #E2931D\">new<\/span><span style=\"color: #39ADB5\">:\/<\/span><span style=\"color: #90A4AE\">usr<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">src<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">paperless<\/span><span style=\"color: #39ADB5\">\/<\/span><span style=\"color: #90A4AE\">consume<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You need to tweak the original webserver changing just this one line with the \/0.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#FAFAFA\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"  webserver:\n      PAPERLESS_REDIS: redis:\/\/broker:6379\/0\" style=\"color:#90A4AE;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki material-theme-lighter\" style=\"background-color: #FAFAFA\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #90A4AE\">  <\/span><span style=\"color: #E2931D\">webserver<\/span><span style=\"color: #39ADB5\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #90A4AE\">      <\/span><span style=\"color: #E2931D\">PAPERLESS_REDIS<\/span><span style=\"color: #39ADB5\">:<\/span><span style=\"color: #90A4AE\"> <\/span><span style=\"color: #E2931D\">redis<\/span><span style=\"color: #39ADB5\">:<\/span><span style=\"color: #90A4AE; font-style: italic\">\/\/broker:6379\/0<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Then yougo to the folder with the yaml in console, stop all the instances, pull a new one and create a superuser as per the usual, but with a minor difference (the new webserver name):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker compose down\ndocker compose pull\ndocker compose run --rm webserver-newone createsuperuser\ndocker compose up -d<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And that should be it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This nearly killed me, I thought I had nuked everything but in the end it was way easier and simpler than I had feared. Assuming you used one of the default .yaml and .env files from the paperless-ngx github you first need to add a database. I use portainer so went to the db shell &hellip; <a href=\"https:\/\/thomas.w-p.me.uk\/blog\/2025\/01\/multiple-paperless-instances\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Multiple Paperless Instances<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[114],"tags":[117,116,115],"class_list":["post-1109","post","type-post","status-publish","format-standard","hentry","category-paperless","tag-docker","tag-frustration-2","tag-paperless"],"_links":{"self":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1109","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/comments?post=1109"}],"version-history":[{"count":4,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1109\/revisions"}],"predecessor-version":[{"id":1119,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1109\/revisions\/1119"}],"wp:attachment":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/media?parent=1109"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/categories?post=1109"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/tags?post=1109"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}