Skip to content

Commit

Permalink
update installation and connection and cloud endpoints documentation (#…
Browse files Browse the repository at this point in the history
…88)

* remove docker-compose from gitignore and improve installation instructions

* remove image creation doc

* cross ref links

* rename documentation folder to endpoints

* connection endpoints

* cloud endpoint update

* Dockerfile aligment with Dockerfile.release

(cherry picked from commit c4a55d0)
  • Loading branch information
ankicabarisic authored and fviale committed Sep 3, 2024
1 parent 77fe301 commit 9674241
Show file tree
Hide file tree
Showing 16 changed files with 273 additions and 243 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -207,5 +207,3 @@ gradle-app.setting
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

# Not sending local changes of docker-compose file
!/docker/docker-compose.yaml
86 changes: 40 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,53 +90,25 @@ To pull an image:
docker pull activeeon/sal:dev
```

#### 2.2.2. Creating a Custom SAL Docker Image:

To create your own Docker image for SAL:

1. Clone the Docker repository:

```bash
git clone https://github.com/ow2-proactive/docker
```

2. Copy the built `.war` file:

Copy the `.war` file generated in section 2.1.1 to the `docker/sal/artefacts` directory.

3. Build the Docker image:

Navigate to the `docker/sal` directory and build the image:
```bash
cd docker/sal
docker build -t activeeon/sal:test -f ./Dockerfile --no-cache .
```

4. Publish the Docker image:

```bash
docker push activeeon/sal:test
```

#### 2.2.3. Run SAL as Docker Container:
#### 2.2.2. Run SAL as Docker Container:

**Prerequisites:** Docker installed on your machine.

1. Edit the Docker Compose File:

* Open [docker-compose.yaml](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/docker/docker-compose.yaml)

* Setup connection to the ProActive scheduler
* Setup connection to the ProActive scheduler (line 43-45)

```bash
sal:
#Set up connection to ProActive server (PWS)
#Set up connection to ProActive server (PWS) by introducing the ip address of ProActive server with the port, as well as the access credential:
PWS_URL: <CHANGE_ME>
PWS_USERNAME: <CHANGE_ME>
PWS_PASSWORD: <CHANGE_ME>
```

* Setup which SAL image will be used:
* Setup which SAL image will be used (line 19):

```bash
sal:
Expand All @@ -145,22 +117,44 @@ image: activeeon/sal:test
```
NOTE: It is possible to generate automatically an image from the `.war` file generated in section 2.1.1. In this case the image tag (e.g. test) should not exist in DockerHub repository.

* Setup SAL ports:
* Setup database PASSWORD (line 9, 13 & 47):
```bash
environment:
MYSQL_ROOT_PASSWORD: PASSWORD
```
```bash
DB_USERNAME: root
DB_PASSWORD: PASSWORD
```
```bash
healthcheck:
test: [ "CMD", "mariadb-admin" , "ping", "-h", "localhost", "--password=PASSWORD" ]
```

* Setup SAL ports (line 29-33):
```bash
sal:
ports:
- "8088:8080" # sal service ports
- "9001:9001" # sal-pda service ports for debugging
```

* In a case you are running SAL on Windows change the Dockerfile to be used (line 25):
```bash
dockerfile: ./docker/Dockerfile.win
```
2. Build and Start the Containers:

Open a terminal and navigate to the directory containing your docker-compose.yaml (e.g. docker) file to start docker containers:
Open a terminal and Build SAL as described in [Section 2.1.1](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#211-build-and-run-the-microservice)
Navigate to the directory containing your docker-compose.yaml (e.g. docker) file to start docker containers:
```bash
cd .\docker\
docker-compose up --build
```
NOTE: Make sure that previous containers are removed (Step 4)

NOTE: Note that there will be some unresolved warning and errors during built of SAL, which do not have impact on its functionality.
In principle when you see this line in build log the SAL containers should be up and running:
_ERROR WebSocketTransport:231 - WebSocket Handshake Failed_
3. Verify Deployment

Check the status of the containers
Expand All @@ -180,14 +174,14 @@ docker-compose down
In this deployment approach, SAL is deployed as a pod within a Kubernetes cluster, which offers advanced orchestration and management features.
Kubernetes automatically handles deployment, scaling, and operations across a cluster of nodes, providing native support for horizontal scaling, automatic load balancing, and self-healing capabilities. The robust networking solutions provided by Kubernetes include service discovery, Ingress controllers, and built-in load balancing. This method is ideal for large-scale, production environments where high availability, scalability, and complex orchestration are required.

To deploy SAL on Kubernetes, it is to use or create a Docker image as described in section 2.2. from remote Docker repository [DockerHub](https://hub.docker.com/r/activeeon/sal/tags). You can then deploy this image as a Kubernetes pod.
To deploy SAL on Kubernetes, it is to use a Docker image as described in [Section 2.2.1](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#221-using-pre-built-sal-docker-images) from remote Docker repository [DockerHub](https://hub.docker.com/r/activeeon/sal/tags). You can then deploy this image as a Kubernetes pod.

**Prerequisites:** Kubernetes cluster (local or cloud-based) and kubectl CLI installed and configured.

1. Edit Kubernetes Deployment and Service Manifests:

Edit [sal.yaml](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/deployment/sal.yaml)
Setup ProActive connection, SAL image and ports as described in 2.2.3. Step 1
Setup ProActive connection, SAL image and ports as described in Section 2.2.2. Step 1

NOTE: Update `/path/to/scripts` to the path where your scripts are located on the host machine.

Expand Down Expand Up @@ -238,14 +232,14 @@ Below are the instructions for connecting to and disconnecting from the ProActiv
Download and install [Postman](https://www.postman.com/) if you haven’t already.

* Set Up Request:
* URL: `http://localhost:8080/sal/pagateway/connect`
* URL: `http://localhost:8088/sal/pagateway/connect`
* Method: POST
* Headers: None
* Body:
```bash
{
"username": "Proactive server username",
"password": "Proactive server password"
"username": {{myLogin}},
"password": {{myPassword}}
}
```
* Send Request: Click the "Send" button to execute the request and review the response.
Expand All @@ -268,7 +262,7 @@ curl -X POST "http://localhost:8080/sal/pagateway/connect" \
### 3.2. View SAL logs

#### 3.2.1 View Logs for SAL deployed as Docker Container
When SAL is deployed as a Docker Container like in section 2.2, you can view its logs using Docker commands.
When SAL is deployed as a Docker Container like in [Section 2.2](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#22-deploying-sal-as-a-docker-container), you can view its logs using Docker commands.

* Launch your command line interface (CLI).
* List Running Containers: To find the container name or ID, use:
Expand Down Expand Up @@ -475,15 +469,15 @@ This shows CPU and memory usage, helping you identify any resource constraints o

1. Ensure that SAL is running

SAL need to be deployed and prepared for usage as described in section 2.
SAL need to be deployed and prepared for usage as described in [Section 2](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#2-installation).

* **SAL in Docker:**

The `docker-compose.yaml` file includes a debugging service for SAL, exposing port 9001 by default (see section 2.2). This port is typically configured for remote debugging using the Java Debug Wire Protocol (JDWP) so it is sufficient that SAL container is running.
The `docker-compose.yaml` file includes a debugging service for SAL, exposing port 9001 by default (see [Section 2.2)](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#22-deploying-sal-as-a-docker-container). This port is typically configured for remote debugging using the Java Debug Wire Protocol (JDWP) so it is sufficient that SAL container is running.

* **SAL as Kubernetes Pod:**

The `sal.yaml` file for Kubernetes also includes configuration for the debugging service, exposing port 9001 by default (see section 2.3). To use debugging service To access the debugging port on your local machine, set up port forwarding from your Kubernetes pod to your local machine:
The `sal.yaml` file for Kubernetes also includes configuration for the debugging service, exposing port 9001 by default (see [Section 2.3](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#23-deploying-sal-as-a-kubernetes-pod)). To use debugging service To access the debugging port on your local machine, set up port forwarding from your Kubernetes pod to your local machine:
```bash
kubectl port-forward deployment/sal 9001:9001
#In case the SAL is not deployed as sal, replace it with the actual name of your SAL deployment.
Expand All @@ -510,8 +504,8 @@ With your IDE configured, you can now start a debugging session.The following me
```bash
Connected to the target VM, address: 'localhost:9001', transport: 'socket'
```
Use SAL endpoints as described in section 3.1. and set breakpoints in your code. As the SAL service executes, your IDE will stop at these breakpoints, allowing you to inspect variables, step through code, and diagnose issues.
During debugging is advised to check SAL logs as described in section 3.2.
Use SAL endpoints as described in [Section 3.1.](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#31-using-sal-rest-endpoints) and set breakpoints in your code. As the SAL service executes, your IDE will stop at these breakpoints, allowing you to inspect variables, step through code, and diagnose issues.
During debugging is advised to check SAL logs as described in [Section 3.2.](https://github.com/ow2-proactive/scheduling-abstraction-layer/blob/master/README.md#32-view-sal-logs)

## 4. Contributing

Expand Down
5 changes: 2 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM tomcat:9.0.68-jdk8-corretto-al2

RUN rm -rf ${CATALINA_HOME}/webapps/*
# NOTE: Switch between local or public builded SAL
RUN curl -o /usr/local/tomcat/webapps/sal.war http://repository.activeeon.com/content/groups/proactive/org/ow2/proactive/scheduling-abstraction-layer/13.1.0-SNAPSHOT/scheduling-abstraction-layer-13.1.0-20221027.125525-9.war
# RUN curl -o /usr/local/tomcat/webapps/sal.war http://repository.activeeon.com/content/groups/proactive/org/ow2/proactive/scheduling-abstraction-layer/13.1.0-SNAPSHOT/scheduling-abstraction-layer-13.1.0-20221027.125525-9.war
COPY sal-service/build/libs/scheduling-abstraction-layer-*.war /usr/local/tomcat/webapps/sal.war

COPY docker/scripts/* /usr/local/tomcat/scripts/
ENV EXTERNAL_CONFIG_DIR=${CATALINA_HOME}/conf
ENV PROPERTIES_FILENAME='sal'

Expand All @@ -26,7 +26,6 @@ ENV DB_DRIVER_CLASSNAME='org.mariadb.jdbc.Driver'
ENV DB_URL='jdbc:mariadb://localhost:3306/proactive'
ENV DB_PLATFORM='org.hibernate.dialect.MariaDB53Dialect'

CMD ["catalina.sh", "jpda", "run"]
RUN yum install -y nmap-ncat
RUN chmod +x /usr/local/tomcat/bin/wait_for_db.sh
CMD ["/bin/bash", "-c", "wait_for_db.sh && catalina.sh jpda run"]
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.win
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ FROM tomcat:9.0.68-jdk8-corretto-al2

RUN rm -rf ${CATALINA_HOME}/webapps/*
# NOTE: Switch between local or public builded SAL
RUN curl -o /usr/local/tomcat/webapps/sal.war http://repository.activeeon.com/content/groups/proactive/org/ow2/proactive/scheduling-abstraction-layer/13.1.0-SNAPSHOT/scheduling-abstraction-layer-13.1.0-20221027.125525-9.war
#RUN curl -o /usr/local/tomcat/webapps/sal.war http://repository.activeeon.com/content/groups/proactive/org/ow2/proactive/scheduling-abstraction-layer/13.1.0-SNAPSHOT/scheduling-abstraction-layer-13.1.0-20221027.125525-9.war
COPY sal-service/build/libs/scheduling-abstraction-layer-*.war /usr/local/tomcat/webapps/sal.war

COPY docker/scripts/* /usr/local/tomcat/scripts/
ENV EXTERNAL_CONFIG_DIR=${CATALINA_HOME}/conf
ENV PROPERTIES_FILENAME='sal'

Expand Down
32 changes: 0 additions & 32 deletions documentation/1-connection-endpoints.md

This file was deleted.

Loading

0 comments on commit 9674241

Please sign in to comment.