<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CDN Archives - Installing.in</title>
	<atom:link href="https://www.installing.in/tag/cdn/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.installing.in/tag/cdn/</link>
	<description></description>
	<lastBuildDate>Fri, 27 Sep 2019 19:17:13 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">110734269</site>	<item>
		<title>Installing Discourse on Alibabacloud using Directmail and Cloud CDN</title>
		<link>https://www.installing.in/installing-discourse-on-alibabacloud-using-directmail-and-cloud-cdn/</link>
					<comments>https://www.installing.in/installing-discourse-on-alibabacloud-using-directmail-and-cloud-cdn/#respond</comments>
		
		<dc:creator><![CDATA[Rajeev]]></dc:creator>
		<pubDate>Fri, 07 Jun 2019 08:17:52 +0000</pubDate>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Webapp]]></category>
		<category><![CDATA[alibabacloud]]></category>
		<category><![CDATA[CDN]]></category>
		<category><![CDATA[discourse]]></category>
		<category><![CDATA[Forum]]></category>
		<guid isPermaLink="false">https://www.installing.in/?p=418</guid>

					<description><![CDATA[<p>I wrote this tutorial in July 2018 for Alibabacloud Techshare. You can find the edited copy of this tutorial on Alibaba cloud blog. Publishing my original copy here.&#160; Discourse is... </p>
<p>The post <a href="https://www.installing.in/installing-discourse-on-alibabacloud-using-directmail-and-cloud-cdn/">Installing Discourse on Alibabacloud using Directmail and Cloud CDN</a> appeared first on <a href="https://www.installing.in">Installing.in</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><em>I wrote this tutorial in July 2018 for Alibabacloud Techshare. You can find the edited copy of this tutorial on <a href="https://www.alibabacloud.com/blog/how-to-install-discourse-on-alibaba-cloud-using-directmail-and-cdn_593866" target="_blank" rel="noopener noreferrer">Alibaba cloud blog</a>. Publishing my original copy here.&nbsp;</em></p>
<hr>
<p>Discourse is a modern style free and open source forum system that runs on Ruby on rails, uses PostgreSQL as database system and redis cache. It is used by many top companies to develop communities around their products and to provide support.</p>
<p>For installation Discourse team recommends a VPS or dedicated server with 2 GB RAM, although for smaller communities it can be installed on server with 1GB RAM with swap enabled . You also need SMTP for sending email and CDN for delivering static content.</p>
<p>You can get all these services at Alibaba Cloud. <a href="https://account-intl.aliyun.com/register/intl_register.htm?biz_params=%7B%22intl%22%3A%22%7B%5C%22referralCode%5C%22%3A%5C%22a4y96k%5C%22%7D%22%7D" target="_blank" rel="noopener noreferrer">Register with Alibaba Cloud to get $300 credit</a> to check out these and many more services.</p>
<p>In this guide we will be installing Discourse on Alibaba Cloud&#8217;s <a href="https://www.alibabacloud.com/product/ecs">Elastic Compute Service (ECS)</a> and use <a href="https://www.alibabacloud.com/product/directmail" target="_blank" rel="noopener noreferrer">Directmail</a> for sending emails and <a href="https://www.alibabacloud.com/product/cdn">Cloud CDN</a> for static content delivery.</p>
<h2>Prerequisites</h2>
<hr>
<p>For this tutorial we will be needing:</p>
<ul>
<li style="list-style-type: none;">
<ul>
<li>ECS instance with at least 2GB RAM and 1 vCPU</li>
<li>A domain name or subdomain that resolve to your ECS instance</li>
<li>Cloud CDN setup to speed up our forum</li>
<li>Directmail SMTP credentials for sending email from our forum</li>
</ul>
</li>
</ul>
<p>We will need to setup all these before beginning the actual installation because discourse installer will ask for these information at the beginning of setup process.</p>
<h2>I. Creating the ECS instance</h2>
<hr>
<p>Although if you already have a VPS or dedicated server with any other service you can use it to install Discourse but I highly recommend using ECS to reduce the latency between server and Directmail as well as CDN.</p>
<p>To create an ECS instance login to your Alibaba Cloud console by <a href="https://ecs-buy.aliyun.com/wizard/#/postpay/ap-south-1" target="_blank" rel="noopener noreferrer">click here.</a> This link will take you directly to instance selection page.</p>
<p>You can find the steps to creating new instance in <a href="https://www.alibabacloud.com/help/doc-detail/25422.htm" target="_blank" rel="noopener noreferrer">ECS quick start guide</a>.</p>
<p><b>This is the configuration we need in the server to install Discourse:</b></p>
<ul>
<li>An instance with 1 or more vCPU depending on your choice and at least 2GB RAM.</li>
<li>For Image select Ubuntu 16.06 64 bit version.</li>
<li>In storage section select Ultra Cloud Disk 40 Gib.</li>
<li>Open Ports 80(http), 443(https) and 22(SSH) in security group section on networking page.</li>
</ul>
<p>Note the IP address of the instance as we will be needing it in next steps.</p>
<p><img data-recalc-dims="1" fetchpriority="high" decoding="async" class="size-full wp-image-422 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/ecs-ip-address.jpg?resize=760%2C163&#038;ssl=1" alt="ECS-ip address" width="760" height="163"></p>
<h2>II. Setting Domain name</h2>
<hr>
<p>We are doing this step early because DNS propagation takes some time. We want it propagated before we run the installer as lets encrypt require it to generate SSL certificate.</p>
<p>For this step you only have to add an A record in DNS configutaion of your domain that point your domain or subdomain to ECS instance&#8217;s IP address.</p>
<p>This is what you need to add:</p>
<p>Record type: <code>A</code></p>
<p>Name: <code>forum.example.com</code></p>
<p>Value: <code>your.server.ip.address</code> (eg. 192.168.1.1. You will get this in you ECS console)</p>
<p>This is how it looks in my DNS settings:</p>
<p><img data-recalc-dims="1" decoding="async" class="size-full wp-image-423 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/cloudflare-a-record.jpg?resize=760%2C73&#038;ssl=1" alt="Cloudflare-A-record" width="760" height="73"></p>
<h2>III. Setting up CloudCDN</h2>
<hr>
<p>This I am describing in detail as these are few setting we have to do to make it work with Discourse. For offilcial CloudCDN documentation you can go to the <a href="https://www.alibabacloud.com/help/doc-detail/27112.htm" target="_blank" rel="noopener noreferrer">CloudCDN quickstart guide</a>.</p>
<p><b>We will need to perform four main steps here:</b></p>
<h3>1. Adding the CDN domain</h3>
<p>Head over to CDN console by <a href="https://cdn.console.aliyun.com/#/" target="_blank" rel="noopener noreferrer">clicking here</a>.</p>
<p>Click on the <code>CDN Domain Name List</code> under the CDN menu.</p>
<p>Click on the <code>Add domain</code> button on right side.</p>
<p>You will see a form to setup your CDN domain and origin.</p>
<p>In the <code>CDN Domain</code> field enter a subdomain of your domain name. For example <code>cdn.example.com</code></p>
<p>In Business type select <code>Images and Small file</code>.</p>
<p>In Origin Site Type select <code>Origin Site Domain Name</code>.</p>
<p>Enter the domain name you will be using for your forum in the field that appears.</p>
<p>In <code>Port</code> field select <code>Port 443</code> as Discourse installer will install Letsencrypt SSL certificate and serve your forum on port 443.</p>
<p>In <code>Accelerating Region</code> select <code>Global Acceleration</code> if you want to use POPs in Mainland China as well as rest of the world or you can choose <code>Overseas Acceleration(non-chinese mainland)</code> if you want to use only POPs putside China. To use only Chinese POPs you should select <code>Chinese Mainland</code> from the menu.</p>
<p>This is how it should look</p>
<p><img data-recalc-dims="1" decoding="async" class="size-full wp-image-424 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/cdn-console.jpg?resize=760%2C524&#038;ssl=1" alt="CDN_CONSOLE" width="760" height="524"></p>
<p>Click on <code>Next</code> Button.</p>
<p>Your CDN will be configured in few minutes and you will be given an unique URL. You will have to create an CNAME in your domain&#8217;s DNS setting pointing yo this url.</p>
<h3>2. Installing the SSL certificate for CDN</h3>
<p>We need to setup SSL certificate for the CDN subdomain. If you already have the certificate you can install it and if not you can either buy it from Alibabacloud or can find free SSL certificate by a simple web search.</p>
<p>To install the certificate click on the <code>manage</code> link in front of the url in cdn url list and then click on the <code>pen icon</code> in front of <code>HTTPS Secure Acceleration</code></p>
<p>Turn on the<code> Certificate Status</code> switch.</p>
<p>In <code>Select Certificate</code> field choose <code>Custom Upload</code>.</p>
<p>Enter a name of your choice in <code>Certificate Name</code> field.</p>
<p>Enter <code>Certificate content</code> and <code>Private key</code> in marked textboxes. These are provided to you by the certificate provider.</p>
<p>In <code>Redirect Type</code> click on the radio button that says <code>HTTP -&gt; HTTPS</code>.</p>
<p>It should look like this</p>
<p><img data-recalc-dims="1" loading="lazy" decoding="async" class="alignnone size-full wp-image-430" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/cdn-certificate-settings-1.jpg?resize=590%2C813&#038;ssl=1" alt="CDN_certificate_settings" width="590" height="813"></p>
<p>Click <code>OK</code> to save.</p>
<h3>3. Setting Back-to-source Host</h3>
<p>This setting is required so your CDN does not do a 301 redirect to your origin server.</p>
<p>Click <code>pen icon</code> in front of <code>Back-to-source Host</code> under <code>Basic Configuration</code> section.</p>
<p>A overlay window will open.</p>
<p>Switch on the <label id="dm_di_pf" class="control-label col-sm-3 ng-binding" data-spm-anchor-id="5176.8282264.0.i1.15fa109dWQoZqp">Back-to-source Host</label> button.</p>
<p>From the <code>Type</code> dropdown menu select domain name of your origin.</p>
<p>It should look like this</p>
<p><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-426 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/cdn-back-to-host-setting.jpg?resize=663%2C371&#038;ssl=1" alt="CDN_back-to-host-setting" width="663" height="371"></p>
<p>Click on <code>OK</code> button to save.</p>
<h3>4. Setting the CORS HTTP header</h3>
<p>Now click on the <code>Set HTTP Header</code> on side menu.</p>
<p>Click on <code>Add HTTP header</code> button on right side</p>
<p>A window will open.</p>
<p>Select <code>Access control allow origin</code> from the dropdown menu. And in value add <code>*</code></p>
<p>After saving it should look like this</p>
<p><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-427 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/cdn-header-setting.jpg?resize=760%2C172&#038;ssl=1" alt="CDN_header_setting" width="760" height="172"></p>
<p>Note the CDN URL, we will be needing it later.</p>
<p>This is it for the CDN setup.</p>
<h2>IV. Get Directmail SMTP credentials</h2>
<hr>
<p>Directmail is email service by Alibabacloud and it is one of the cheapest and most reliable service available.</p>
<p><b>Note:</b> Email setting is the most common step where most of the new users break their forum and have to rebuild it. So be careful.</p>
<p>Head over to the Directmail console by <a href="https://dm.console.aliyun.com/" target="_blank" rel="noopener noreferrer">clicking here</a>.</p>
<p>If you have not activated it before it will ask you to do so.</p>
<p>For detailed documentation you can read the <a href="https://www.alibabacloud.com/help/product/29412.htm" target="_blank" rel="noopener noreferrer">Directmail documentation</a> but I will give you a short version here because there are few things we need to do to make it work with discourse.</p>
<p>You need to setup Directmail in 3 steps:</p>
<h3>1. Add sender domain</h3>
<p>This will be the domain from where the email will be send. You need to use your forum domain as it is important. For example <code>forum.example.com</code>.</p>
<p>Click on the <code>New Domain</code> button on the top right. A popup window will open.</p>
<p>Enter your forum&#8217;s domain in the the <code>Domain</code> field and click <code>OK</code> button.</p>
<p><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-433 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/directmail-add-new-domain.jpg?resize=591%2C322&#038;ssl=1" alt="DirectMail_add_new_domain" width="591" height="322"></p>
<p>A domain verification is needed to activate it.</p>
<p>Click on the <code>configure</code> link in front of your domain.</p>
<p>You will be presented with the DNS configuration data. You need to add these in enties DNS panel of your domain.</p>
<p>After you have added the DNS records to your domain&#8217;s configuration click on the <code>Confirm Changes</code> button at the bottom.</p>
<p>Now click on the <code>verify</code> link in front of your domain.</p>
<p>You will be able to send mails only after the domain status changes to <code>Available</code>. If the it fails to verify even after correct configuration wait for a while then verify again, sometime DNS changes takes time to take effect.</p>
<h3>2. Add sender email address</h3>
<p>Click on the Sender Addresses in the left menu.</p>
<p>Click on <code>Create Sender Address</code> button on the top right.</p>
<p>A Overlay window will open where you need to enter the data.</p>
<p>Fill all the fields like this to setup sender email:</p>
<p><code>Email Domains</code>: select your forum&#8217;s domain from dropdown menu.</p>
<p><code>Account</code>: <b>noreply</b> (<b>This is important</b> to put only <code>noreply</code> as account or authentication will fail and your forum will not ne able to send email.</p>
<p><code>Reply-to Address</code>: Any email address you like where you will like to receive replies.</p>
<p><code>Mail Type</code>: Triggered Emails.</p>
<p>It should look like this</p>
<p><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-428 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/directmail-add-sender-address.jpg?resize=594%2C582&#038;ssl=1" alt="DirectMail-add-sender-address" width="594" height="582" srcset="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/directmail-add-sender-address.jpg?w=594&amp;ssl=1 594w, https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/directmail-add-sender-address.jpg?resize=50%2C50&amp;ssl=1 50w, https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/directmail-add-sender-address.jpg?resize=65%2C65&amp;ssl=1 65w" sizes="auto, (max-width: 594px) 100vw, 594px" /></p>
<p>Press <code>OK</code> to create sender address.</p>
<h3>3. Set SMTP password</h3>
<p>Click on the <code>Set SMTP password</code> link in front of the sender email address you set in previous step.</p>
<p>A overlay window will open where you can set your password.</p>
<p>Read the instructions carefully as it requires mix of lower case upper case letter and number. Use atleast 2 different uppercase letter, 2 different lowercase letters and 2 different digits for your password.</p>
<p>Note the sender email address and SMTP password. It will be needed while running the Discourse installer. You will also need SMTP service address that you can <a href="https://www.alibabacloud.com/help/doc-detail/29449.htm" target="_blank" rel="noopener noreferrer">find here.</a> Choose the one for the region you set your directmail account in.</p>
<h2>V. Running the Discourse Installer</h2>
<hr>
<p>Discouse team have made it quite easy to install discourse. You only have to install docker first and download and run the installer. After few minutes and couple of question you will get your new discourse forum ready.</p>
<p>Login to you server via SSH</p>
<pre>ssh root@192.168.1.1</pre>
<p><b>*</b>Replace 192.168.1.1 with your IP address.</p>
<p>After successful login run the following command to update your system first.</p>
<pre>sudo apt-get update &amp;&amp; apt-get upgrade -y</pre>
<p>All the steps will be run as root user so run this command first</p>
<pre>sudo -s</pre>
<h3>Install Docker</h3>
<p>Discourse forum runs inside docker container so we will first install the latest docker</p>
<pre>wget -qO- https://get.docker.com/ | sh</pre>
<p>Above command will install the docker in your server.</p>
<h3>Install GIT</h3>
<pre class="highlight">apt-get install git</pre>
<h3>Download Discourse installer</h3>
<p>Create a directory to install discourse</p>
<pre>mkdir /var/discourse</pre>
<p>Clone discourse doscker image inside this folder</p>
<pre>git clone https://github.com/discourse/discourse_docker.git /var/discourse</pre>
<p>Change to to this directory</p>
<pre>cd /var/discourse</pre>
<h3>Run Discourse installer</h3>
<p>Initiate setup script</p>
<pre>./discourse-setup</pre>
<p>Discourse will create a swap space first and then you will be asked for these information</p>
<pre>Hostname for your Discourse? [discourse.example.com]: 
Email address for admin account(s)? [me@example.com,you@example.com]: 
SMTP server address? [smtp.example.com]: 
SMTP port? [587]: 
SMTP user name? [user@example.com]: 
SMTP password? [pa$word]: 
Let's Encrypt account email? (ENTER to skip) [me@example.com]:</pre>
<p>Let me explain these</p>
<ul>
<li><b>Hostname for your discourse:</b> This is the domain or subdomain that you want to use with your forum. We set it in the Step II while adding A record in your domain&#8217;s DNS.</li>
<li><b>Email address for admin accounts:</b> Here you enter the email address of the admin account of your forum. You can add multiple admin email separated my comma(,). this is<b> not</b> your SMTP sender address.</li>
<li><b>SMTP server address:</b> This is the address of the SMTP server of Directmail. You can find it on<a href="https://www.alibabacloud.com/help/doc-detail/29449.htm" target="_blank" rel="noopener noreferrer"> this page</a>. Choose the one for the region where you have created your Directmail account. You can see your region at the top of the Directmail console.</li>
<li><b>SMTP port:</b> Enter 80 here as this is the port that Directmail uses for SMTP connection.</li>
<li><b>SMTP user name:</b> Here you enter the sender email address we created in Step V.</li>
<li><b>SMTP password:</b> Enter the SMTP password we set in step V.</li>
<li><b>Let&#8217;s Encrypt account email:</b> This is the email address that let&#8217;s encrypt uses to generate SSL certificate for your domain and send notifications regarding expiration and renewal failure. You can skip it but I suggest you do enter an email address you check regularly. Also make sure your DNS has been propagated before running the installer as it is important for generating let&#8217;s encrypt certificate.</li>
</ul>
<p>After you have entered the information setup will show all the information you gave on the screen for review and ask for confirmation. Check it carefully and if all is correct press <code>ENTER</code> key. If you need to change something type <code>n</code> and then <code>ENTER</code>.</p>
<p>After confirmation will take around 10 minutes to setup everything.</p>
<p>After the setup finishes you can see your forum in the browser by visiting the URL you entered.</p>
<p>At this stage although your forum is working but it is not currently using CloudCDN. We will set up this now.</p>
<h2>VI. Setting up CloudCDN</h2>
<hr>
<p>Go to the discourse directory if you are not already into it.</p>
<pre>cd /var/discourse</pre>
<p>Open the app.yml file in nano for editing</p>
<pre class="p1"><span class="s1">nano containers/app.yml</span></pre>
<p>Scroll down until you find this line.</p>
<pre class="p1"><span class="s1">#DISCOURSE_CDN_URL: //discourse-cdn.example.com</span></pre>
<p>And paste this line right below it. Make sure you keep the same indentation as line above.</p>
<pre>DISCOURSE_CDN_URL: //cdn.example.com</pre>
<p><b>*</b>replace the url with CDN url we set in the step IV.</p>
<p>Press <code>control+O</code> and <code>ENTER</code> to save changes.</p>
<p>Press <code>control+X</code> and then <code>ENTER</code> to exit nano.</p>
<p>Now rebuild the app</p>
<pre>./launcher rebuild app</pre>
<p>Rebuild process will take about 10 minutes.</p>
<p>Your forum will now use CloudCDN to serve static content.</p>
<p>Now visit enter your forum&#8217;s URL and you will be greetied with this message</p>
<p><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-431 alignnone" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/discourse-setup-screen.jpg?resize=695%2C532&#038;ssl=1" alt="Discourse_Setup-screen" width="695" height="532"></p>
<p>Click on the register button and fill all the fields as required to create administrator account for the forum. Forum will send you email to confirm your email address. If you do not get the email review your Directmail settings and make sure you have followed the tutorial carefully. If you need to change the SMTP setting in forum you can run the setup again by using this command inside discourse directory.</p>
<pre> ./discourse-setup</pre>
<p>You will be asked all the information again and installer will also show you all the information you gave earlier.</p>
<p>After confirmation of your email go through the initial Discourse setup and you will be soon see your forum&#8217;s homepage.</p>
<p><img data-recalc-dims="1" loading="lazy" decoding="async" class="size-full wp-image-432 aligncenter" src="https://i0.wp.com/www.installing.in/wp-content/uploads/2018/06/discourse-homepage.jpg?resize=760%2C503&#038;ssl=1" alt="Discourse-homepage" width="760" height="503"></p>
<p>Enjoy your new Discourse forum 🙂</p>
<h2>Conclusion</h2>
<p>You can install Discourse forum software quite easily on Alibabcloud&#8217;s infrastructure. You don&#8217;t have to buy from multiple providers as you get all the required services like server, SMTP and CDN from Alibabacloud and most of them are cheaper but more reliable than other providers. If you have not signed up yet <a href="https://account-intl.aliyun.com/register/intl_register.htm?biz_params=%7B%22intl%22%3A%22%7B%5C%22referralCode%5C%22%3A%5C%22a4y96k%5C%22%7D%22%7D" target="_blank" rel="noopener noreferrer">register and get $300 credit</a> to check out the Alibabacloud services.</p>
<p>The post <a href="https://www.installing.in/installing-discourse-on-alibabacloud-using-directmail-and-cloud-cdn/">Installing Discourse on Alibabacloud using Directmail and Cloud CDN</a> appeared first on <a href="https://www.installing.in">Installing.in</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.installing.in/installing-discourse-on-alibabacloud-using-directmail-and-cloud-cdn/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">418</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Object Caching 24/64 objects using Redis
Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Minified using Disk
Database Caching 2/17 queries in 0.005 seconds using Redis

Served from: installing.in @ 2026-04-26 19:57:46 by W3 Total Cache
-->