vitorbaptista / shellshare

Live terminal broadcasts
https://shellshare.net
Apache License 2.0
224 stars 23 forks source link

Current release with docker does not result in a working node server on port 3000 #70

Closed veixus closed 1 year ago

veixus commented 1 year ago

I have written a little script to setup shellshare server from scratch. It pulls from the Github repo and after that builds the containers. Currently something seems missing and the node container does not start. Im running fresh ubuntu 22.04 LTS but this shouldnt matter.

cd /opt/ && git clone https://github.com/vitorbaptista/shellshare.git 'cd /opt/shellshare && docker-compose up --build

this starts the mongodb but for node server, it gives output "shellshare_node_1 exited with code 0"

Before this, the result was 2 containers and node server listening on port 3000

Possible fix: add missing line into docker-compose.yml "command: "npm start""

Something is not automatically starting, so adding "npm start" seemed to start a service on port 3000 This might not be the right place for this, but seems that it fixed the problem

version: '3'
services:
  mongo:
    image: mongo
    expose:
      - "27017"
  node:
    build: .
    command: "npm start"
    ports:
      - "3000:3000"
    working_dir: /shellshare
    environment:
      - MONGO_URL=mongodb://mongo:27017/shellshare
      - NODE_ENV=production
      # - HOST=
    depends_on:
      - mongo
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:3000"]
      interval: 5m30s
      timeout: 3s
      retries: 3
vitorbaptista commented 1 year ago

Hey @veixus, thanks for the debugging. I think the best way is to change the https://github.com/vitorbaptista/shellshare/blob/master/Dockerfile, adding at the end:

EXPOSE 3000
CMD npm start

If you have the time and would like to do it, could you try these changes and submit a pull request?

veixus commented 1 year ago

Hello. Thank you for a fast reply. This suggestion seems to also work. I added this to Dockerfile and did a fresh setup. It now starts normally. I also have another problem, which im planning to submit a report soon.