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

official Container at Docker Hub #514

Open
alexanderadam opened this issue Apr 24, 2022 · 6 comments
Open

official Container at Docker Hub #514

alexanderadam opened this issue Apr 24, 2022 · 6 comments

Comments

@alexanderadam
Copy link

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 🙌

@zapic0
Copy link

zapic0 commented May 9, 2022

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

@Sim0nW0lf
Copy link

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

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 😜

@zapic0
Copy link

zapic0 commented May 11, 2022

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

@Sim0nW0lf
Copy link

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 :)

@DanielPuenteG
Copy link

DanielPuenteG commented May 12, 2022

it worked! thank you

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

No branches or pull requests

4 participants