diff options
| author | Jules <jules@asdf.us> | 2017-12-12 22:13:51 -0500 |
|---|---|---|
| committer | Jules <jules@asdf.us> | 2017-12-12 22:13:51 -0500 |
| commit | e0801581be8fa061e44671bb8dd25260eb6b3a67 (patch) | |
| tree | cd93af93a9d540b4f7c0fafc91d4f0b68153c161 | |
| parent | 67736c2debc11fdcc397cdc5b253ca4de6630b81 (diff) | |
add to readme and fix server for proxy situation
| -rw-r--r-- | README | 54 | ||||
| -rw-r--r-- | bucky/app/index.js | 10 |
2 files changed, 48 insertions, 16 deletions
@@ -1,27 +1,57 @@ -bucky -===== +# bucky -# npm install -# brew install mysql (used for main database) -# brew install mongodb (used for sessions) -# set up the mysql database: +## Install +### osx + +``` +npm install +brew install mysql (used for main database) +brew install mongodb (used for sessions) +``` + +### MySQL + +``` mysql -uroot CREATE USER 'carbon'@'localhost' IDENTIFIED BY 'the_password'; CREATE DATABASE bucky; USE bucky; GRANT ALL PRIVILEGES ON bucky.* TO 'carbon'@'localhost'; +``` + +Copy .env-sample to .env and edit the values accordingly. -# copy .env-sample to .env and edit the values to correspond -# load up a copy of bucky +#### Loading an old bucky db dump -scp carbon@carbonpictures.com:bucky-20150903.sql . +``` mysql -u carbon -p bucky < bucky-20150903.sql +``` + +### MongoDB + +Mongo is only used for session management and will ideally be replaced. + +### Berkeley DB -# run the migrations (makes most blob fields into text) +Used for the search, `libdb` should already be installed on your system. -knex migrate:latest +## Building the search index -# node index +This script should be run regularly to keep the search index fresh: + +``` +npm run build:search +``` + +## Running + +You may have to include the .so files for bdb: `export LD_LIBRARY_PATH=/var/www/bucky.asdf.us/bucky3/node_modules/berkeleydb/lib` + +``` +npm start +``` Server will be running at http://lvh.me:5000/ + + diff --git a/bucky/app/index.js b/bucky/app/index.js index 704802c..efa5fdd 100644 --- a/bucky/app/index.js +++ b/bucky/app/index.js @@ -21,14 +21,16 @@ var app, server var site = module.exports = {} site.init = function(){ app = express() + app.enable('trust proxy'); app.set('port', process.env.PORT || 5000) app.use(favicon(__dirname + '../../../public/favicon.ico')) app.use(bodyParser.json()) - + app.use(cookieParser()); app.use(session({ - key: 'bucky.sid', secret: 'argonauts', - cookie: { domain: '.' + process.env.HOST_NAME, maxAge: 43200000000 }, + proxy: true, + key: 'bucky.sid', + cookie: {secure: true, domain: '.' + process.env.HOST_NAME, maxAge: 43200000000 }, store: new MongoStore({ url: 'mongodb://localhost/buckySessionDb' // type: 'mongodb', @@ -41,7 +43,7 @@ site.init = function(){ resave: true, saveUninitialized: false, })) - app.use(csurf({ cookie: false })) + app.use(csurf({ cookie: true })) app.disable('x-powered-by') app.use(express.query()) |
