# Install Todomator with Node.js and PostgreSQL, Docker or Docker Compose

> Start Todomator by hand, with the Docker Hub image or with Docker Compose, what the first start does, the default account and how to update an existing database.

Framework: todomator
Product: Todomator (todomator@1.7)
Language: en
Content-SHA256: 300e289fdd80ff13b51f7fb675fbdb3de93238d77d41e733cd1392362638851d
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: 
Review: not-recorded

Todomator needs the latest **Node.js** and a **PostgreSQL** database. Do **not** run `database.sql` yourself: Todomator uses that script internally when it starts on an empty database.

## By hand

1. Install Node.js and PostgreSQL and create a database for Todomator.
2. Download the [source code](https://github.com/totaljs/todomator).
3. Install the dependencies in the root of the application:

```bash
npm install
```

4. Set the connection in the file `config`. It reads the environment variable `DATABASE` (line `database (env) : DATABASE`) and has a line `database : postgresql://total:platform@127.0.0.1:5432/todomator` as a model. The same file has `$api : /api/` (the address of the API) and a `mail` line with the SMTP settings as a JSON object.
5. Run it (the `start` script is `node index.js 8000`):

```bash
node index.js
```

6. Open `http://127.0.0.1:8000`.

## Docker Hub

```bash
docker pull totalplatform/todomator
docker run --env DATABASE='postgresql://user:pass@hostname/database' -p 8000:8000 totalplatform/todomator
```

## Docker Compose

```bash
git clone https://github.com/totaljs/todomator.git
cd todomator
docker compose up
```

## The first start

If the table `tbl_ticket` does not exist in the schema `public`, Todomator runs `database.sql` with a generated identifier, a secret and the password hash of the first user, then loads the configuration and the tags. With the environment variable `DATABASE` (Docker) it waits three seconds first. The script creates the statuses, the first user and the configuration. The server stays paused (`PAUSESERVER('Database')`) until the database is ready.

## The first sign-in

The README gives the default account:

```text
login : info@totaljs.com
password : admin
```

The account is created with the name John Connor and administrator rights (`sa`). **Change the password** after signing in, and configure the [settings](/en/todomator/settings-and-database/).

## Updating

For an existing installation the README points to the update scripts of the repository instead of `database.sql`: `database_1-3.sql`, `database_1-4.sql`, `database_1-5.sql`, `database_1-6.sql` and `database-20240119.sql`. Apply the ones that are newer than your version; the file `version` of the repository lists what each release changed (for example, version 1.7 added two-factor authentication, improved the search and the plugins of reports, bookmarks and users).
