Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker setup #253

Open
Jamesking56 opened this issue Jan 14, 2020 · 10 comments
Open

Docker setup #253

Jamesking56 opened this issue Jan 14, 2020 · 10 comments

Comments

@Jamesking56
Copy link

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

@wavemotionio
Copy link

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:

@joeyciechanowicz
Copy link
Member

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

@andreabisello
Copy link

@mandrasch
Copy link

mandrasch commented Feb 17, 2023

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
Copy link

@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

@andreabisello
Copy link

@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

@mandrasch
Copy link

mandrasch commented Mar 2, 2023

@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.

@andreabisello
Copy link

@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.

@mandrasch
Copy link

@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!

@Kovah
Copy link

Kovah commented Feb 19, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants