//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

=== Quick start with Docker

Begin by creating a `docker-compose.yml` file with the following content:

[source]
----
version: '3.8'
services:
    elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.17.5
    environment:
        - discovery.type=single-node
    ports:
        - 9200:9200
    unomi:
    # Unomi version can be updated based on your needs
    image: apache/unomi:2.0.0
    environment:
        - UNOMI_ELASTICSEARCH_ADDRESSES=elasticsearch:9200
        - UNOMI_THIRDPARTY_PROVIDER1_IPADDRESSES=0.0.0.0/0,::1,127.0.0.1
    ports:
        - 8181:8181
        - 9443:9443
        - 8102:8102
    links:
        - elasticsearch
    depends_on:
        - elasticsearch
----

From the same folder, start the environment using `docker-compose up` and wait for the startup to complete.

Try accessing https://localhost:9443/cxs/cluster with username/password: karaf/karaf . You might get a certificate warning in your browser, just accept it despite the warning it is safe.

=== Quick Start manually

1) Install JDK 17 and make sure you set the JAVA_HOME variable (see our <<JDK compatibility,Getting Started>> guide for more information on JDK compatibility)

2) Download ElasticSearch here : https://www.elastic.co/downloads/past-releases/elasticsearch-7-17-5 (please *make sure* you use the proper version : 7.17.5)

3) Uncompress it and change the `config/elasticsearch.yml` to include the following config :

[source,yaml]
----
cluster.name: contextElasticSearch
----

4) Launch ElasticSearch using : `bin/elasticsearch`

5) Download Apache Unomi here : https://unomi.apache.org/download.html

6) Start it using : `./bin/karaf`

7) Start the Apache Unomi packages using `unomi:start` in the Apache Karaf Shell

8) Wait for startup to complete

9) Try accessing https://localhost:9443/cxs/cluster with username/password: `karaf/karaf` . You might get a certificate warning in your browser, just accept it despite the warning it is safe.

10) Request your first context by simply accessing : http://localhost:8181/cxs/context.js?sessionId=1234

11) If something goes wrong, you should check the logs in `./data/log/karaf.log`. If you get errors on ElasticSearch,
make sure you are using the proper version.

Next steps:

- Trying our integration <<Samples,samples page>>
