From cb0da79be3b272063380fa5ee73780d24a9f5f6d Mon Sep 17 00:00:00 2001 From: mogita Date: Fri, 31 May 2019 11:26:26 +0800 Subject: [PATCH 1/6] Update installation guide --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 631a849c..10dc09fb 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,10 @@ If you'd like to run your own copy of Outline or contribute to development then Outline requires the following dependencies: +- Node.js >= 8.11 - Postgres >=9.5 - Redis +- AWS S3 storage bucket for media and other attachments - Slack or Google developer application for OAuth In development you can quickly get an environment running using Docker by following these steps: @@ -33,6 +35,28 @@ In development you can quickly get an environment running using Docker by follow else should work well for development. 1. Run `make up`. This will download dependencies, build and launch a development version of Outline. +For production deployment by building from scratch, you can follow these steps: + +1. Clone this repo and install dependencies with `npm install` or `yarn` + + > Requires [Node.js and npm](https://nodejs.org/) installed, [yarn](https://yarnpkg.com) is optional if you prefer + +2. Build the web app with `npm run build:webpack` or `yarn build:webpack` + +3. Migrate database schema with `npm run sequelize:migrate ` or `yarn sequelize:migrate` + +4. Copy the file `.env.sample` to `.env` and fill out the essential fields: + + Database, Change secret key, Redis, URL if you have your own domain name, Slack key or Google client ID or both, AWS credentials + +5. Start the service with any daemon tools you prefer. Take PM2 for example, `NODE_ENV=production pm2 start index.js --name outline ` + +6. Visit http://you_server_ip:3000 and you should be able to see Outline page + + > Port number can be changed in the `.env` file + +7. (Optional) You can add an `nginx` reverse proxy to serve your instance of Outline for a clean URL without the port number, support SSL, etc. + ## Development ### Server From 4448ea8e4b7c0c68bd00aebacbd760acda95d9b4 Mon Sep 17 00:00:00 2001 From: mogita Date: Fri, 31 May 2019 11:27:01 +0800 Subject: [PATCH 2/6] Update placeholders --- .env.sample | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.env.sample b/.env.sample index 65065fa2..c1076e3a 100644 --- a/.env.sample +++ b/.env.sample @@ -4,11 +4,11 @@ # # Please use `openssl rand -hex 32` to create SECRET_KEY -DATABASE_URL=postgres://user:pass@postgres:5432/outline -DATABASE_URL_TEST=postgres://user:pass@postgres:5432/outline-test -SECRET_KEY=F0E5AD933D7F6FD8F4DBB3E038C501C052DC0593C686D21ACB30AE205D2F634B +DATABASE_URL=postgres://user:pass@localhost/outline +DATABASE_URL_TEST=postgres://user:pass@localhost/outline-test +SECRET_KEY=generate_a_new_key PORT=3000 -REDIS_URL=redis://redis:6379 +REDIS_URL=redis://localhost:6379 URL=http://localhost:3000 DEPLOYMENT=self ENABLE_UPDATES=true @@ -17,8 +17,8 @@ WEBSOCKETS_ENABLED=true DEBUG=sql,cache,presenters,events # Third party signin credentials (at least one is required) -SLACK_KEY=71315967491.XXXXXXXXXX -SLACK_SECRET=d2dc414f9953226bad0a356cXXXXYYYY +SLACK_KEY=get_a_key_from_slack +SLACK_SECRET=get_the_secret_of_above_key GOOGLE_CLIENT_ID= GOOGLE_CLIENT_SECRET= @@ -35,10 +35,11 @@ BUGSNAG_KEY= GITHUB_ACCESS_TOKEN= # AWS credentials (optional in dev) -AWS_ACCESS_KEY_ID=notcheckedindev -AWS_SECRET_ACCESS_KEY=notcheckedindev -AWS_S3_UPLOAD_BUCKET_URL=http://s3:4569 -AWS_S3_UPLOAD_BUCKET_NAME=outline-dev +# Update the bucket URL according to your choice on AWS +AWS_ACCESS_KEY_ID=get_a_key_from_aws +AWS_SECRET_ACCESS_KEY=get_the_secret_of_above_key +AWS_S3_UPLOAD_BUCKET_URL=https://s3-ap-southeast-1.amazonaws.com +AWS_S3_UPLOAD_BUCKET_NAME=bucket-name-here AWS_S3_UPLOAD_MAX_SIZE=26214400 # Emails configuration (optional) From c865c57f92f00102079c4e87723e73e33630c8ba Mon Sep 17 00:00:00 2001 From: mogita Date: Mon, 24 Jun 2019 11:22:16 +0800 Subject: [PATCH 3/6] Add port number --- .env.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index c1076e3a..27c4fb9c 100644 --- a/.env.sample +++ b/.env.sample @@ -4,7 +4,7 @@ # # Please use `openssl rand -hex 32` to create SECRET_KEY -DATABASE_URL=postgres://user:pass@localhost/outline +DATABASE_URL=postgres://user:pass@localhost:5432/outline DATABASE_URL_TEST=postgres://user:pass@localhost/outline-test SECRET_KEY=generate_a_new_key PORT=3000 From fefb9d0c1372ba4487474e269b09901df6d7860d Mon Sep 17 00:00:00 2001 From: mogita Date: Mon, 24 Jun 2019 11:22:56 +0800 Subject: [PATCH 4/6] Prefer yarn for building --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 10dc09fb..c24207d6 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ In development you can quickly get an environment running using Docker by follow For production deployment by building from scratch, you can follow these steps: -1. Clone this repo and install dependencies with `npm install` or `yarn` +1. Clone this repo and install dependencies with `yarn` or `npm install` - > Requires [Node.js and npm](https://nodejs.org/) installed, [yarn](https://yarnpkg.com) is optional if you prefer + > Requires [Node.js, npm](https://nodejs.org/) and [yarn](https://yarnpkg.com) installed -2. Build the web app with `npm run build:webpack` or `yarn build:webpack` +2. Build the web app with `yarn build:webpack` or `npm run build:webpack` -3. Migrate database schema with `npm run sequelize:migrate ` or `yarn sequelize:migrate` +3. Migrate database schema with `yarn sequelize:migrate` or `npm run sequelize:migrate ` 4. Copy the file `.env.sample` to `.env` and fill out the essential fields: From 4bea33eae0aa26d90c61eb38faad9713d38b03e1 Mon Sep 17 00:00:00 2001 From: mogita Date: Mon, 24 Jun 2019 11:31:14 +0800 Subject: [PATCH 5/6] Add port number to test db --- .env.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.sample b/.env.sample index cf1c383f..9d6e8dfe 100644 --- a/.env.sample +++ b/.env.sample @@ -5,7 +5,7 @@ # Please use `openssl rand -hex 32` to create SECRET_KEY DATABASE_URL=postgres://user:pass@localhost:5432/outline -DATABASE_URL_TEST=postgres://user:pass@localhost/outline-test +DATABASE_URL_TEST=postgres://user:pass@localhost:5432/outline-test SECRET_KEY=generate_a_new_key PORT=3000 REDIS_URL=redis://localhost:6379 From 1c8e0746623279a55cb1e4c830cf8dd53f79df81 Mon Sep 17 00:00:00 2001 From: mogita Date: Mon, 24 Jun 2019 13:27:22 +0800 Subject: [PATCH 6/6] fix: remove redundant line breaks --- server/models/Collection.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/models/Collection.js b/server/models/Collection.js index f030371e..192613d2 100644 --- a/server/models/Collection.js +++ b/server/models/Collection.js @@ -239,7 +239,6 @@ Collection.prototype.updateDocument = async function( this.documentStructure = updateChildren(this.documentStructure); await this.save({ transaction }); await transaction.commit(); - } catch (err) { if (transaction) { await transaction.rollback(); @@ -296,7 +295,6 @@ Collection.prototype.removeDocumentInStructure = async function( transaction, }); await transaction.commit(); - } catch (err) { if (transaction) { await transaction.rollback();