mirror of
https://github.com/ZwareBear/JFrog-Cloud-Installers.git
synced 2026-01-21 08:06:57 -06:00
Structured files into more logical form
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import org.artifactory.state.ArtifactoryServerState
|
||||
import org.artifactory.storage.db.servers.service.ArtifactoryServersCommonService
|
||||
import org.artifactory.common.ConstantValues
|
||||
import org.slf4j.Logger
|
||||
import java.util.concurrent.TimeUnit
|
||||
jobs {
|
||||
clean(interval: 90000, delay: 900000) {
|
||||
runCleanupHAInactiveServers()
|
||||
}
|
||||
}
|
||||
executions {
|
||||
cleanHAInactiveServers() { params ->
|
||||
runCleanupHAInactiveServers()
|
||||
}
|
||||
}
|
||||
def runCleanupHAInactiveServers() {
|
||||
def artifactoryServersCommonService = ctx.beanForType(ArtifactoryServersCommonService)
|
||||
def artifactoryInactiveServerCleaner = new ArtifactoryInactiveServersCleaner(artifactoryServersCommonService, log)
|
||||
artifactoryInactiveServerCleaner.cleanInactiveArtifactoryServers()
|
||||
}
|
||||
public class ArtifactoryInactiveServersCleaner {
|
||||
private ArtifactoryServersCommonService artifactoryServersCommonService
|
||||
private Logger log
|
||||
ArtifactoryInactiveServersCleaner(ArtifactoryServersCommonService artifactoryServersCommonService, Logger log) {
|
||||
this.artifactoryServersCommonService = artifactoryServersCommonService
|
||||
this.log = log
|
||||
}
|
||||
def cleanInactiveArtifactoryServers() {
|
||||
log.info "Executing inactive artifactory servers cleaner plugin"
|
||||
List<String> allMembers = artifactoryServersCommonService.getAllArtifactoryServers()
|
||||
for (member in allMembers) {
|
||||
def heartbeat = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis() - member.getLastHeartbeat())
|
||||
def noHeartbeat = heartbeat > ConstantValues.haHeartbeatStaleIntervalSecs.getInt()
|
||||
if (member.getServerState() == ArtifactoryServerState.UNAVAILABLE || ( noHeartbeat && member.getServerState() != ArtifactoryServerState.CONVERTING && member.getServerState() != ArtifactoryServerState.STARTING )) {
|
||||
try {
|
||||
log.info "Inactive artifactory servers cleaning task found server ${member.serverId} to remove"
|
||||
artifactoryServersCommonService.removeServer(member.serverId)
|
||||
}catch (Exception e){
|
||||
log.error "Error: Not able to remove ${member.serverId}, ${e.message}"
|
||||
}
|
||||
}
|
||||
}
|
||||
log.info "No inactive servers found"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"productId": "JFrogInstaller_Cloudformation/1.0.0",
|
||||
"features": [
|
||||
{
|
||||
"featureId": "MySql/5.5"
|
||||
}]
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
error_log /var/log/nginx/error.log info;
|
||||
#pid logs/nginx.pid;
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
http {
|
||||
include mime.types;
|
||||
variables_hash_max_size 1024;
|
||||
variables_hash_bucket_size 64;
|
||||
server_names_hash_max_size 4096;
|
||||
server_names_hash_bucket_size 128;
|
||||
types_hash_max_size 2048;
|
||||
types_hash_bucket_size 64;
|
||||
proxy_read_timeout 2400s;
|
||||
client_header_timeout 2400s;
|
||||
client_body_timeout 2400s;
|
||||
proxy_connect_timeout 75s;
|
||||
proxy_send_timeout 2400s;
|
||||
proxy_buffer_size 32k;
|
||||
proxy_buffers 40 32k;
|
||||
proxy_busy_buffers_size 64k;
|
||||
proxy_temp_file_write_size 250m;
|
||||
proxy_http_version 1.1;
|
||||
client_body_buffer_size 128k;
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
default_type application/octet-stream;
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
access_log /var/log/nginx/access.log main;
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
#keepalive_timeout 0;
|
||||
keepalive_timeout 65;
|
||||
}
|
||||
Reference in New Issue
Block a user