From da115e6a367836eafc06fe55c705c885113f4fb5 Mon Sep 17 00:00:00 2001 From: Thijs de Vries Date: Sat, 13 Jul 2019 01:09:46 +0200 Subject: [PATCH] #6 Dockerfile added, documentation updated, port changed from 80->8080 --- README.md | 18 +++++++++++++++++- app/.dockerignore | 5 +++++ app/Dockerfile | 9 +++++++++ app/index.js | 2 +- 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 app/.dockerignore create mode 100644 app/Dockerfile diff --git a/README.md b/README.md index 296b9fb..e56c8b7 100644 --- a/README.md +++ b/README.md @@ -30,5 +30,21 @@ WIP ## Deploy your own +Right now you shouldn't do it. This has only been tested by me, and only on a single set-up; mine. -WIP \ No newline at end of file +If you wan't to do the alpha-testing, be my guest. +### Docker +There's a docker file included. Install docker on your host, and follow the steps configure, build and run the container. +1. Add a dedicated gitea account to your gitea. Grant collaboration access on every repository you want to integrate. Use a dedicated account because this app will comment in it’s name. +2. Obtain a nextcloud app password. You may use a dedicated account or your own. Make sure the account has access to your nextcloud Deck board. +3. git clone this repo and go to the 'app' folder `git clone https://git.thijsdevries.net/dodedodo/deck-gitea-integration.git && cd deck-gitea-integration/app` +4. Edit the _*ahem\*_ 'configuration' to your liking. It's located on line 9 and 10 of index.js `vi index.js` +5. After you're done editing, build the container. `docker build . -t deck-gitea-integration:0.0.0-alpine` +6. Run the container !! *Beware, this publishes an untested app on port 80* !! `docker run -d -p 80:8080 --restart always --name deck-gitea deck-gitea-integration:0.0.0-alpine` +7. Optionally run `docker logs deck-gitea -f` to see the output. + +After creating/modifying an issue the ‘Deck’ label will be added to your gitea. A ‘Gitea’ label will also automatically be created on Deck as soon as it tries to add an issue. + +The app is stateless (besides the configuration of course). That means you don’t need any persistent volumes, and you can restart the container all you like without damaging any sort of database. + +If you’re seeing errors in the docker logs, make sure all gitea/nextcloud permisions are set correctly! Secondly check if the URL’s seem right. Especially look out for double slashed (//) inside url’s. \ No newline at end of file diff --git a/app/.dockerignore b/app/.dockerignore new file mode 100644 index 0000000..65546d2 --- /dev/null +++ b/app/.dockerignore @@ -0,0 +1,5 @@ +node_modules +npm-debug.log +Dockerfile +.dockerignore +.gitignore diff --git a/app/Dockerfile b/app/Dockerfile new file mode 100644 index 0000000..4b9970f --- /dev/null +++ b/app/Dockerfile @@ -0,0 +1,9 @@ +FROM node:12.6.0-alpine +RUN apk add --no-cache paxctl && paxctl -cm `which node` +RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app +WORKDIR /home/node/app +COPY --chown=node:node . . +USER node +RUN npm install +EXPOSE 80 +CMD [ "node", "index.js" ] diff --git a/app/index.js b/app/index.js index e019e9e..66c015a 100644 --- a/app/index.js +++ b/app/index.js @@ -84,4 +84,4 @@ I've re-added the card to Deck.`, repo, issue) res.send("okay") // generate some feedback for gitea }) -app.listen(80, () => console.log(`Listening on :80`)) +app.listen(8080, () => console.log(`Listening on :80`))