> ## Documentation Index
> Fetch the complete documentation index at: https://docs.data-wizard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Deployment

> Learn more about deploying Data Wizard.

## Deploy using Docker

<Steps>
  <Step title="Generate a random `APP_KEY`">
    Before running the Docker container, you need to generate a random `APP_KEY` for your Data Wizard instance. This key is used for encryption and security purposes.

    Run the following command to generate a random `APP_KEY`:

    ```bash theme={null}
    openssl rand -base64 32
    ```

    <br />

    <br />
  </Step>

  <Step title="Run the Docker Container">
    <Tabs>
      <Tab title="Docker Run">
        ```bash theme={null}
        docker run \
          --name data-wizard \
          -p 9090:80 \
          -p 4430:443 \
          -p 4430:443/udp \
          -v data_wizard_storage:/app/storage \
          -v data_wizard_sqlite_data:/app/database \
          -v data_wizard_caddy_data:/data \
          -v data_wizard_caddy_config:/config \
          -e APP_KEY=[REPLACE_WITH_APP_KEY] \
          mateffy/data-wizard:latest
        ```

        | Option                                                     | Description                                                                                                                  |
        | ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
        | `-p 9090:80`, <br />`-p 4430:443`, <br />`-p 4430:443/udp` | Maps ports on your host machine to ports in the container for HTTP and HTTPS access.                                         |
        | `-v ...:...`                                               | Creates named volumes for persistent storage of application files, SQLite database, and Caddy server data and configuration. |
        | `-e APP_KEY=[APP_KEY]`                                     | Sets the `APP_KEY` environment variable, essential for application security.                                                 |
      </Tab>

      <Tab title="Docker Compose">
        ```yaml theme={null}
        version: '3.8'

        services:
          data-wizard:
            name: data-wizard
            image: mateffy/data-wizard:latest
            ports:
              - "9090:80"
              - "4430:443"
              - "4430:443/udp"
            volumes:
              - data_wizard_storage:/app/storage
              - data_wizard_sqlite_data:/app/database
              - data_wizard_caddy_data:/data
              - data_wizard_caddy_config:/config
            environment:
              - APP_KEY=[REPLACE_WITH_APP_KEY]

            volumes:
              data_wizard_storage:
              data_wizard_sqlite_data:
              data_wizard_caddy_data:
              data_wizard_caddy_config:
        ```

        Then run the following command in the same directory as your `docker-compose.yml` file:

        ```
        docker-compose up
        ```
      </Tab>
    </Tabs>

    <br />

    <br />
  </Step>

  <Step title="Access Data Wizard">
    Once the container is running, open your web browser and navigate to `https://localhost:4430`. You might see a
    warning about an invalid HTTPS certificate because it's a self-signed certificate for local development. You can
    safely ignore this warning for local testing.
  </Step>
</Steps>

### Updating Data Wizard

When updating Data Wizard, you can pull the latest Docker image and restart the container. Make sure to back up your data before updating to prevent data loss.

```bash theme={null}
docker pull mateffy/data-wizard:latest
docker stop data-wizard
docker rm data-wizard
docker run ... (same run command as before)
```

You may need to change `data-wizard` to your docker container name if you have changed it or are using a random name.

### Migrating the Database

You may need to migrate the database when updating to a new version of Data Wizard. To do this, run the following command:

```bash theme={null}
docker exec -it data-wizard php artisan migrate
```

With container ID:

```bash theme={null}
docker exec -it <container-id> php artisan migrate
```

## Manual Installation (for Development)

While Docker is highly recommended, advanced users can also run Data Wizard as a standard Laravel application. This requires a PHP environment, a web server (like Nginx or Apache), and more manual configuration. Detailed instructions for this method are beyond the scope of this basic installation guide, but you can refer to standard [Laravel deployment documentation](https://laravel.com/docs/12.x/deployment) for guidance.

Data Wizard works with both `SQLite` and `PostgreSQL` databases. By default, the Docker image uses `SQLite` for simplicity, but you can configure it to use `PostgreSQL` by setting the appropriate environment variables.

<br />

<br />

<br />

**Next Steps**

<Card title="Learn how to extract some data" icon="list-ol" href="./extracting-data">
  Step by step guide to extract data from documents using Data Wizard.
</Card>

<CardGroup>
  <Card title="Extractors" icon="laptop-code" href="./extractors">
    Learn how to define and configure data extraction tasks.
  </Card>

  <Card title="Strategies" icon="code-branch" href="./strategies">
    Understand different data processing strategies.
  </Card>

  <Card title="LLM Provider Configuration" icon="sliders" href="./configure-llm">
    Set up your Large Language Model API keys.
  </Card>

  <Card title="Integration" icon="code" href="./integrate">
    Embed Data Wizard into other applications using iFrames or APIs.
  </Card>
</CardGroup>
