@contentacms/contentajs
Version:
A nodejs server that proxies to Contenta CMS and holds custom code.
85 lines (78 loc) • 4.02 kB
Markdown
<!--
This file was generated by emdaer
Its template can be found at .emdaer/docs/install.emdaer.md
-->
<!--
emdaerHash:1e0b0f7bb25c2974949a984f1639ecb0
-->
<h1 id="installation-img-align-right-src-logo-svg-alt-contenta-logo-title-contenta-logo-width-100-">Installation <img align="right" src="../logo.svg" alt="Contenta logo" title="Contenta logo" width="100"></h1>
<p>In order to install ContentaJS you will need to meet the following requirements:</p>
<ul>
<li><code>nodejs</code> ^8.11.1 or higher.</li>
<li>A working installation of <a href="https://github.com/contentacms/contenta_jsonapi">Contenta CMS</a>.</li>
<li>A Redis server (optional). Use the
<a href="https://github.com/contentacms/contentajsRedis">@contentacms/redis</a> module
to leverage the Redis cache back-end.</li>
</ul>
<h2 id="local-installation">Local Installation</h2>
<h3 id="install-contenta-cms">Install Contenta CMS</h3>
<p>Install Contenta CMS using <a href="http://www.contentacms.org/#install">the instructions</a>.</p>
<p>Take note of the installation URL. For instance <code>http://localhost:8888</code>.</p>
<h3 id="install-contentajs">Install ContentaJS</h3>
<p>Install the starter kit by using downloading <a href="https://github.com/contentacms/contentajs/archive/master.tar.gz">the
package</a> and
extracting it. In MacOS and Linux you can do:</p>
<pre><code>
curl -Lo contenta.tar.gz https://github.com/contentacms/contentajs/archive/master.tar.gz
tar -xzf contenta.tar.gz
mv contentajs-master YOUR_PROJECT_NAME
cd YOUR_PROJECT_NAME
npm install
git init && git add . && git ci -m 'feat: project initialization with Contenta JS'
</code></pre>
<h3 id="configure">Configure</h3>
<p>Create a local configuration file. This configuration file will contain all the
configuration that <strong>only</strong> applies to the local development box. This file
should not be checked into the repository.</p>
<pre><code>
touch config/local.yml
</code></pre>
<p>Add the URL where ContentaJS will find your Contenta CMS (Drupal) installation.
You can also add the URL of the node.js instance for CORS whitelisting if you
need to have CORS support. For instance:</p>
```yaml
cms:
host: http://localhost:8888
cors:
origin:
# It's OK to use '*' in local development.
- '*'
```
<p>It is important to note that you can override configuration per environment.
That means that your <code>config/staging.yml</code> may contain:</p>
```yaml
cms:
host: http://stg.example.com
```
<p>Learn more about configuration in the
<a href="https://www.npmjs.com/package/config">config module’s documentation</a>.</p>
<h3 id="start-your-server">Start your server</h3>
<p>Start your server with multiple threads serving requests (one per CPU core).
This uses the <a href="https://pm2.io/doc/en/runtime/overview/">PM2</a> module. Edit the
<a href="./ecosystem.config.js"><code>ecosystem.config.js</code></a> file to tune how to start your
app. Read
<a href="https://pm2.io/doc/en/runtime/reference/ecosystem-file/">the documentation</a> for
the PM2 ecosystem file.</p>
<pre><code>
npm start
</code></pre>
<p>Inspect the <code>"scripts"</code> section in the <a href="./package.json"><code>package.json</code></a> to find
other useful scripts like <code>npm run debug</code>, <code>npm run stop</code> and <code>npm run test</code>.</p>
<h3 id="-optional-install-the-redis-server">(Optional) Install the redis server</h3>
<p>Optionally you can install the Redis server by doing <code>gem install redis</code> then
follow the setup in <a href="https://github.com/contentacms/contentajsRedis#readme"><code>@contentacms/redis</code></a>.</p>
<h2 id="aws-installation">AWS Installation</h2>
<p><em>Fill in the instructions on how to install in AWS with ElastiCache using CloudFormation or a custom AMI</em></p>
<h2 id="install-using-docker">Install Using Docker</h2>
<p><em>Fill in the instructions on how to install using Docker.</em></p>
<p><em>Ideally this installs Contenta CMS (Drupal), ContentaJS, and the Redis server.</em></p>