timeoff-management-application icon indicating copy to clipboard operation
timeoff-management-application copied to clipboard

official Container at Docker Hub

Open alexanderadam opened this issue 3 years ago • 6 comments

Currently there are many inofficial containers at Docker Hub.

None of them seem to be official, some of them are abandoned.

So maybe it would be good to have an official container that will be built automatically for every release (i.e. with GitHub actions or so).

PS: Thank you so much for timeoff-management :raised_hands:

alexanderadam avatar Apr 24 '22 12:04 alexanderadam

Did you at least succeed trying to run it @alexanderadam? I'm trying to run current version code with dockerfile and it doesn't seem to work at all...

zapic0 avatar May 09 '22 14:05 zapic0

I got it up and running with some warnings and probably security risks. It could be done better than I did for sure but I can share my at least working config later today here! :)

Sim0nW0lf avatar May 09 '22 16:05 Sim0nW0lf

cat docker-compose.yml

version: "3.8"

services:
  app:
    build:
      context: ./app
      dockerfile: Dockerfile
    container_name: timeoff
#    ports:.     #opening ports is not needed with traefik. If you use nginx/apache uncomment this
#      - 3000:3000
    networks:
      - proxy
    volumes:
      - ./Container-Daten/timeoff/config/app.json:/app/timeoff-management/config/app.json
      - ./Container-Daten/timeoff/db/db.development.sqlite:/app/timeoff-management/db.development.sqlite  #launch First time without this!
    labels:
      - com.centurylinklabs.watchtower.enable=false
      - "traefik.enable=true"
      - "traefik.http.routers.timeoff.rule=Host(`timeoff.example.com`)"  #set url (timeoff.example.com)
      - "traefik.http.routers.timeoff-secure.rule=Host(`timeoff.example.com`)"  #set url (timeoff.example.com)
      - "traefik.http.routers.timeoff.entrypoints=http"
      - "traefik.http.middlewares.timeoff-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.timeoff.middlewares=timeoff-https-redirect"
      - "traefik.http.routers.timeoff-secure.entrypoints=https"
      - "traefik.http.routers.timeoff-secure.tls=true"
      - "traefik.http.routers.timeoff-secure.tls.certresolver=http"
      - "traefik.http.routers.timeoff-secure.service=timeoff"
      - "traefik.http.services.timeoff.loadbalancer.server.port=3000"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.timeoff-secure.middlewares=secHeaders@file"

networks:
  proxy:  ###
    external: true

cat app/Dockerfile

FROM node:13-alpine

EXPOSE 3000

RUN apk update
RUN apk upgrade
#Install dependencies
RUN apk add \
    nodejs npm \
    git \
    make \
    python3 \
    g++ \
    gcc \
    libc-dev \
    clang

#Update npm
RUN npm install -g npm

#Add user so it doesn't run as root
RUN adduser --system app --home /app
USER app
WORKDIR /app

#clone app
RUN git clone https://github.com/timeoff-management/application.git timeoff-management

WORKDIR /app/timeoff-management

#bump formidable up a version to fix user import error.
RUN sed -i 's/formidable"\: "~1.0.17/formidable"\: "1.1.1/' package.json

#install app
RUN npm install -y

CMD npm start

cat Container-Daten/timeoff/config/app.json (https://raw.githubusercontent.com/timeoff-management/timeoff-management-application/master/config/app.json)

{
  "allow_create_new_accounts" : true,
  "send_emails"              : true,
  "application_sender_email" : "[email protected]",
  "email_transporter" : {
    "host" : "mail.example-server.de",
    "port" : 587,
     "secureConnection" : false,
     "tls" : {
       "ciphers" : "SSLv3"
     },
    "auth" : {
      "user" : "[email protected]",
      "pass" : "******YOUR_PASSWORD******"
    }
  },
  "sessionStore": {
    "useRedis": false,
    "redisConnectionConfiguration": {
      "host": "mail.example-server.de",
      "port": 6379
    }
  },
  "ga_analytics_on" : false,
  "crypto_secret" : "!2~`HswpPPLa22+=±§sdq qwe,appp qwwokDF_",
  "application_domain" : "https://timeoff.example.com",
  "promotion_website_domain" : "https://timeoff.example.com",
  "locale_code_for_sorting": "de"
}

The db file will be created after first launch. That means remove the db volume in the docker-compose.yml for the first launch. Then you need to copy the file from the container: docker cp timeoff:/app/timeoff-management/db.development.sqlite Container-Daten/timeoff/db/ Now you can add the db volume to the docker-compose.yml again and your changes will be stored permanently.

If you have any tips or a better configuration, please share it. Also feel free to ask any questions about my setup which is again NOT ideal 😜

Sim0nW0lf avatar May 09 '22 20:05 Sim0nW0lf

Thanks a lot @Sim0nW0lf, it really helped me to run it too :)

The only problem I'm facing now is smtp config... did you try with a gmail account? I've tried many config examples and none of them seem to work...

zapic0 avatar May 11 '22 10:05 zapic0

SMTP is working for me, so it should be possible!

I am not using gmail here but I might be able to help you: To use gmail as smtp server you have to generate an app password and use that for loging in! https://support.google.com/accounts/answer/185833?hl=en

This is what you config should probably look like: cat Container-Daten/timeoff/config/app.json

{
  "allow_create_new_accounts" : true,
  "send_emails"              : true,
  "application_sender_email" : "[email protected]",
  "email_transporter" : {
    "host" : "smtp.gmail.com",
    "port" : 465,
     "secureConnection" : false,
     "tls" : {
       "ciphers" : "SSLv3"
     },
    "auth" : {
      "user" : "[email protected]",
      "pass" : "******YOUR_PASSWORD******"
    }
  },
  "sessionStore": {
    "useRedis": false,
    "redisConnectionConfiguration": {
      "host": "smtp.gmail.com",
      "port": 6379
    }
  },
  "ga_analytics_on" : false,
  "crypto_secret" : "!2~`HswpPPLa22+=±§sdq qwe,appp qwwokDF_",
  "application_domain" : "https://timeoff.example.com",
  "promotion_website_domain" : "https://timeoff.example.com",
  "locale_code_for_sorting": "de"
}

Please let me know it that worked out for you :)

Sim0nW0lf avatar May 11 '22 11:05 Sim0nW0lf

it worked! thank you

DanielPuenteG avatar May 12 '22 07:05 DanielPuenteG