# Install FLECS Core With Maximum Customization

For users familiar with Docker, FLECS can be installed directly using Docker images. This method is ideal for those who prefer containerized environments and have Docker installed on their system.

### **Prerequisites for Docker Installation**

* Docker installed on your system (version 20.10.5 or higher).
* Ensure that your system is compatible with Docker and has internet access to pull images.
* Only you want to use Docker Compose: Docker Compose installed on your system (version 2.0.0 or higher, i.e. any version of the go rewrite)

### **Installation Steps**

#### **Deploy FLECS Using Docker Compose**

If you prefer using Docker Compose, create a `docker-compose.yml` file with the following content:

```yaml
services:
  flecsd:
    image: flecspublic.azurecr.io/flecs-slim:5.2.0-red-deer
    restart: always
    network_mode: host
    volumes:
      - flecsd:/var/lib/flecs
      - flecs-floxy_data:/tmp/floxy
      - /run/docker.sock:/run/docker.sock

  webapp:
    image: flecspublic.azurecr.io/webapp:5.2.0-red-deer
    restart: always
    networks:
      flecs:
        ipv4_address: 172.21.255.254
    extra_hosts:
      - "flecs-floxy=172.21.0.1"

  floxy:
    image: flecspublic.azurecr.io/flecs/floxy:0
    restart: always
    network_mode: host
    volumes:
     - flecs-floxy_data:/tmp/floxy
     - flecs-floxy_certs:/etc/nginx/certs
    environment:
      FLOXY_HTTP_PORT: 80
      FLOXY_HTTPS_PORT: 443
      FLOXY_FLECS_GATEWAY: 172.21.0.1

networks:
  flecs:
    name: flecs
    ipam:
      driver: default
      config:
        - subnet: 172.21.0.0/16
          gateway: 172.21.0.1

volumes:
  flecsd:
  flecs-floxy_certs:
    name: flecs-floxy_certs
  flecs-floxy_data:
    name: flecs-floxy_data
    driver: local
    driver_opts:
      device: tmpfs
      type: tmpfs
      o: size=4m
```

Then, deploy FLECS by running:

```
docker compose up -d
```

#### **Manual Docker Run Commands**

Alternatively, you can start the FLECS components manually using Docker commands.<br>

1. **Create required volumes**

   ```
   docker volume create \
       --driver local \
       -o type=tmpfs \
       -o device=tmpfs \
       -o o=size=4m \
       flecs-floxy_data
   ```

   This temporary volume will be shared between the FLECS Core (`flecs-flecsd`) and floxy (`flecs-floxy`), our standalone reverse proxy. The other volumes (`flecsd` and `flecs-floxy_certs`, will be created with default values by docker during the `docker run` commands)<br>

2. **Create required network**

   ```
   docker network create \
       --driver bridge \
       --subnet 172.21.0.0/16 \
       --gateway 172.21.0.1 \
       flecs
   ```

3. **Deploy FLECS Floxy**

   ```
   docker run -d \
       --restart always \
       --name flecs-floxy \
       --network host \
       -v flecs-floxy_data:/tmp/floxy \
       -v flecs-floxy_certs:/etc/nginx/certs \
       --env FLOXY_HTTP_PORT=8080 \
       --env FLOXY_HTTPS_PORT=8443 \
       --env FLOXY_FLECS_GATEWAY=172.21.0.1 \
       flecspublic.azurecr.io/flecs/floxy:0
   ```

   This command spins up FLECS Floxy the flecs reverse proxy. \
   The FLECS WebApp and FLECS Core will be reachable through `http/8080` and `https/8443` via this reverse proxy. You can freely choose both ports according to your needs. **Note that all http connections will be automatically upgraded to https** for security reasons. As the certificates are self-signed, you have to accept a security exception in your browser or, when using `curl`, pass `-k` to accept self-signed certificates.<br>

4. **Deploy the FLECS Daemon (`flecs-flecsd`)**

   ```
   docker run -d \
       --restart always \
       --name flecs-flecsd \
       --network host \
       -v flecsd:/var/lib/flecs \
       -v flecs-floxy_data:/tmp/floxy \
       -v /run/docker.sock:/run/docker.sock \
       flecspublic.azurecr.io/flecs-slim:5.2.0-red-deer
   ```

   This command runs flecs-flecsd in the background, using host networking for full feature support. It also mounts, and implicitly creates, the necessary volumes for persistent storage and passes through the host Docker socket for creating Apps.<br>

5. **Deploy the FLECS WebApp**

   ```
   docker run -d \
       --restart always \
       --name flecs-webapp \
       --network flecs \
       --ip 172.21.255.254 \
       --add-host flecs-floxy:172.21.0.1 \
       flecspublic.azurecr.io/webapp:5.2.0-red-deer
   ```

   Finally, this command spins up the FLECS WebApp on the custom `flecs` network, assigning it a special, reserved IP address.

#### **Interacting with the WebApp**

After installation, open a browser and navigate to `http://localhost:8080/` to open the FLECS WebApp. Due to the use of self-signed certificates by default, you'll have to accept a security exception in your browser.

### **Install FLECS on Your Device with FILiP** <a href="#install-flecs-on-your-device-with-filip" id="install-flecs-on-your-device-with-filip"></a>

For those who wish to install FLECS on their own hardware, FILiP simplifies the process with a one-liner installation command. This method is ideal if you want to use your existing Linux-based device for automation tasks.

{% content-ref url="<https://app.gitbook.com/s/NrNvjiw8yJDuaBQ3eLv5/flecs-core/installing-flecs-core>" %}
[Installing FLECS Core](https://app.gitbook.com/s/NrNvjiw8yJDuaBQ3eLv5/flecs-core/installing-flecs-core)
{% endcontent-ref %}
