# Installation using Portainer {#installation-using-portainer}


Portainer is a well known container management tool for Docker. It can help you manage your containers, networks and volumes.

You can add Firefly III and the Data Importer as a "stack" using the instructions below.


## Preparation {#preparation}


You will need to download and save the following configuration files:

1. [Docker compose](https://raw.githubusercontent.com/firefly-iii/docker/main/docker-compose-importer.yml) file
2. This [stack.env](https://support.firefly-iii.org/composed.php) file with all the environment variables. Save it as `stack.env`.


### Edit docker compose file {#edit-docker-compose-file}


First, open the docker compose file in your favorite editor, and change all references under `env_file:` to say `env_file: stack.env`.



> [!TIP]
> All `env_file:` references must be pointing to exactly `stack.env`. Nothing else.



Second, update line 60, the that says `PLEASE_REPLACE_WITH_32_CHAR_CODE` and change it to a 32-character code. You need a random string at this point. If you don't want to make one up, [create one on this page](https://www.random.org/strings/?num=1&len=32&digits=on&upperalpha=on&loweralpha=on&unique=on&format=html&rnd=new). This 32-character code is used to secure the cron job.


### Edit stack.env {#edit-stackenv}


You must do a few things:

1. Change `DB_PASSWORD` in `stack.env` to something else. Pick a nice password.
2. Also change `MYSQL_PASSWORD` in `stack.env` to the SAME value (it's at the bottom)
3. Change `FIREFLY_III_URL` in `stack.env` to `http://app:8080`
4. Change `VANITY_URL` in `stack.env` to `http://localhost`
5. Change `STATIC_CRON_TOKEN` to the value you generated in the previous step.


## Installation {#installation}



### Add docker compose file {#add-docker-compose-file}


Open Portainer and go to the environment where you want to install Firefly III. This is usually the "local" one. Then, select "Stacks" in the left-hand menu. Click "Add stack".

Give your stack the name `firefly-iii`, and copy-paste the content of your edited docker compose file.

![Creating a stack](/_media/c6abd0e4b50412ee38a3.png)


### Add stack.env file {#add-stackenv-file}


Upload the `stack.env` file here. You will see that Portainer will expand all the environment variables in the file.

![Loading environment variables](/_media/b8551edd4eeeb945b35c.png)

If you did not make the changes indicated earlier, now is the time.

![Editing environment variables](/_media/4306e902b1af42b3c274.png)


## Deploy! {#deploy}


Press the button to get the stack deployed! After a while, it should run as expected.

![Portainer stack](/_media/1b2a95660c2ed196c222.png)

![Portainer final overview](/_media/cf4e79a8916d6359775b.png)

The default configuration will run Firefly III on port 80 which means you can visit Firefly III at [http://localhost](http://localhost). If your portainer is running somewhere else, or in a different configuration, the URL will be different of course.

The data importer (again, in the default configuration) can be reached at [http://localhost:81](http://localhost:81).

From this point forward, you can follow these tutorials and guides to help you set up:

- [Tutorial: Create accounts and transactions](https://sourcey-firefly.pages.dev/tutorials/finances/first-steps/index.md)
- [Tutorial: My first accounts](https://sourcey-firefly.pages.dev/tutorials/finances/first-accounts/index.md)
- [Tutorial: Import a basic CSV file](https://sourcey-firefly.pages.dev/tutorials/data-importer/csv/index.md)
