diff --git a/.env.sample b/.env.sample index 4f290470..620dce54 100644 --- a/.env.sample +++ b/.env.sample @@ -2,11 +2,11 @@ # # Please use `openssl rand -hex 32` to create SECRET_KEY -DATABASE_URL=postgres://user:pass@example.com:5432/outline -DATABASE_URL_TEST=postgres://user:pass@example.com:5432/outline-test +DATABASE_URL=postgres://user:pass@localhost:5432/outline +DATABASE_URL_TEST=postgres://user:pass@localhost:5432/outline-test SECRET_KEY=F0E5AD933D7F6FD8F4DBB3E038C501C052DC0593C686D21ACB30AE205D2F634B PORT=3000 -REDIS_URL=redis://localhost:6379 +REDIS_URL=redis://redis:6379 SLACK_KEY=71315967491.XXXXXXXXXX SLACK_SECRET=d2dc414f9953226bad0a356c794XXXXX URL=http://localhost:3000 @@ -14,9 +14,15 @@ DEPLOYMENT=hosted ENABLE_UPDATES=true GOOGLE_ANALYTICS_ID= +AWS_ACCESS_KEY_ID=notcheckedindev +AWS_SECRET_ACCESS_KEY=notcheckedindev +AWS_S3_UPLOAD_BUCKET_URL=http://localhost:4569 +AWS_S3_UPLOAD_BUCKET_NAME=outline-dev +AWS_S3_UPLOAD_MAX_SIZE=26214400 + SMTP_HOST= SMTP_PORT= SMTP_USERNAME= SMTP_PASSWORD= SMTP_FROM_EMAIL= -SMTP_REPLY_EMAIL= \ No newline at end of file +SMTP_REPLY_EMAIL= diff --git a/README.md b/README.md index 28b25299..5d530ad6 100644 --- a/README.md +++ b/README.md @@ -8,37 +8,27 @@ An open, extensible, knowledge base for your team built using React and Node.js. ## Installation -Outline requires following dependencies to work: +Outline requires the following dependencies: - Postgres >=9.5 - Redis -- S3 bucket configured to support CORS uploads - Slack developer application -To install and run the application: +In development you can quickly can an environment running using Docker by +following these steps: - 1. Install dependencies with `yarn` - 1. Register a Slack app at https://api.slack.com/apps - 1. Copy the file `.env.sample` to `.env` and fill out the keys - 1. Run DB migrations `yarn sequelize db:migrate` - - To run Outline in development mode with server and frontend code reloading: +1. Install [Docker for Desktop](https://www.docker.com) if you don't already have it. +1. Register a Slack app at https://api.slack.com/apps +1. Copy the file `.env.sample` to `.env` and fill out the Slack keys, everything + else should work well for development. +1. Run `make up`. This will download dependencies, build and launch a development version of Outline. -```shell -yarn dev -``` - -To run Outline in production mode: - -```shell -yarn start -``` ## Development ### Server -To enable debugging statements, set the following env vars: +To enable debugging statements, add the following to your `.env` file: ``` DEBUG=sql,cache,presenters diff --git a/server/utils/s3.js b/server/utils/s3.js index 14072b5a..d1ef21ce 100644 --- a/server/utils/s3.js +++ b/server/utils/s3.js @@ -1,6 +1,7 @@ // @flow import crypto from 'crypto'; import moment from 'moment'; +import path from 'path'; import AWS from 'aws-sdk'; import invariant from 'invariant'; import fetch from 'isomorphic-fetch'; @@ -47,7 +48,7 @@ const uploadToS3FromUrl = async (url: string, key: string) => { invariant(AWS_S3_UPLOAD_BUCKET_NAME, 'AWS_S3_UPLOAD_BUCKET_NAME not set'); try { - // $FlowIssue dunno it's fine + // $FlowIssue https://github.com/facebook/flow/issues/2171 const res = await fetch(url); const buffer = await res.buffer(); await s3 @@ -59,7 +60,7 @@ const uploadToS3FromUrl = async (url: string, key: string) => { Body: buffer, }) .promise(); - return `https://s3.amazonaws.com/${AWS_S3_UPLOAD_BUCKET_NAME}/${key}`; + return path.join(process.env.AWS_S3_UPLOAD_BUCKET_URL, key); } catch (e) { bugsnag.notify(e); }