pa11y-dashboard icon indicating copy to clipboard operation
pa11y-dashboard copied to clipboard

Docker setup

Open Jamesking56 opened this issue 4 years ago • 10 comments

Provide a Dockerfile and published Docker image to make it easier for developers to run the Dashboard locally.

Jamesking56 avatar Jan 14 '20 14:01 Jamesking56

Hey, there are a few projects already out there attempting to do this. I started with work done by https://github.com/RobLoach/docker-pa11y and I am experimenting with updating here https://github.com/wavemotionio/pa11y-docker. The result is working well locally but I am not having any luck deploying it to the cloud.

You can do the following and then go to http://localhost:80 to see it in action.

git clone https://github.com/wavemotionio/pa11y-docker
cd pa11y-docker
docker-compose up

The problem is when I try to use the same docker-compose.yml script using an Azure App Service we are getting a protocol error: It looks like you are trying to access MongoDB over HTTP on the native driver port

This must have something to do with Azure Cloud but I cannot pinpoint yet. I might need to replace the mongodb instance with a mongolab connection string.

Dockerfile

FROM node:12

RUN apt-get update -y && apt-get upgrade -y && apt-get install net-tools -y && apt-get install gconf-service libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxss1 libxtst6 libappindicator1 libnss3 libasound2 libatk1.0-0 libc6 ca-certificates fonts-liberation lsb-release xdg-utils wget -y

RUN mkdir -p /home/node/app && chown -R node:node /home/node/app
USER node

WORKDIR /home/node/app
RUN git clone https://github.com/pa11y/pa11y-dashboard.git && cd pa11y-dashboard && npm i

EXPOSE 4000
EXPOSE 3000

WORKDIR /home/node/app/pa11y-dashboard
COPY production.json ./config/production.json

CMD NODE_ENV=production node index.js

Docker-compose.yml

version: "3.7"
services:
  database:
    image: mongo
    volumes: 
      - mongo-volume:/pa11ydata
    restart: always
    ports:
      - "27017:27017"
    expose:
      - "27017"
  web:
    depends_on:
      - database
    image: pallespm/pa11y-docker
    # build: .
    ports:
      - "80:4000"
    restart: always
volumes:
  mongo-volume:

wavemotionio avatar Feb 29 '20 00:02 wavemotionio

I personally use the buildkite/puppeteer Docker image for running pa11y, which I've had no problems with. It was a tad complicated getting the node image to install all the other requirements for Chromium

joeyciechanowicz avatar Mar 02 '20 11:03 joeyciechanowicz

@Jamesking56 you also use mine https://github.com/andreabisello/pa11y-dashboard-docker-container it works.

andreabisello avatar May 19 '22 12:05 andreabisello

Hi everyone, I'm looking for a good way to test pa11y dashboard and I'm not a docker pro yet.

Thanks very much for providing these images!

Both https://github.com/wavemotionio/pa11y-docker and https://github.com/andreabisello/pa11y-dashboard-docker-container currently throw errors on my machine (mac m1 / docker desktop 4.16.2 (95914)).

# Both https://github.com/wavemotionio/pa11y-docker
 model:task:getAll failed
pa11y-docker-web-1       | Unsupported OP_QUERY command: find. The client driver may require an upgrade. For more details see https://dochub.mongodb.org/core/legacy-opcode-removal
pa11y-docker-web-1       | 
pa11y-docker-web-1       | Error: Error 500
pa11y-docker-web-1       |     at Request._callback (/home/node/app/pa11y-dashboard/node_modules/pa11y-webservice-client-node/lib/client.js:124:16)
pa11y-docker-web-1       |     at Request.self.callback (/home/node/app/pa11y-dashboard/node_modules/request/request.js:185:22)
pa11y-docker-web-1       |     at Request.emit (events.js:311:20)
pa11y-docker-web-1       |     at Request.<anonymous> (/home/node/app/pa11y-dashboard/node_modules/request/request.js:1154:10)
pa11y-docker-web-1       |     at Request.emit (events.js:311:20)
pa11y-docker-web-1       |     at IncomingMessage.<anonymous> (/home/node/app/pa11y-dashboard/node_modules/request/request.js:1076:12)
pa11y-docker-web-1       |     at Object.onceWrapper (events.js:417:28)
pa11y-docker-web-1       |     at IncomingMessage.emit (events.js:323:22)
pa11y-docker-web-1       |     at endReadableNT (_stream_readable.js:1204:12)
pa11y-docker-web-1       |     at processTicksAndRejections (internal/process/task_queues.js:84:21)
# https://github.com/andreabisello/pa11y-dashboard-docker-container
#0 16.70 npm ERR! code 1
#0 16.70 npm ERR! path /dashboard/node_modules/puppeteer
#0 16.70 npm ERR! command failed
#0 16.70 npm ERR! command sh -c node install.js
#0 16.70 npm ERR! The chromium binary is not available for arm64.
#0 16.70 npm ERR! If you are on Ubuntu, you can install with: 

Update: Found a fix https://gist.github.com/mandrasch/a0bc5cdfc6b213f5264885120b25bbaf, npm install works, but now I get no such service: database.

Has anybody by chance a working docker image for mac m1/m2? :-) Thx in advance!

(Would be also cool to get this thing running with open source swiss army knife DDEV, but I haven't had experience with https://github.com/ddev/ddev-mongo yet)

mandrasch avatar Feb 17 '23 09:02 mandrasch

@andreabisello Thanks very much for providing your repo! I forked it, made some customizations to set it up, but now I'm running into 🤔 Do you have any advice by chance? Thanks in advance!

pa11y-dashboard                              | [2023-03-02T09:50:17.029Z #59pdsY2FNr] Started GET / for ::ffff:172.23.0.1
pa11y-dashboard                              | 
pa11y-dashboard                              | Error: Could not connect to Pa11y Webservice
pa11y-dashboard                              |     at /dashboard/app.js:171:12

Forked repo: https://github.com/mandrasch/pa11y-dashboard-docker-container

mandrasch avatar Mar 02 '23 09:03 mandrasch

@mandrasch maybe at the beginning start understaing if my repo is still working so you can detect if the problems are your customization or my repo that is not up to date

andreabisello avatar Mar 02 '23 09:03 andreabisello

@andreabisello Thanks very much for reply, much appreciated! 🤗

In your original repo I ran into

#0 16.68 npm notice 
#0 16.69 npm ERR! code 1
#0 16.69 npm ERR! path /dashboard/node_modules/puppeteer
#0 16.69 npm ERR! command failed
#0 16.69 npm ERR! command sh -c node install.js
#0 16.69 npm ERR! The chromium binary is not available for arm64.
#0 16.69 npm ERR! If you are on Ubuntu, you can install with: 
#0 16.69 npm ERR! 
#0 16.69 npm ERR!  sudo apt install chromium
#0 16.69 npm ERR! 
#0 16.69 npm ERR! 
#0 16.69 npm ERR!  sudo apt install chromium-browser
#0 16.69 npm ERR! 
#0 16.69 npm ERR! /dashboard/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:115
#0 16.69 npm ERR!                     throw new Error();
#0 16.69 npm ERR!                     ^

Therefore I added (for mac m1/m2 ARM laptop):

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/chromium

After that it results in no such service: database, therefore I changed the other things.

mandrasch avatar Mar 02 '23 10:03 mandrasch

@mandrasch the problem is that i'm not very handy with docker so now i don't remember all the stuffs but for me i didnt added these environment variables.

andreabisello avatar Mar 02 '23 13:03 andreabisello

@mandrasch the problem is that i'm not very handy with docker so now i don't remember all the stuffs but for me i didnt added these environment variables.

Same here, I'm a docker newbie / noob as well. 😄 Thanks very much for quick reply, much appreciated!

mandrasch avatar Mar 02 '23 19:03 mandrasch

Would really like to see this, too. Pa11y looks great, but having to locally install Node and other dependencies on a server is a no-go for me (and probably many others).

@rowanmanning would you be interested in a contribution for a Docker setup?

Kovah avatar Feb 19 '24 10:02 Kovah