diff --git a/README.md b/README.md index 9a3a246f3..76504514c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ First make sure you have these dependencies met: Then checkout and run HashBrown: ``` -git clone https://github.com/Putaitu/hashbrown-cms.git -b stable --single-branch --recursive +git clone https://github.com/HashBrownCMS/hashbrown-cms.git -b stable --single-branch --recursive cd ./hashbrown-cms npm install --production node hashbrown.js @@ -31,7 +31,7 @@ npm install --production - [Documentation](http://hashbrown.rocks/docs) ## Contribute -If you'd like to contribute to HashBrown development, you can make a pull request to [our repo](https://github.com/Putaitu/hashbrown-cms) or contact us about becoming a collaborator +If you'd like to contribute to HashBrown development, you can make a pull request to [our repo](https://github.com/HashBrownCMS/hashbrown-cms) or contact us about becoming a collaborator ## Ask a question Here: [/r/HashBrownCMS/](https://www.reddit.com/r/HashBrownCMS/) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..576fa3b15 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,41 @@ +#################### +# A docker compose config for HashBrown CMS +# +# For this to work, please create a database.cfg file in the /config/ directory +# The contents of the file should look like this: { "url": "mongodb" } +#################### + +version: "3.4" + +volumes: + v-hashbrown-mongodb: ~ + v-hashbrown-storage: ~ + +networks: + n-hashbrown: ~ + +services: + node: + image: node:alpine + ports: + - "8080:8080" + depends_on: + - mongodb + networks: + - n-hashbrown + restart: unless-stopped + command: "node /opt/hashbrown-cms" + volumes: + - "./:/opt/hashbrown-cms" + - "v-hashbrown-storage:/opt/hashbrown-cms/storage" + - "/etc/localtime:/etc/localtime:ro" + + mongodb: + image: mongo + networks: + - n-hashbrown + restart: unless-stopped + volumes: + - "v-hashbrown-mongodb:/data/db" + - "v-hashbrown-storage:/opt/hashbrown-cms/storage" + - "/etc/localtime:/etc/localtime:ro" diff --git a/package.json b/package.json index a3b3930a5..7ae1052b9 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hashbrown-cms", "repository": "https://github.com/Putaitu/hashbrown-cms.git", - "version": "1.0.5", + "version": "1.0.6", "description": "The pluggable CMS", "main": "hashbrown.js", "scripts": { diff --git a/src/Server/Controllers/ViewController.js b/src/Server/Controllers/ViewController.js index 042184e4e..658ef7a11 100644 --- a/src/Server/Controllers/ViewController.js +++ b/src/Server/Controllers/ViewController.js @@ -63,38 +63,13 @@ class ViewController extends Controller { // First time setup app.get('/setup/:step', (req, res) => { - let check = () => { - switch(parseInt(req.params.step)) { - case 1: - return ConfigHelper.exists('database') - .then((exists) => { - if(!exists) { - return Promise.resolve(); - } - - return Promise.reject(new Error('Database config exists already')); - }); - - case 2: - return UserHelper.getAllUsers() - .then((users) => { - if(!users || users.length < 1) { - return Promise.resolve(); - } - - return Promise.reject(new Error('Cannot create first admin, users already exist. If you lost your credentials, please assign the the admin from the commandline.')); - }); + return UserHelper.getAllUsers() + .then((users) => { + if(users && users.length > 0) { + return res.status(400).render('error', { message: 'Cannot create first admin, users already exist. If you lost your credentials, please assign the the admin from the commandline.' }); } - return Promise.reject(new Error('No such step "' + req.params.step + '"')); - }; - - check() - .then(() => { res.render('setup', { step: req.params.step }); - }) - .catch((e) => { - res.status(400).render('error', { message: e.message }); }); }); diff --git a/src/Server/Helpers/DatabaseHelper.js b/src/Server/Helpers/DatabaseHelper.js index d9a8aaab7..1c5792483 100644 --- a/src/Server/Helpers/DatabaseHelper.js +++ b/src/Server/Helpers/DatabaseHelper.js @@ -171,6 +171,8 @@ class DatabaseHelper { args.push('--archive=' + dumpPath + '/' + timestamp + '.hba'); + debug.log('Dumping database "' + databaseName + '" to ' + dumpPath + '/' + timestamp + '.hba...', this); + let mongodump = Spawn('mongodump', args); mongodump.stdout.on('data', (data) => { @@ -183,9 +185,11 @@ class DatabaseHelper { mongodump.on('exit', (code) => { if(code != 0) { + debug.log('Dumping database failed!', this); reject(new Error('mongodump exited with status code ' + code)); } else { + debug.log('Dumping database succeeded!', this); resolve(timestamp); } diff --git a/src/Server/Views/setup.pug b/src/Server/Views/setup.pug index 524c98f2f..f9cb84725 100644 --- a/src/Server/Views/setup.pug +++ b/src/Server/Views/setup.pug @@ -18,12 +18,10 @@ html form(class='page--setup__step page--setup__step-' + step, data-step=step, action='/api/user/first') .page--setup__step__heading - if(step == 1) - h2 Create your first admin account + h2 Create your first admin account .page--setup__step__body - if(step == 1) - input.widget.widget--input.tall.expanded.text(required=true, title='Your username', type='text', name='username', placeholder='Username') - input.widget.widget--input.tall.expanded.text(required=true, title='Your password', type='password', name='password', placeholder='Password') + input.widget.widget--input.tall.expanded.text(required=true, title='Your username', type='text', name='username', placeholder='Username') + input.widget.widget--input.tall.expanded.text(required=true, title='Your password', type='password', name='password', placeholder='Password') input.widget.widget--button.expanded(type='submit', value='Next')