# Customizing your Node.js configuration


##  Change your Node.js version 

To change your Node.js version you need to update your `package.json` `engines` settings. You should [specify the version of node](https://docs.npmjs.com/files/package.json#engines) so your application works.

##  Change your datasource(s) 

During the analyse phase we analyze your runtime depencies defined in the `package.json`. Inclusion of the following packages will result in relevant datasource to be provisioned on your application.

*    the package `mysql` will trigger the provisioning of Mysql
*    the package `mongoose` or `mongodb` will trigger the provisioning of MongoDB
*    the package `pg` will trigger the provisioning of Postgres
*    the package `redis` or `ioredis` will trigger the provisioning of Redis

If you need other datasources later on, you can always add them using your Cloud 66 Dashboard.

##  Expose your host port

If your application binds to a port, we need to expose it to the internet and make sure we can load balance traffic to your application. We provide you with an environment variable called `PORT` to tell which port your need to bind your application to. Make sure your use the following line:

```js
var port = process.env.PORT || 8080;
app.listen(port);
```

##  Connect to your datasource(s)

Your application need to know which URL to use to connect to your database. We provide a couple of environment variables your can use to connect to your datasources.

### MongoDB

```js
mongoose.connect(process.env.MONGODB_URL);
```

### Mysql

```js
var connection = mysql.createConnection({
  host     : process.env.MYSQL_URL,
  user     : process.env.MYSQL_USERNAME,
  password : process.env.MYSQL_PASSWORD,
  database : process.env.MYSQL_DATABASE
});
connection.connect();
```

### Postgres

```js
var config = {
  user: process.env.POSTGRESDB_USERNAME,
  database: process.env.POSTGRESDB_DATABASE,
  password: process.env.POSTGRESDB_PASSWORD,
  host: process.env.POSTGRESDB_URL,
  max: 10,
  idleTimeoutMillis: 30000,
};
var pool = new pg.Pool(config);
```

### Redis

```js
redis.createClient(6379, process.env.REDIS_URL)
```

##  Fire up some workers 

You can use Procfiles to ensure that your background jobs run and are monitored. Doing so is as easy as defining them in the root of your application, in a file called `Procfile`.

A typical Procfile may look something like this:

```shell
web: node server.js
work: node some_work.js
```

The commands above would run node `server.js` and node `some_work.js` and monitor them. Cloud 66 will attempt to bring processes that go down or crash up again. Processes are also instructed to start when your server is booted. An overall view of your processes is available in your application.

##  Final notes on managing storage

None of the files created on the filesystem after the application is deployed are persistent. If you need persistency for files, for example some uploaded data, [please use GlusterFS](/:product/:version?/servers/glusterfs).