|
| 1 | +--- |
| 2 | +type: docs |
| 3 | +linkTitle: Moodle |
| 4 | +title: Moodle |
| 5 | +description: Deploy Outline team knowledge base and wiki on Clever Cloud with detailed tutorials and best practices |
| 6 | +keywords: |
| 7 | +- outline |
| 8 | +- knowledge base |
| 9 | +- wiki |
| 10 | +- collaborative |
| 11 | +- Node.js |
| 12 | +- postgresql |
| 13 | +aliases: |
| 14 | +- /outline |
| 15 | +draft: false |
| 16 | +--- |
| 17 | + |
| 18 | + [Outline](https://getoutline.com) is an open source team knowledge base and wiki that helps teams organize, share, and collaborate on documentation. Built for modern teams, it offers a clean, fast interface with powerful features for creating and maintaining company knowledge. |
| 19 | + |
| 20 | +This doc explains how to configure Outline from source, using the Clever Cloud console. For an alternative using the [Clever Cloud CLI](https://github.com/CleverCloud/clever-tools) there is a complete example in [this repository](https://github.com/CleverCloud/outline-example). |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +## How to Configure and Deploy Outline on Clever Cloud |
| 26 | + |
| 27 | +{{% steps %}} |
| 28 | + |
| 29 | +### Initialize repository and download Outline |
| 30 | + |
| 31 | +Create a new `outline` folder for Outline and, inside it, initialize a Git repository with `git init`. |
| 32 | + |
| 33 | +Download the latest release of Outline from [https://github.com/outline/outline/releases](GitHub) and expand it in `outline` folder. |
| 34 | + |
| 35 | + |
| 36 | +### Create a Node application |
| 37 | + |
| 38 | +On Clever Cloud Console, click **Create** > **An application** and choose a [Node.js](/developers/doc/applications/nodejs) application with Git deployment. |
| 39 | + |
| 40 | +Select at least an `S` plan. Smaller instances can make the build to fail. |
| 41 | + |
| 42 | + |
| 43 | +### Create a PostgreSQL add-on |
| 44 | + |
| 45 | +On Clever Cloud Console, click **Create** > **An add-on** and choose a [PostgreSQL](/developers/doc/addons/postgresql/) add-on. |
| 46 | + |
| 47 | +Select at least an `XSS` plan. |
| 48 | + |
| 49 | +Link the add-on to the application previously created. |
| 50 | + |
| 51 | + |
| 52 | +### Create a Redis add-on |
| 53 | + |
| 54 | +On Clever Cloud Console, click **Create** > **An add-on** and choose a [Redis](/developers/doc/addons/redis/) add-on. |
| 55 | + |
| 56 | +Link the add-on to the application previously created. |
| 57 | + |
| 58 | + |
| 59 | +### Create a Cellar S3 Object Storage add-on |
| 60 | + |
| 61 | +On Clever Cloud Console, click **Create** > **An add-on** and choose a [Cellar S3 Object Storage](/developers/doc/addons/cellar/) add-on. |
| 62 | + |
| 63 | +Link the add-on to the application previously created. |
| 64 | + |
| 65 | + |
| 66 | +### Set Up Domain |
| 67 | + |
| 68 | +Outline needs an URL declared in variables to work properly. You can set it up in **Domains names**, from your application menu. If you don't have a domain name yet, you can use a `cleverapp.io` subdomain provided by Clever Cloud for test purposes. |
| 69 | + |
| 70 | +### Generate a <secret_key> and an <utils_secret> |
| 71 | + |
| 72 | +Using for example [OpenSSL](https://openssl-library.org/). |
| 73 | + |
| 74 | +In a Linux/Mac shell: |
| 75 | + |
| 76 | +```bash |
| 77 | +SECRET_KEY=$( openssl rand -hex 32 ) |
| 78 | +UTILS_SECRET=$( openssl rand -hex 32 ) |
| 79 | +echo "<secret_key>: $SECRET_KEY \n<utils_secret>: $UTILS_SECRET" |
| 80 | +``` |
| 81 | + |
| 82 | +### Choose a S3 bucket name |
| 83 | + |
| 84 | +As explained in the [Cellar S3 doc](https://www.clever.cloud/developers/doc/addons/cellar/), Buckets' names are global for every region. You can’t give the same name to two different buckets in the same region, because the URL already exists in the Cellar cluster on this region. |
| 85 | + |
| 86 | +Unless you have a better option, use the Outline domain as bucket name. |
| 87 | + |
| 88 | +### Configure environment variables |
| 89 | + |
| 90 | +In the Clever Cloud console, go to the Outline Node.js application you've created and, in the **Environment variables** section, inject the following environment variables into the application: |
| 91 | + |
| 92 | +```env |
| 93 | +URL="<outline_domain>" |
| 94 | +NODE_ENV="production" |
| 95 | +PORT="8080" |
| 96 | +CC_NODE_DEV_DEPENDENCIES="install" |
| 97 | +CC_POST_BUILD_HOOK="NODE_ENV=production && yarn build" |
| 98 | +WEB_CONCURRENCY="2" |
| 99 | +DEFAULT_LANGUAGE="en_US" |
| 100 | +SECRET_KEY="<secret_key> |
| 101 | +UTILS_SECRET="<utils_secret>" |
| 102 | +``` |
| 103 | + |
| 104 | +Now inject the add-ons credentials: |
| 105 | + |
| 106 | +```env |
| 107 | +DATABASE_URL "<POSTGRESQL_ADDON_URI value>" |
| 108 | +REDIS_URL "<REDIS_URL value>" |
| 109 | +FILE_STORAGE="s3" |
| 110 | +AWS_S3_UPLOAD_BUCKET_URL="https://<CELLAR_ADDON_HOST value>" |
| 111 | +AWS_S3_UPLOAD_BUCKET_NAME=<bucket_name> |
| 112 | +AWS_ACCESS_KEY_ID="<CELLAR_ADDON_KEY_ID value>" |
| 113 | +AWS_SECRET_ACCESS_KEY="<CELLAR_ADDON_KEY_SECRET value>" |
| 114 | +AWS_S3_FORCE_PATH_STYLE="true" |
| 115 | +AWS_S3_ACL="private" |
| 116 | +AWS_REGION="us" |
| 117 | +``` |
| 118 | + |
| 119 | +### Setting the S3 policies |
| 120 | + |
| 121 | +For Outline to use Cellar S3 as storage for its content files, you need to configure specific S3 bucket policies. These policies ensure that Outline can properly read, write, and manage files in your Cellar bucket. |
| 122 | + |
| 123 | +Unless you have a better option, use [s3cmd](https://s3tools.org/s3cmd) to apply these policies to your bucket. Here are the required policies: |
| 124 | + |
| 125 | +```json |
| 126 | +{ |
| 127 | + "Version": "2012-10-17", |
| 128 | + "Statement": [ |
| 129 | + { |
| 130 | + "Sid": "PublicReadForGetBucketObjects", |
| 131 | + "Effect": "Allow", |
| 132 | + "Principal": "*", |
| 133 | + "Action": ["s3:GetObject"], |
| 134 | + "Resource": ["arn:aws:s3:::$BUCKET/*"] |
| 135 | + } |
| 136 | + ] |
| 137 | +} |
| 138 | +``` |
| 139 | + |
| 140 | +First, configure s3cmd with your Cellar credentials: |
| 141 | + |
| 142 | +```bash |
| 143 | +s3cmd --configure |
| 144 | +``` |
| 145 | + |
| 146 | +When prompted, use the following values: |
| 147 | +- Access Key: Your `CELLAR_ADDON_KEY_ID` |
| 148 | +- Secret Key: Your `CELLAR_ADDON_KEY_SECRET` |
| 149 | +- Default Region: `us-east-1` |
| 150 | +- S3 Endpoint: Your `CELLAR_ADDON_HOST` |
| 151 | +- DNS-style bucket: Yes |
| 152 | + |
| 153 | +Then apply the policy using s3cmd: |
| 154 | + |
| 155 | +```bash |
| 156 | +s3cmd setpolicy policy.json s3://<bucket_name> |
| 157 | +``` |
| 158 | + |
| 159 | +You also need to configure CORS (Cross-Origin Resource Sharing) for your bucket. Create a `cors.xml` file with the following configuration: |
| 160 | + |
| 161 | +```xml |
| 162 | +<CORSConfiguration> |
| 163 | + <CORSRule> |
| 164 | + <AllowedOrigin>*</AllowedOrigin> |
| 165 | + <AllowedMethod>GET</AllowedMethod> |
| 166 | + <AllowedMethod>PUT</AllowedMethod> |
| 167 | + <AllowedMethod>POST</AllowedMethod> |
| 168 | + <AllowedMethod>DELETE</AllowedMethod> |
| 169 | + <AllowedHeader>*</AllowedHeader> |
| 170 | + <ExposeHeader>ETag</ExposeHeader> |
| 171 | + <MaxAgeSeconds>3000</MaxAgeSeconds> |
| 172 | + </CORSRule> |
| 173 | +</CORSConfiguration> |
| 174 | +``` |
| 175 | + |
| 176 | +Apply the CORS configuration using s3cmd: |
| 177 | + |
| 178 | +```bash |
| 179 | +s3cmd setcors cors.xml s3://<bucket_name> |
| 180 | +``` |
| 181 | + |
| 182 | +### Configure Authentication |
| 183 | + |
| 184 | +<!-- vale off --> |
| 185 | +At least **one of either** Google, Slack, Discord, or Microsoft is required for a working installation or you'll have no sign-in options. |
| 186 | +<!-- vale on --> |
| 187 | + |
| 188 | +Choose one or more of the following authentication providers and add the corresponding environment variables to your Clever Cloud application: |
| 189 | + |
| 190 | +#### Google OAuth |
| 191 | + |
| 192 | +```env |
| 193 | +GOOGLE_CLIENT_ID="<your_google_client_id>" |
| 194 | +GOOGLE_CLIENT_SECRET="<your_google_client_secret>" |
| 195 | +``` |
| 196 | + |
| 197 | +#### Slack OAuth |
| 198 | + |
| 199 | +```env |
| 200 | +SLACK_CLIENT_ID="<your_slack_client_id>" |
| 201 | +SLACK_CLIENT_SECRET="<your_slack_client_secret>" |
| 202 | +``` |
| 203 | + |
| 204 | +#### Discord OAuth |
| 205 | + |
| 206 | +```env |
| 207 | +DISCORD_CLIENT_ID="<your_discord_client_id>" |
| 208 | +DISCORD_CLIENT_SECRET="<your_discord_client_secret>" |
| 209 | +``` |
| 210 | + |
| 211 | +#### Microsoft OAuth |
| 212 | + |
| 213 | +```env |
| 214 | +AZURE_CLIENT_ID="<your_azure_client_id>" |
| 215 | +AZURE_CLIENT_SECRET="<your_azure_client_secret>" |
| 216 | +``` |
| 217 | + |
| 218 | + |
| 219 | +### Deploy |
| 220 | + |
| 221 | +Get the remote in your application menu > **Information** > **Deployment URL** and add it to Git with `git remote add clever <clever-remote-url>`. Then, push your code with `git push clever -u master` |
| 222 | + |
| 223 | +💡 If you get a reference error when pushing, try this: `git push clever main:master`. |
| 224 | + |
| 225 | +{{% /steps %}} |
| 226 | + |
| 227 | + |
| 228 | +## 🎓 Further Help |
| 229 | + |
| 230 | +{{< cards >}} |
| 231 | + {{< card link="/developers/doc/applications/nodejs" title="Node.js" subtitle="Deploy a Node.js application on Clever Cloud" icon="node" >}} |
| 232 | + {{< card link="/developers/doc/addons/cellar" title="Cellar S3 Object Storage" subtitle="Object Storage for your apps" icon="fsbucket" >}} |
| 233 | + {{< card link="/developers/doc/addons/postgresql" title="PostgreSQL" icon="mysql" subtitle="Your self-hosted managed relational database" >}} |
| 234 | + {{< card link="https://docs.getoutline.com/s/hosting/doc/from-source-BlBxrNzMIP" title="Installing Outline from source" subtitle="Check Outline installation guide" icon="outline" >}} |
| 235 | +{{< /cards >}} |
0 commit comments