atlassian / nucleus

A configurable and versatile update server for all your Electron apps
Other
398 stars 93 forks source link

Endless reload or redirect #57

Closed karimcitoh closed 6 years ago

karimcitoh commented 6 years ago

Running the Docker image on localhost, does not work, it keeps reloading continuously.

After entering the user and password, all I see is a blank screen continuously refreshing or redirecting to localhost:8987.

This is how my configuration file looks like:

const path = require('path');

module.exports = {

    port: 8987,

    baseURL: 'http://localhost:8987',

    dbStrategy: 'sequelize',

    sequelize: {
        dialect: 'sqlite',
        storage: path.resolve(__dirname, 'db.sqlite'),
    },

    fileStrategy: 'local',

    local: {
        root: path.resolve(__dirname, '.files'),
        staticUrl: 'http://localhost:8988'
    },

    authStrategy: 'local',

    localAuth: [{
        displayName: 'Studio',
        username: 'randomtest',
        password: 'testtest',
        photo: 'https://random.studio/img/favicons/apple-touch-icon.png'
    }],

    adminIdentifiers: ['random'],

    sessionConfig: {
        type: 'redis',
        secret: 'ThisIsNotSecret',
        redis: {
            host: 'localhost',
            port: 6379
        }
    },

    organization: 'Studio',

    /**
    * The default percentage rollout for new releases.  The first release for
    * any channel will always be 100% but all future releases will have a
    * default rollout value of this setting
    */
    defaultRollout: 0,

    gpgSigningKey: `:D too long`
};
factorone commented 6 years ago

I'm also encountering this problem, and I suspect that it's related to the base URL for the static file location being the same as the URL for Nucleus in general. While I don't have this problem on my dev instance of Nucleus (localhost), I'm encountering it on the server I'm attempting to spin it up on for production in AWS.

MarshallOfSound commented 6 years ago

@karimcitoh @factorone If I had to guess your redis configuration is invalid so the sessions aren't being persisted anywhere. That would force you into an infinite login loop

factorone commented 6 years ago

It's definitely related to Nucleus not being able to talk to Redis and vice versa. My guess is I'm not setting the right address for Redis in my Forge config. Since I've got Redis installed directly in my EC2 instance with Nucleus in a Docker container, what's your recommendation for the URL value of Redis in the Forge config (DevOps isn't my strong suit currently, so forgive my ignorance)?

MarshallOfSound commented 6 years ago

Since I've got Redis installed directly in my EC2 instance with Nucleus in a Docker container

I would recommend running redis in a docker container as well and linking the two containers together so that the nucleus container can connect to the redis container.

karimcitoh commented 6 years ago

Alright! I managed to solve this by creating a compose file and properly configuring nucleus. This is not an issue anymore.

version: '2.2'
volumes:
  nucleus_data:
  redis_data:
services:
  nucleus:
    build: "docker/nucleus"
    ports:
      - 8987:8987
      - 8988:8988
    links:
      - redis:redis
    volumes:
      - nucleus_data:/opt/service
  redis:
    image: redis
    ports:
      - 6379:6379
    volumes:
      - redis_data:/data
factorone commented 6 years ago

@karimcitoh Short of turning this into a support forum (apologies to @MarshallOfSound for this), I'm at a loss as to what else needs to be done, as I've scoured as much of the internet as I can in 2 days to figure this out without having it be shown to me directly, and I'm nowhere closer than I was before to getting Redis to play with Nucleus.

I've got Redis up and running in its own container with the default config that comes from the Docker repo, and I've setup the Docker compose file for both Redis and Nucleus as such:

version: "3"

volumes:
  redis_data:
  nucleus_data:

services:

  redis:
    image: redis:latest
    ports:
      - 6379:6379
    volumes:
      - redis_data:/data
    command: redis-server --appendonly yes 
    networks:
      - redis_net
    deploy:
      restart_policy:
        condition: on-failure
        delay: 2s

  nucleus:
    image: maestroinc/nucleus:prod
    ports:
      - "80:3030"
      - "443:3030"
      - "9999:9999"
    volumes:
      - nucleus_data:/opt/service
    networks:
      - redis_net
    depends_on:
      - redis
    deploy:
      restart_policy:
        condition: on-failure
        delay: 2s
    environment:
      NODE_ENV: production
      REDIS_KEY: [ key ]

networks:
  redis_net:

This is my Nucleus config for Redis:

sessionConfig: {
  type: 'redis',
  secret: process.env.REDIS_KEY,

  redis: {
    host: 'localhost',
    port: '6379'
  }
},

I know the answer to this is probably stupid simple, but there is literally nowhere else out there with any kind of insight into this issue and I'm losing my mind trying to get this working.

sayederfanarefin commented 4 years ago

Hello,

I hope you are doing well. I am having an issue with the docker deployment.

This is my docker-compose:

version: "2.2"
volumes:
  nucleus_data:
  redis_data:

services:
  myapp:
    build: .
    container_name: nucleus
    restart: always
    ports:
      - 8888:8888
      - 8080:8080
      - 9999:9999
    links:
      - redis:redis
    volumes:
      - nucleus_data:/opt/service

  redis:
    image: redis
    volumes:
      - ./redis.conf:/usr/local/etc/redis/redis.conf
      - redis_data:/data
    restart: always
    ports:
      - 6379:6379

and my config.js file redis section:

  sessionConfig: {
    type: "redis",
    // secret: 'FRt3PyQX1ltFw1IFV2ysBT4xYdWcKQgm',
    secret: '2eu22mCK6n4G4sr+zPAyZQh9+hCdtuPQGkMXAoF3MnEz4Z3HjRnYXzXbpuGPW/iocO85wO7Ru/v8pqO2',

    redis: {
      host: '0.0.0.0',
      port: '6379'
    }
  },

I am using nginx reverse proxy. It is pointing to 8080 of the docker container from 80 port.

and the base URL section of the config.js is:

module.exports = {
  /**
   * The port to run Nucleus Server on, if the port is in use the server will not start
   */
  port: 8080,

  /**
   * The fully qualified domain + path that Nucleus is being hosted at
   */
  baseURL: 'https://download.blablabla.com:80',

// ....................
}

I am stuck in login loop. I do not know how to proceed. Can you help please?

sayederfanarefin commented 4 years ago

@MarshallOfSound