Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Mar 14, 2017
1 parent 9f18968 commit 533f2dd
Showing 1 changed file with 65 additions and 65 deletions.
130 changes: 65 additions & 65 deletions docs/guides/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ Deploying to Now
.. _Hoodie Tracker demo: https://github.com/hoodiehq/hoodie-app-tracker

`Now`_ allows you to deploy a Node application with its `command line tool`_. It’s 100% free for Open Source projects. You can deploy an app from your computer or right from a GitHub repository. For example, to deploy our `Hoodie Tracker demo`_ app all you have to do is to run this command:
::

$ now hoodiehq/hoodie-app-tracker --npm -e NODE_ENV=production -e hoodie_inMemory=true
.. code:: bash
$ now hoodiehq/hoodie-app-tracker --npm -e NODE_ENV=production -e hoodie_inMemory=true
To describe this further:

Expand All @@ -32,7 +33,7 @@ Alternatively, add this script to your package.json and you are good to go:

::

"now-start": "hoodie --inMemory",
"now-start": "hoodie --inMemory",

.. _Now: https://zeit.co/now

Expand All @@ -41,9 +42,10 @@ Store Data With Cloudant
.. _Cloudant: https://cloudant.com/_

`Cloudant`_ is a DBaaS (database-as-a-service). It provides most of CouchDB’s APIs and can be used as Hoodie’s database backend. Signing up for a free account only takes a moment. After sign up, you need to slightly adjust the now deployment command above.
::

$ now hoodiehq/hoodie-app-tracker -e NODE_ENV=production -e hoodie_inMemory=true -e hoodie_dbUrl=https://username:password@username.cloudant.com/
.. code:: bash
$ now hoodiehq/hoodie-app-tracker -e NODE_ENV=production -e hoodie_inMemory=true -e hoodie_dbUrl=https://username:password@username.cloudant.com/
The :code:`hoodie_inMemory` environment variable makes sure that Hoodie does not try to write any files like the bundled /hoodie/client.js library. The :code:`hoodie_dbUrl` environment variable sets the address and credentials to your CouchDB. Replace username and password to whatever you signed up with.

Expand All @@ -52,9 +54,10 @@ Test and set an alias
~~~~~~~~~~~~~~~~~~~~~~

When you deploy with now you will receive a random subdomain where you can access your application. It looks something like https://hoodie-app-tracker-randomxyz.now.sh/ and was already copied to your clipboard during the deployment. Open the URL in your browser to give it a try. Once everything is good, you can change the subdomain to your preference by running:
::

$ now alias set hoodie-app-tracker-randomxyz my-tracker-app
.. code:: bash
$ now alias set hoodie-app-tracker-randomxyz my-tracker-app
That will make your deployed Hoodie Tracker app accessible at https://my-tracker-app.now.sh. For example, here is the app that I deployed myself: https://hoodie-app-tracker.now.sh/

Expand All @@ -69,46 +72,31 @@ deployment set at `hoodie-app-tracker/deployment.md`_.
.. _hoodie-app-tracker/deployment.md: https://github.com/hoodiehq/hoodie-app-tracker/blob/master/deployment.md


DEPLOYMENT IN LINUX
===================
Deployment in linux
~~~~~~~~~~~~~~~~~~~

This guide is for Linux only at this point.
I have tried to deploy [Hoodie-App-Tracker](https://github.com/hoodiehq/hoodie-app-tracker) as an example:

INSTALL DEPENDENCIES
~~~~~~~~~~~~~~~~~~~~~

1. `Install CouchDB`_ 1.2.0 or later, 1.4.0 or later recommended for performance.

2. `Install NodeJS(LTS)`_ 6.0.0 or later.

3. `Install nginx`_, any recent version will do.
I have tried to deploy `Hoodie-App-Tracker <https://github.com/hoodiehq/hoodie-app-tracker>`__ as an example:

4. `Install Monit`_, any recent version will do.
install dependencies
--------------------

5. `Install git`_.
1. `Install CouchDB <http://linoxide.com/linux-how-to/install-couchdb-futon-ubuntu-1604/>`__ 1.2.0 or later, 1.4.0 or later recommended for performance.
2. `Install NodeJS <https://nodejs.org/en/>`__ LTS version or later. This includes npm.
3. `Install git <https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-16-04>`__.

.. _Install CouchDB: http://linoxide.com/linux-how-to/install-couchdb-futon-ubuntu-1604/

.. _Install NodeJS: https://nodejs.org/en/download/

.. _Install nginx: https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04

.. _Install Monit: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-monit

.. _Install git: https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-16-04

COUCHDB
~~~~~~~
CouchDB
-------

We assume you set up CouchDB with your package manager or manually following the
`installation procedure`_.

In order to test if CouchDB is running fine or not, we can simply run the following
command which will retrieve the information through curl.
::

$ curl localhost:5984
.. code:: bash
$ curl localhost:5984
If you are already using CouchDB for other things, we recommend starting a second
instance of CouchDB that is completely separate from your original one. See below
Expand All @@ -118,82 +106,94 @@ In this guide, we assume that your CouchDB is available at `port 5984`_.

Create a CouchDB admin user called **admin** with a strong password of your choice at
by clicking on the *Fix this* at `Apache CouchDB-Futon:Overview`_ link in the
lower right corner. Keep that password in mind.
lower right corner. Use `admin`_ as username and keep your password in mind.

Next we have to change CouchDB’s default configuration on a few points. The easiest thing is to go to and change the following fields (double click a value to enter the editing mode):

::

couchdb -> delayed_commits: false
couchdb -> max_dbs_open: 1024

.. _installation procedure: http://linoxide.com/linux-how-to/install-couchdb-futon-ubuntu-1604/
.. _port 5984: http://127.0.0.1:5984/
.. _Apache CouchDB-Futon:Overview: http://127.0.0.1:5984/_utils/

SYSTEM
~~~~~~
System
------

Add this to :code: `/etc/security/limits.conf` :
Add this to :code:`/etc/security/limits.conf`:

::

hoodie soft nofile 768
hoodie hard nofile 1024

HOODIE
~~~~~~
Hoodie
------

Create a new system user:
::

$ sudo useradd --system \
$ -m \
$ --home /home/hoodie \
$ --shell /bin/bash \
$ --no-user-group \
$ -c "Hoodie Administrator" hoodie
.. code:: bash
$ sudo useradd --system \
-m \
--home /home/hoodie \
--shell /bin/bash \
--no-user-group \
-c "Hoodie Administrator" hoodie
This will create a new user and its home directory /home/hoodie.
But unless you have a password, you can not be a user. To set a password run:
::

$ sudo passwd hoodie
.. code:: bash
$ sudo passwd hoodie
Give a password of your choice.

**cd** in to that directory.

To switch to **hoodie** user, run :
::
To switch to **hoodie** user, run:

$ sudo su hoodie
.. code:: bash
$ sudo su hoodie
As user Hoodie, install your application:
::

$ git clone <repo url>
.. code:: bash
$ git clone <repo url>
make sure package.json has a valid `name` property.

**cd** into the directory.Run :
::

$ cd <repo name>
.. code:: bash
$ cd <repo name>
Now run:
::

$ npm install
.. code:: bash
$ npm install
To run Hoodie as the root:
::

$ sudo su hoodie
.. code:: bash
$ sudo su hoodie
To launch Hoodie now, as root :
::

$ HOODIE_ADMIN_PASS=youradminpasswordfromearlier
$ ./hoodie-daemon.sh start
.. code:: bash
$ npm start -- --dbUrl=http://admin:yourpassword@localhost:5984/
.. _this gist: https://gist.github.com/janl/b097f7a578ec07e4101c
Replace :code:`yourpassword` with the password you choose when you created the
admin user above.

That's it. The app should be running by now.

0 comments on commit 533f2dd

Please sign in to comment.