# Nakama Deployment

**URL:** <https://forum.heroiclabs.com/t/nakama-deployment/3665>\
**Category:** Runtime Framework\
**Tags:** server-framework\
**Created:** [March 19, 2023, 3:41pm UTC](https://forum.heroiclabs.com/t/nakama-deployment/3665 "2023-03-19T15:41:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![calamas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/calamas/32/1234_2.png) [@calamas](https://forum.heroiclabs.com/u/calamas)\
**Post date:** [March 19, 2023, 3:41pm UTC](https://forum.heroiclabs.com/t/nakama-deployment/3665/1 "2023-03-19T15:41:53Z")

</div>

Hello, I am trying to deploy Nakama in Amazon ECS and, as ECS does not support docker compose by default, Is there any way I can send the “–database.address” parameter using environment variables?

It would be something like this:  
`docker run --env dbaddress {{db connection string}} nakama`  
where dbaddress is the name of the environment variable.

Regards  
Claudio

---

<div class="post-metadata">

**Author:** ![shprot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/shprot/32/1573_2.png) [@shprot](https://forum.heroiclabs.com/u/shprot)\
**Post date:** [March 19, 2023, 6:59pm UTC](https://forum.heroiclabs.com/t/nakama-deployment/3665/2 "2023-03-19T18:59:16Z")

</div>

Hi, @calamas! Try to use some services on converting `docker-compose` file to `docker run` commands, like [this one](https://8gwifi.org/dc2.jsp). After few minutes of playing with it I got this commands sequence(warning, no healthcheck, everything other is 1-per-1 as in `docker-compose.yml`):

```auto
docker run -v data:/var/lib/postgresql/data --name postgres -p 5432:5432 -p 8080:8080 -e POSTGRES_DB=nakama -e POSTGRES_PASSWORD=localdb postgres:12.2-alpine 
docker run -v ./:/nakama/data --name nakama --entrypoint /bin/sh -ecx /nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama && exec /nakama/nakama --name nakama1 --database.address postgres:localdb@postgres:5432/nakama --logger.level DEBUG --session.token_expiry_sec 7200
 --link postgres:db -p 7349:7349 -p 7350:7350 -p 7351:7351 registry.heroiclabs.com/heroiclabs/nakama:3.15.0 

```

Here you can see how you can pass the `--database.address` argument.

As for Nakama internals, it uses [pgconn](https://github.com/jackc/pgconn) library to form the connection string. Which used [through](https://github.com/jackc/pgconn/blob/master/config.go#L416) libpq [this](https://www.postgresql.org/docs/11/libpq-envars.html) list of environment variables. But playing few minutes in debugging Nakama I found [hardcoded host](https://github.com/heroiclabs/nakama/blob/master/server/config.go#L721) which seem currently prevents redefinition from env variables, while all used libraries allow you to do this.

---

<div class="post-metadata">

**Author:** ![calamas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/calamas/32/1234_2.png) [@calamas](https://forum.heroiclabs.com/u/calamas)\
**Post date:** [March 21, 2023, 11:33am UTC](https://forum.heroiclabs.com/t/nakama-deployment/3665/3 "2023-03-21T11:33:04Z")

</div>

Thanks for your response. I was able to do what I want generating a config.yml on build time (configuring the environment variables in my repository) and then adding --config /nakama/data/config.yml in my docker run configuration like this:

 ![Captura de pantalla 2023-03-21 a la(s) 08.28.46](https://us1.discourse-cdn.com/flex020/uploads/heroiclabs/original/2X/9/975494cf6be9c7dac44306d47a94501f5231fa63.png)
