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

Another endless reload/redirect #68

Open
jpetitte opened this issue Oct 31, 2018 · 5 comments
Open

Another endless reload/redirect #68

jpetitte opened this issue Oct 31, 2018 · 5 comments

Comments

@jpetitte
Copy link

Hi there,

Based on other questions, the most likely reason for this is a problem with redis configuration; however, I'm running this locally, with the default value of null for the session. Please see my config below.

const path = require('path');

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

  /**
   * The fully qualified domain + path that Nucleus is being hosted at
   */
  baseURL: 'http://localhost:8888',

  /**
   * The data store to use when persisting plugins and versions.  Current possible values
   * are "sequelize", ensure you also supply valid connection details for your
   * chosen strategy below.
   *
   * PR's welcome to add another data store.
   */
  dbStrategy: 'sequelize',

  /**
   * Sequelize connection information, please note all options are required
   *
   * database: The name of the database to connect to
   * dialect: The type of SQL database this is, check sequelize docs for more info
   * username: Username to use when connecting
   * password; Password to use when connecting
   * host: Hostname of database
   * port: Port to use when connecting
   * storage: Path to sqlite file, only used for sqlite dialect
   */
  sequelize: {
    dialect: 'sqlite',
    storage: path.resolve(__dirname, 'db.sqlite'),
  },

  /**
   * The file store to use when persisting update files and metadata.  Current possible
   * values are "s3" and "local" ensure you also supply valid connection details if
   * required for your chosen strategy below.
   *
   * PR's welcome to add another file store.
   */
  fileStrategy: 'local',

  /**
   * Local file configuration
   *
   * root: Path on disk to the root of the static file store
   * staticUrl: The HTTP url to use to access the static file store remotely
   */
  local: {
    root: path.resolve(__dirname, '.files'),
    staticUrl: 'http://localhost:9999'
  },

  /**
   * There is actually no authentication config for s3, all config must be done through the standard AWS
   * environment variables or through EC2 IAM roles.
   *
   * See http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html
   *
   * Bucket / Region / CloudFront config goes here though
   */
  s3: {
    // init: {
    //   endpoint: '' // The alternate endpoint to reach the S3 instance at,
    //   s3ForcePathStyle: true // Always use path style URLs
    // }

    bucketName: '', // The name for your S3 Bucket

    cloudfront: { // If you don't have CloudFront set up and just want to use the S3 bucket set this to "null
      distributionId: '', // The CloudFront distribution ID, used for invalidating files
      publicUrl: '', // Fully qualified URL for the root of the CloudFront proxy for the S3 bucket
    }
  },

  /**
   * The authentication strategy to use when logging users in.  Current possible values are "local",
   * "openid" and "github".  Make you also supply the required authentication details
   */
  authStrategy: 'local',

  /**
   * Local authentication details
   *
   * The `adminIdentifiers` array should be a list of usernames
   *
   * DISCLAIMER: This strategy should ONLY be used for local development and NEVER
   * used in production.  Unicorns cry every time this setting is used in production.
   * Don't make the unicorns cry.
   *
   * displayName: The user friendly name of this user
   * username: A unique identifier to use when this user signs in, please note uniqueness is
   *           not enforced
   * password: Well, uhhh, their password
   * photo: A URL for their profile, entirely optional, just makes things look nicer ;)
   */
  localAuth: [{
    displayName: 'Charlie',
    username: 'charlie',
    password: 'charlie',
    photo: 'https://pbs.twimg.com/profile_images/1219364727/charlie-support_400x400.png'
  }],

  /**
   * OpenID authentication details
   *
   * The `adminIdentifiers` array should be a list of email
   * addresses for users to consider admins
   *
   * realm: The domain that the server is hosted on
   * stateless: Stateless mode for openID
   * profile: Whether to fetch profile information, should normally be true
   * providerURL: Your openID provider URL
   * domain: Domain to restrict email addresses to
   */
  openid: {
    realm: 'http://localhost:8888',
    stateless: true,
    profile: true,
    providerURL: 'https://auth.myservice.com/openid/v2/op',
    domain: 'myservice.com'
  },

  /**
   * GitHub authentication details
   *
   * The `adminIdentifiers` array should be a list of GitHub usernames
   * to consider admins
   *
   * clientID: GitHub API client ID
   * clientSecret: GitHub API clientSecret
   * realm: The domain the server is hosted on
   */
  github: {
    clientID: '',
    clientSecret: ''
  },

  /**
   * See the documentation for your authentication strategy for what this array does
   */
  adminIdentifiers: ['admin@yourdomain.com', 'charlie'],

  /**
   * Session options, in development just leave this as default.
   *
   * IN PRODUCTION PLEASE USE REDIS!
   *
   * type: Can be either "redis" or null
   *
   * redis:
   *   host: The host URL for the redis instance
   *   port: The port for the redis instance
   */
  sessionConfig: {
    type: null,
    secret: 'ThisIsNotSecret',

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

  organization: 'My Company Here',

  /**
   * GPG key to use when signing APT and YUM releases
   *
   * Requires to be unlocked (no password) and have both the private and
   * public key.
   */
  gpgSigningKey: `
this works fine, did not include here
  `,

  /**
   * 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
};

I've been fighting with this for hours, and I feel like I'm missing something so simple. I really hate to put support type questions on here, but after 7 hours of fighting with this, I figured I should just ask.

Notes:

  • I also tried getting the docker version up and running first, but I was getting an infinite loop there as well (I was attempting to connect to redis with that), so I switched over to the manual version for better debugging.
  • I could not get the npm modules to install using node version 10 on Windows (after about 3 hours of fighting). I had to use node version 8 on the linux subsystem for windows (node version 10 also resulted in failure on the subsystem). The culprit seems to be node gyp.
@jpetitte
Copy link
Author

So, to update, I used the test.config.js from src/spec/fixtures, and it worked (in manual). And it worked by accessing port 8888, which isn't specified anywhere in the config. This just goes to show I really don't understand the various pieces. I'm going to continue to try to understand this, but any extra insight that can be provided would be appreciated.

@leofidus
Copy link
Contributor

Node 10 might work with #61 (it's just 2 version changes you can do manually). Though I haven't tried that on Windows.

I don't have any idea about the reload problem. But in case it's any help, my notes for getting to a running Nucleus from a blank ubuntu/debian (probably also Linux Subsystem) look approximately like that:

sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install curl
wget -qO- https://deb.nodesource.com/setup_10.x | sudo -E bash -
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn nodejs build-essential git
sudo apt-get install createrepo rpm gpg dpkg-dev apt-utils gnupg2 gzip sqlite3
sudo npm install -g npm@latest
cd
git clone https://github.com/atlassian/nucleus.git nucleus-server
git remote add leofidus https://github.com/leofidus/nucleus.git
git fetch leofidus
git merge leofidus/feature/ubuntufix
cd nucleus-server
cp config.template.js config.js
yarn
yarn build:server
yarn build:fe:prod
yarn start

Then just open localhost:3030 in a browser

@jpetitte
Copy link
Author

@leofidus thanks for the documentation on your procedure. I'll give it a try and see how it changes things. How did you know to do the last 4 yarn commands?

Also, currently, my local setup is able to connect to a password protected redis instance (I know it connects because redis indicates that another client has connected, which I also believe indicates that the password worked), but then it goes into the infinite loop. If the redis instance is not password protected, but I still have nucleus connect to redis, it works fine.

@leofidus
Copy link
Contributor

leofidus commented Nov 1, 2018

How did you know to do the last 4 yarn commands?

plain yarn is just installing dependencies, the equivaltent of npm install. The other three come from the package.json. yarn start can just be replaced by node lib/index.js, or DEBUG=nucleus* node lib/index.js if you want to know what's actually happening.

If the redis instance is not password protected, but I still have nucleus connect to redis, it works fine

That explains it. See also #67. I simply edited src/rest/auth.ts#L43 to add a password until somebody gets around to making a proper patch.

@factorone
Copy link

factorone commented Jan 18, 2019

It appears that the reason why node-gyp is failing on Windows is due to its inability to download the tarball for sqlite from the remote server (https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v67-win32-x64.tar.gz returns an Access Denied error).

Here's part of the stack trace from my simple yarn attempts on Win 10 with Node 11.x:

Exit code: 1
Command: node-pre-gyp install --fallback-to-build
Arguments:
Directory: C:\Dev\nucleus-1.1.3\node_modules\sqlite3
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.39
node-pre-gyp info using node@11.4.0 | win32 | x64
node-pre-gyp info check checked for "C:\Dev\nucleus-1.1.3\node_modules\sqlite3\lib\binding\node-v67-win32-x64\node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v67-win32-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@11.4.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.13/node-v67-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for sqlite3@3.1.13 and node@11.4.0 (node-v67 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp http Connection closed while downloading tarball file

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