Using DNS for challenge
certbot -d foo.bar.com --manual --prefered-challenges dns certonlyApache Cert Config
SSLCertificateFile /etc/letsencrypt/live/foo.bar.com/fullchain.pemSSLCertificateKeyFile /etc/letsencrypt/live/foo.bar.com/privkey.pem
sudo -- bash -c 'docker volume rm $(docker volume ls -f dangling=true -q)' > /dev/null 2>&1
sudo -- bash -c 'docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi' > /dev/null 2>&1
echo $?
import com.amazonaws.services.lambda.runtime.Context; import com.amazonaws.services.lambda.runtime.LambdaLogger; import java.util.HashMap; import java.util.Map; public class LambdaAPIGateway { public Map<String, Object> handleRequest(Map<String, Object> request, Context context) { LambdaLogger logger = context.getLogger(); logger.log("Function version: " + context.getFunctionVersion() + "; "); logger.log("Event: " + request.toString()); String bodyAsJson = "{\"data\":\"ok\"}"; Map<String, Object> result = Respond(200, bodyAsJson, context); return result; } public static Map<String, Object> Respond(int httpStatus, String bodyAsJson, Context context) { Map<String, Object> retval = new HashMap<>(); /** Response MUST be in a specific format with "headers"; "statusCode" and "body" ONLY Example: { "headers": {"Content-Type":"application/json"}, "body":"...", "statusCode":200 } See http://amzn.to/2lY4oQB (under the heading Output Format of a Lambda Function for Proxy Integration) */ Map<String, Object> headers = new HashMap<>(); headers.put("Content-Type", "application/json"); headers.put("x-request-id", context.getAwsRequestId()); retval.put("headers", headers); retval.put("statusCode", httpStatus); retval.put("body", bodyAsJson); return retval; } }
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_servlet</artifactId>
<version>0.0.6</version>
</dependency>
public class Metrics {
public static final Summary requestLatency = Summary.build()
.name("requests_latency_seconds")
.help("Request latency in seconds.").register();
public static final Counter requestFailures = Counter.build()
.name("requests_failures_total")
.help("Request failures.").register();
public static final Counter requestsTotal = Counter.build()
.name("requests_total")
.help("Request.").register();
public static final Counter uploadedFilesSucceeded = Counter.build()
.name("upload_file_success")
.help("Total files uploaded to S3.").register();
public static final Counter tmpFilesNotCleared = Counter.build()
.name("temp_files_not_cleared")
.help("Total files that could not be removed from cache").register();
}
private final Metrics metrics = new Metrics();
@GET
@Path("/something")
@Produces(MediaType.TEXT_PLAIN)
public String Something() {
try {
Summary.Timer timer = Metrics.requestLatency.startTimer();
// do some work ...
timer.observeDuration();
} catch (Exception e) {
return e.getMessage();
}
return "It works!";
}
@GET
@Path("/metrics")
@Produces(MediaType.TEXT_PLAIN)
public String Metrics() {
StringWriter writer = new StringWriter();
try {
io.prometheus.client.exporter.common.TextFormat.write004(
writer, CollectorRegistry.defaultRegistry.metricFamilySamples());
} catch (Exception e) {
return e.getMessage();
}
return writer.toString();
}
# HELP requests_failures_total Request failures.
# TYPE requests_failures_total counter
requests_failures_total 0.0
# HELP temp_files_not_cleared Total files that could not be removed from cache
# TYPE temp_files_not_cleared counter
temp_files_not_cleared 0.0
# HELP requests_latency_seconds Request latency in seconds.
# TYPE requests_latency_seconds summary
requests_latency_seconds_count 0.25
requests_latency_seconds_sum 1.0
# HELP upload_file_success Total file uploaded to S3.
# TYPE upload_file_success counter
upload_file_success 25874588.0
# HELP requests_failures_total Request failures.
# TYPE requests_failures_total counter
requests_failures_total 2.0
with heartbeat_data (source, time) as (
values ('test', now())
),
update_query as (
update dvs_system.heartbeats
set last_beat = heartbeat_data.time
from heartbeat_data
where source_key = heartbeat_data.source
returning true as updated
)
insert into dvs_system.heartbeats (source_key, last_beat)
select source, time
from heartbeat_data
where not exists (
select 1 from update_query where updated = TRUE
)
;