generated from ow2-proactive/yamt
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* intermediate push * first cluster deployment * cluster scale out endpoint * change job name * improvement of the get cluster + providing node status * get the workflows from scripts * adding the files needed to create the docker container locally * scripts with no onm * changing to file for scripts instead of hardcoded scripts * changing hostname and adding label node endpoint * deployApplication, ScaleIn and DeleteCluster endpoints created * one file missed in the last push * fixing delete cluster and some other changes * adding envVars and enabling cluster edge nodes --------- Co-authored-by: Ali Fahs <[email protected]>
- Loading branch information
1 parent
b4e8ee6
commit 0028c79
Showing
47 changed files
with
1,860 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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 | ||
COPY sal-service/build/libs/scheduling-abstraction-layer-*.war /usr/local/tomcat/webapps/sal.war | ||
|
||
ENV EXTERNAL_CONFIG_DIR=${CATALINA_HOME}/conf | ||
ENV PROPERTIES_FILENAME='sal' | ||
|
||
ENV PA_HOME=${CATALINA_HOME} | ||
|
||
COPY docker/scheduling-abstraction-layer.xml ${EXTERNAL_CONFIG_DIR}/Catalina/localhost/sal.xml | ||
# NOTE: Please make sure if you set a different `PROPERTIES_FILENAME` to copy your properties file inside the container | ||
COPY docker/sal.application.properties ${EXTERNAL_CONFIG_DIR}/${PROPERTIES_FILENAME}.properties | ||
|
||
ENV PWS_URL='http://localhost:8080/' | ||
ENV PWS_USERNAME='admin' | ||
ENV PWS_PASSWORD='admin' | ||
|
||
ENV DB_USERNAME='root' | ||
ENV DB_PASSWORD='' | ||
|
||
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"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
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 | ||
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' | ||
|
||
ENV PA_HOME=${CATALINA_HOME} | ||
|
||
COPY docker/scheduling-abstraction-layer.xml ${EXTERNAL_CONFIG_DIR}/Catalina/localhost/sal.xml | ||
# NOTE: Please make sure if you set a different `PROPERTIES_FILENAME` to copy your properties file inside the container | ||
COPY docker/sal.application.properties ${EXTERNAL_CONFIG_DIR}/${PROPERTIES_FILENAME}.properties | ||
|
||
ENV PWS_URL='http://localhost:8080/' | ||
ENV PWS_USERNAME='admin' | ||
ENV PWS_PASSWORD='admin' | ||
|
||
ENV DB_USERNAME='root' | ||
ENV DB_PASSWORD='' | ||
|
||
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"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Description | ||
|
||
This Docker compose contains two containers: | ||
- The container containing SAL as a service. | ||
- Maria DB container. | ||
|
||
# Docker compose Automation | ||
|
||
To automate the deployment of the docker compose of SAL you create the following script: | ||
|
||
```bash | ||
#!/bin/bash | ||
|
||
|
||
cd <SAL_REPO_HOME_DIR> | ||
|
||
./gradlew spotlessApply clean build --refresh-dependencies | ||
|
||
cd <DOCKEE_SAL_DIR> | ||
|
||
rm -f ./artefacts/scheduling-abstraction-layer-13.1.0-SNAPSHOT.war | ||
|
||
cp <SAL_REPO_HOME_DIR>/sal-service/build/libs/scheduling-abstraction-layer-13.1.0-SNAPSHOT.war ./artefacts | ||
|
||
docker-compose down | ||
|
||
docker build -t activeeon/sal:latest -f ./Dockerfile --no-cache . | ||
|
||
docker-compose up | ||
|
||
|
||
``` | ||
> NOTE: Please change <SAL_REPO_HOME_DIR> and <DOCKEE_SAL_DIR> for the correct ones. | ||
|
||
Each time the code is modified in <SAL_REPO_HOME_DIR>, you can simple run this script and it will automatically launch new container with the changes included. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
services: | ||
database: | ||
image: mariadb | ||
ports: | ||
- "3307:3306" | ||
networks: | ||
- db-tier | ||
environment: | ||
MYSQL_ROOT_PASSWORD: PASSWORD | ||
MYSQL_DATABASE: proactive | ||
container_name: myComposeMariaDB | ||
healthcheck: | ||
test: [ "CMD", "mariadb-admin" , "ping", "-h", "localhost", "--password=PASSWORD" ] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
sal: | ||
image: activeeon/sal:test | ||
build: | ||
context: .. | ||
dockerfile: ./docker/Dockerfile | ||
depends_on: | ||
database: | ||
condition: service_healthy | ||
ports: | ||
- "8088:8080" | ||
- "9001:9001" | ||
links: | ||
- "database:myComposeMariaDB" | ||
networks: | ||
- db-tier | ||
volumes: | ||
- ./scripts:/usr/local/tomcat/scripts | ||
environment: | ||
PROPERTIES_FILENAME: sal | ||
PWS_URL: <CHANGE_ME> | ||
PWS_USERNAME: <CHANGE_ME> | ||
PWS_PASSWORD: <CHANGE_ME> | ||
DB_USERNAME: root | ||
DB_PASSWORD: PASSWORD | ||
DB_DRIVER_CLASSNAME: org.mariadb.jdbc.Driver | ||
DB_URL: jdbc:mariadb://myComposeMariaDB:3306/proactive | ||
DB_PLATFORM: org.hibernate.dialect.MariaDB53Dialect | ||
JPDA_ADDRESS: 9001 | ||
JPDA_TRANSPORT: dt_socket | ||
container_name: myComposeSAL | ||
|
||
networks: | ||
# The presence of these objects is sufficient to define them | ||
db-tier: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#Configure the service | ||
pa.url=${PWS_URL} | ||
pa.login=${PWS_USERNAME} | ||
pa.password=${PWS_PASSWORD} | ||
|
||
#Configure logging level | ||
logging.level.org.ow2.proactive.sal.service=info | ||
logging.level.org.springframework.web=info | ||
|
||
#Embedded server configuration | ||
server.compression.enabled=true | ||
server.contextPath=/ | ||
|
||
#Disable Spring banner | ||
spring.main.banner_mode=off | ||
|
||
#Disable Spring security | ||
security.basic.enabled=false | ||
management.security.enabled=false | ||
|
||
spring.jackson.serialization.fail-on-empty-beans=false | ||
|
||
###################### | ||
# HIKARI & JPA # | ||
###################### | ||
|
||
# Hibernate ddl auto (create, create-drop, update) | ||
spring.jpa.hibernate.ddl-auto=update | ||
|
||
spring.jmx.unique-names=true | ||
spring.datasource.pool-name=proactive | ||
spring.jmx.default-domain=proactive | ||
spring.datasource.type=com.zaxxer.hikari.HikariDataSource | ||
# The classname of a custom org.hibernate.connection.ConnectionProvider which provides JDBC connections to Hibernate | ||
spring.jpa.hibernate.connection.provider_class=org.hibernate.hikaricp.internal.HikariCPConnectionProvider | ||
|
||
# JDBC connection pool configuration | ||
# https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby | ||
spring.datasource.connection-timeout=120000 | ||
spring.datasource.maximum-pool-size=20 | ||
spring.datasource.transaction-isolation=TRANSACTION_READ_COMMITTED | ||
spring.datasource.leak-detection-threshold=600000 | ||
spring.datasource.validation-timeout=20000 | ||
|
||
# Enable Hibernate's automatic session context management | ||
spring.jpa.properties.hibernate.current_session_context_class=thread | ||
|
||
#The default settings are using mariaDB | ||
######################## Maria DB ####################################################### | ||
spring.datasource.driverClassName=${DB_DRIVER_CLASSNAME} | ||
spring.datasource.url=${DB_URL} | ||
spring.datasource.username=${DB_USERNAME} | ||
|
||
#Use tools/encrypt to create an encrypted password | ||
spring.datasource.password=${DB_PASSWORD} | ||
spring.datasource.testOnBorrow=true | ||
spring.datasource.validationQuery=SELECT 1 | ||
spring.jpa.database-platform=${DB_PLATFORM} | ||
spring.jpa.show-sql=false | ||
logging.level.org.hibernate.SQL=off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<Context> | ||
<Environment name="configurationPath" value="file:${EXTERNAL_CONFIG_DIR}/{PROPERTIES_FILENAME}.properties" type="java.lang.String"/> | ||
</Context> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
echo "Master install script" | ||
|
||
wget https://raw.githubusercontent.com/alijawadfahs/scripts/main/nebulous/install-kube-u22.sh && chmod +x ./install-kube-u22.sh && ./install-kube-u22.sh | ||
|
||
echo "Installing Helm..." | ||
sudo -H -u ubuntu bash -c ' curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 && chmod 700 get_helm.sh && ./get_helm.sh' | ||
# Add KubeVela Helm repository and update | ||
|
||
sudo -H -u ubuntu bash -c 'curl -fsSl https://kubevela.io/script/install.sh | bash' | ||
echo "Configuration complete." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
echo "Master post-install script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
echo "Master pre-install script" | ||
sudo hostnamectl set-hostname "$variables_PA_JOB_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
echo "Master start script" | ||
|
||
sudo kubeadm init --pod-network-cidr 10.244.0.0/16 | ||
|
||
echo "HOME: $(pwd), USERE: $(id -u -n)" | ||
mkdir -p ~/.kube && sudo cp -i /etc/kubernetes/admin.conf ~/.kube/config && sudo chown $(id -u):$(id -g) ~/.kube/config | ||
id -u ubuntu &> /dev/null | ||
|
||
if [[ $? -eq 0 ]] | ||
then | ||
#USER ubuntu is found | ||
mkdir -p /home/ubuntu/.kube && sudo cp -i /etc/kubernetes/admin.conf /home/ubuntu/.kube/config && sudo chown ubuntu:ubuntu /home/ubuntu/.kube/config | ||
else | ||
echo "User Ubuntu is not found" | ||
fi | ||
|
||
|
||
sudo -H -u ubuntu kubectl apply -f https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml; | ||
|
||
echo "Setting KubeVela..." | ||
sudo -H -u ubuntu bash -c 'helm repo add kubevela https://kubevela.github.io/charts && helm repo update' | ||
sudo -H -u ubuntu bash -c 'nohup helm install --create-namespace -n vela-system kubevela kubevela/vela-core > /home/ubuntu/vela.txt 2>&1 &' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
echo "Master stop script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
echo "Master update script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
echo "Worker install script" | ||
wget https://raw.githubusercontent.com/alijawadfahs/scripts/main/nebulous/install-kube-u22.sh && chmod +x ./install-kube-u22.sh && ./install-kube-u22.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
echo "worker post-install script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
echo "Worker pre-install script" | ||
sudo hostnamectl set-hostname "$variables_PA_JOB_NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
echo "Worker start script" | ||
echo $variables_kubeCommand | ||
sudo $variables_kubeCommand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
echo "Worker stop script" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
echo "Worker update script" |
73 changes: 73 additions & 0 deletions
73
sal-common/src/main/java/org/ow2/proactive/sal/model/Cluster.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* ProActive Parallel Suite(TM): | ||
* The Open Source library for parallel and distributed | ||
* Workflows & Scheduling, Orchestration, Cloud Automation | ||
* and Big Data Analysis on Enterprise Grids & Clouds. | ||
* | ||
* Copyright (c) 2007 - 2017 ActiveEon | ||
* Contact: [email protected] | ||
* | ||
* This library is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU Affero General Public License | ||
* as published by the Free Software Foundation: version 3 of | ||
* the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* If needed, contact us to obtain a release under GPL Version 2 or 3 | ||
* or a different license than the AGPL. | ||
*/ | ||
package org.ow2.proactive.sal.model; | ||
|
||
import java.util.List; | ||
|
||
import javax.persistence.*; | ||
|
||
import org.hibernate.annotations.GenericGenerator; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
|
||
|
||
@Getter | ||
@Setter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Entity | ||
@Table(name = "CLUSTER") | ||
public class Cluster { | ||
@Id | ||
@GeneratedValue(generator = "system-uuid") | ||
@GenericGenerator(name = "system-uuid", strategy = "uuid") | ||
@Column(name = "CLUSTER_ID") | ||
private String clusterId = null; | ||
|
||
@Column(name = "NAME") | ||
@JsonProperty("name") | ||
private String name = null; | ||
|
||
@Column(name = "MASTER_NODE") | ||
@JsonProperty("master-node") | ||
private String masterNode; | ||
|
||
@Column(name = "NODES") | ||
@JsonProperty("nodes") | ||
@OneToMany(fetch = FetchType.LAZY, orphanRemoval = true, cascade = CascadeType.REFRESH) | ||
private List<ClusterNodeDefinition> nodes; | ||
|
||
// TODO: Change this into Enum | ||
@Column(name = "STATUS") | ||
@JsonProperty("status") | ||
private String status = "defined"; | ||
|
||
} |
Oops, something went wrong.