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 image #12

Closed
tiritibambix opened this issue Apr 29, 2023 · 11 comments
Closed

Docker image #12

tiritibambix opened this issue Apr 29, 2023 · 11 comments

Comments

@tiritibambix
Copy link

Hello.

Your project looks really appealing.

Is there a docker image coming anytime soon ?

Cheers :)

@intri-in
Copy link
Owner

intri-in commented May 8, 2023

Hi,

Yes, I am working on a docker image, and it will sure be out very soon.

Thanks!

@intri-in
Copy link
Owner

Hey
I have pushed an image over to docker hub.

You can find it here.

https://hub.docker.com/r/intriin/mmdl

It will still require some configuration to run, which you can learn about here:

https://manage-my-damn-life-nextjs.readthedocs.io/en/latest/install/Docker/

The guide also includes steps to run via Docker Compose.

@tiritibambix
Copy link
Author

Hello !

That's awesome, I'm thrilled to try it.

I run intro an error though.

I followed the instructions and changed mandatory lines as mentioned in the docs, including port as 3000 is already taken on my host. I get this error :

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /app/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/app/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

Here is my docker-compose file :

networks:
  app-tier:
    driver: bridge


services:
  app:
    image: node:18-alpine
    command: sh -c "npm install && npm run build && npm run start"
    ports:
      - 4000:3000
    working_dir: /app
    volumes:
      - /srv/Files/MMDL/:/app
    depends_on:
      - db
    networks:
      - app-tier   
    environment:
      NEXT_PUBLIC_BASE_URL: "http://192.168.1.103:4000/"
      NEXT_PUBLIC_API_URL: "http://192.168.1.103:4000/api/"
      NEXT_PUBLIC_DEBUG_MODE: "true"
      DB_HOST: localhost
      DB_USER: "user"
      DB_PASS: "password"
      DB_NAME: sdb_mmdl
      DB_CHARSET: "utf8mb4"
      DB_COLLATE: "utf8mb4_0900_ai_ci"
      AES_PASSWORD : samplepassword
      SMTP_HOST : smtp.host
      SMTP_USERNAME :  test@example.com
      SMTP_PASSWORD :  smtp_password
      SMTP_FROMEMAIL :  test@example.com
      SMTP_PORT :  25
      SMTP_USESECURE :  "false"
      
      # User Config
      NEXT_PUBLIC_DISABLE_USER_REGISTRATION: "false"

      # After this value, old ssid will be deleted.
      MAX_CONCURRENT_LOGINS_ALLOWED: 5

      # Maxium length of OTP validity, in seconds.
      MAX_OTP_VALIDITY:  1800

      # Maximum length of a login session in seconds.
      MAX_SESSION_LENGTH: 2592000

      # Enforce max length of session.
      ENFORCE_SESSION_TIMEOUT: "true"

      #Max number of recursions for finding subtasks. Included so the recursive function doesn't go haywire.
      #If subtasks are not being rendered properly, try increasing the value.
      NEXT_PUBLIC_SUBTASK_RECURSION_CONTROL_VAR: 100

      # Whether user is running install from a docker image.
      DOCKER_INSTALL: "true"

      ## Test Mode
      NEXT_PUBLIC_TEST_MODE: "false"

  db:
    image: mysql
    command: --default-authentication-plugin=mysql_native_password
    restart: always
    ports:
      - "3306:3306"    
    networks:
      - app-tier      
    environment:
      MYSQL_DATABASE: sample_install_mmdm
      MYSQL_ALLOW_EMPTY_PASSWORD: ok
      MYSQL_ROOT_PASSWORD: password
      MYSQL_ROOT_HOST: '%'

And here is the complete log

What am I doing wrong ?

@intri-in
Copy link
Owner

It looks like docker compose can't find package.json.

From your configuration, I see you have this :

volumes:
      - /srv/Files/MMDL/:/app

Are you sure that this path is correct, and /srv/Files/MMDL/ is the correct the path to the cloned repository's folder?

For the build to complete, your directory structure should look like this:

/srv/Files/MMDL/
|----package.json
|---docker-compose.yml
|---next.config.js
|---src/
|---public/
etc.

@tiritibambix
Copy link
Author

Oh yes, thank you. I wasn't doing things wright.
The installation process gets another error now.

You can see the logs here

@intri-in
Copy link
Owner

Did the server crash? If yes, restart it and try going to http://localhost:4000/install and see if you see any errors

@tiritibambix
Copy link
Author

tiritibambix commented May 11, 2023

It did crash. I restarted and landed on the install page with this error :

Error connecting to database. Check your database settings. Here's some more information:

{"errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":3306,"fatal":true}

I'm checking the db config and it seems good on my end (with the little I know).
Do DB_PASS and MYSQL_ROOT_PASSWORD have to match ? (they do in my config)

edit: more in the logs

api/install/check connStatus
Error: connect ECONNREFUSED 127.0.0.1:3306
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1494:16)
    --------------------
    at Protocol._enqueue (/app/node_modules/mysql/lib/protocol/Protocol.js:144:48)
    at Protocol.handshake (/app/node_modules/mysql/lib/protocol/Protocol.js:51:23)
    at Connection.connect (/app/node_modules/mysql/lib/Connection.js:116:18)
    at Connection._implyConnect (/app/node_modules/mysql/lib/Connection.js:454:10)
    at Connection.ping (/app/node_modules/mysql/lib/Connection.js:207:8)
    at /app/.next/server/chunks/2814.js:89:13
    at new Promise (<anonymous>)
    at testDBConnectionSimple (/app/.next/server/chunks/2814.js:88:12)
    at handler (/app/.next/server/pages/api/install/check.js:108:117)
    at Object.apiResolver (/app/node_modules/next/dist/server/api-utils/node.js:372:15) {
  errno: -111,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 3306,
  fatal: true

@intri-in
Copy link
Owner

Do DB_PASS and MYSQL_ROOT_PASSWORD have to match ? (they do in my config)

Yes they do have to match.

A new container of mysql is created for MMDL if you're using docker compose.

Please reset the following variables to these values:

DB_USER: root
DB_PASSWORD: [same as MYSQL_ROOT_PASSWORD]
DB_HOST: db
DB_NAME: [same as MYSQL_DATABASE]

Basically your app takes the reference of db which is also defined in the docker compose file. This is used to create a mysql container with just one user root, and one database which is specified in MYSQL_DATABASE.

If you're trying to connect to your own database, you should preferably try the "Without Docker Compose" set of instructions here:

https://manage-my-damn-life-nextjs.readthedocs.io/en/latest/install/Docker/

@tiritibambix
Copy link
Author

It's working ! I had MYSQL_DATABASE still at default sample_install_mmdm (shouldn't it be mmdl ? :p )

Thanks a lot for your support. I'll try and setup a calendar and see how it works.

Let me know if you need any user feedback :)

@AeliusSaionji
Copy link

I just tried to set this up today, and I'm getting an error on the install page.

manage-my-damn-life-nextjs-app-1  | Error: 'sharp' is required to be installed in standalone mode for the image optimization to function correctly. Read more at: https://nextjs.org/docs/messages/sharp-missing-in-production

@intri-in
Copy link
Owner

intri-in commented Jul 3, 2023

@AeliusSaionji

I have opened a new issue regarding this #51.

Could you please respond there?

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

3 participants