org.apache.brooklyn.entity.proxy.nginx.NginxController Maven / Gradle / Ivy
Show all versions of brooklyn-software-webapp Show documentation
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package org.apache.brooklyn.entity.proxy.nginx;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import org.apache.brooklyn.api.catalog.Catalog;
import org.apache.brooklyn.api.entity.ImplementedBy;
import org.apache.brooklyn.api.objs.HasShortName;
import org.apache.brooklyn.api.sensor.AttributeSensor;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.annotation.Effector;
import org.apache.brooklyn.core.annotation.EffectorParam;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.core.effector.MethodEffector;
import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
import org.apache.brooklyn.core.sensor.Sensors;
import org.apache.brooklyn.entity.proxy.AbstractController;
import org.apache.brooklyn.entity.proxy.ProxySslConfig;
import org.apache.brooklyn.entity.software.base.SoftwareProcess;
import org.apache.brooklyn.util.core.flags.SetFromFlag;
/**
* An entity that represents an Nginx proxy (e.g. for routing requests to servers in a cluster).
*
* The default driver *builds* nginx from source (because binaries are not reliably available, esp not with sticky sessions).
* This requires gcc and other build tools installed. The code attempts to install them but inevitably
* this entity may be more finicky about the OS/image where it runs than others.
*
* Paritcularly on OS X we require Xcode and command-line gcc installed and on the path.
*
* See {@link http://library.linode.com/web-servers/nginx/configuration/basic} for useful info/examples
* of configuring nginx.
*
* https configuration is supported, with the certificates providable on a per-UrlMapping basis or a global basis.
* (not supported to define in both places.)
* per-Url is useful if different certificates are used for different server names,
* or different ports if that is supported.
* see more info on Ssl in {@link ProxySslConfig}.
*/
@Catalog(name="Nginx Server", description="A single Nginx server. Provides HTTP and reverse proxy services", iconUrl="classpath:///nginx-logo.jpeg")
@ImplementedBy(NginxControllerImpl.class)
public interface NginxController extends AbstractController, HasShortName {
MethodEffector GET_CURRENT_CONFIGURATION =
new MethodEffector(NginxController.class, "getCurrentConfiguration");
MethodEffector DEPLOY =
new MethodEffector(NginxController.class, "deploy");
@SetFromFlag("version")
ConfigKey SUGGESTED_VERSION =
ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "1.8.0");
@SetFromFlag("archiveNameFormat")
ConfigKey ARCHIVE_DIRECTORY_NAME_FORMAT = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.ARCHIVE_DIRECTORY_NAME_FORMAT, "nginx-%s");
@SetFromFlag("stickyVersion")
ConfigKey STICKY_VERSION = ConfigKeys.newStringConfigKey(
"nginx.sticky.version",
"Version of ngnix-sticky-module to be installed, if required",
"1.2.5");
@SetFromFlag("pcreVersion")
ConfigKey PCRE_VERSION = ConfigKeys.newStringConfigKey(
"pcre.version",
"Version of PCRE to be installed, if required",
"8.37");
@SetFromFlag("downloadUrl")
AttributeSensorAndConfigKey DOWNLOAD_URL = ConfigKeys.newSensorAndConfigKeyWithDefault(SoftwareProcess.DOWNLOAD_URL,
"http://nginx.org/download/nginx-${version}.tar.gz");
@SetFromFlag("downloadAddonUrls")
AttributeSensorAndConfigKey