Mikuの鬆

Mikuの鬆

心有多宽,世界就有多远

Deploy Outline with Docker and use GitHub as the OAuth service

Preface#

Recently, the organization I belong to, Mu Chuang She, needed to deploy a document collaboration program. After some selection (actually, we had used it before), we chose Outline as the document collaboration program. I glanced at the online deployment tutorial, which was still abstract. In fact, if we don't consider integrating Nginx, it's not particularly difficult because it doesn't require special permission management and allocation. Therefore, I directly created an OAuth App in the Mu Chuang She GitHub organization as a login verification method, saving the trouble of building an SSO service.

Preparation#

  • A server (recommended at least 1c2g) with Docker and Docker Compose installed
  • A domain name, preferably a top-level domain

Services#

  • Outline (the main application)
  • PostgreSQL (database)
  • Redis (cache database)
  • Minio (object storage service)

Deployment#

Please first install Docker and Docker Compose services. If you have installed 1Panel as the server panel, it already comes with the relevant services. The deployment is divided into three parts: the first part is to deploy Minio and set up the file object storage service, the second part is to obtain GitHub OAuth related settings, and the third part is to deploy Outline related services.

You can also use an object storage service compatible with the AWS S3 protocol as the object storage for Outline, such as CloudFlare R2, Bifeng Cloud, Tencent Cloud OSS, etc.

If you are using an online object storage service, you can skip deploying Minio and directly start deploying Outline. Refer to your object storage service documentation to fill in the relevant secret information and Endpoint.

Deploy Minio#

Create a folder to place the deployment-related files, such as /opt/Minio, use the following command to create the relevant folder and navigate to the directory, then create the relevant files.

Below is an example of the docker-compose.yml file

You also need to create a .env file in the directory where the Docker Compose file is placed and fill in the following content. It is recommended to modify the relevant account and password information for security.

Use Nginx to reverse proxy the Minio service, where port 9502 is the HTTP port for the Minio service, and port 9503 is the API port for the Minio service.

Example: localhost:9502 -> https://minio.example.com localhost:9503 -> https://api-minio.example.com

After deployment is complete, please visit https://minio.example.com and log in using the set username and password.

After logging in, set the Region to cn-1 in the settings, and add a bucket named outline in Bucket to store outline data, setting the access permission to private.

Optional Operation:

Add a user in Bucket -> outline -> Access -> User for Outline service to access the Minio service.

Configure GitHub OAuth#

  1. Visit GitHub and log in
  2. Go to the OAuth Apps page (you can also click: upper right corner avatar - Settings - Developer Settings - OAuth Apps)
  3. Click New OAuth App
  4. Fill in the Register a new OAuth application form
  • Application name: You can fill it in yourself, for example, outline
  • Homepage URL: Fill in the homepage URL of Outline
  • Authorization callback URL: Fill in <Homepage URL>/auth/oidc.callback, where <Homepage URL> needs to be replaced with the homepage URL of Outline
  1. Click the Register application button to enter the application details page
  2. Click the Generate a new client secret button
  3. Note down the Client ID and Client secret for filling in environment variables later (note that the Client secret is only displayed once at creation and cannot be queried later; if lost, you can click the button again to create a new one)

Deploy Outline#

Like Minio, create a folder to place the deployment-related files, such as /opt/Outline, use the following command to create the relevant folder and navigate to the directory, then create the relevant files.

Below is an example of the docker-compose.yml file

Please read the following configuration line by line in detail and modify according to the actual situation, paying attention to relevant spellings!

Like Minio, create a .env file in the directory where the Docker Compose file is placed and copy the following content:

After starting the service, use Nginx to reverse proxy the Outline service, where port 9303 is the HTTP port for the Outline service.

Example: localhost:9303 -> https://docs.example.com

Visit the homepage of the deployed Outline in your browser (for example, https://docs.example.com), select Log in with GitHub, and if configured correctly, you will be redirected to the GitHub authorization page, where you can authorize login using your GitHub information.

This article was synchronized and updated to xLog by Mix Space. The original link is https://www.sotkg.com/posts/site/7

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.