mirror of
https://github.com/replicatedhq/ttl.sh.git
synced 2026-05-11 19:06:33 +00:00
24
.github/main.workflow
vendored
24
.github/main.workflow
vendored
@@ -3,7 +3,13 @@ workflow "Deploy to Heroku" {
|
||||
resolves = ["release registry", "release hooks", "release reaper"]
|
||||
}
|
||||
|
||||
action "only master branch" {
|
||||
uses = "actions/bin/filter@master"
|
||||
args = "branch master"
|
||||
}
|
||||
|
||||
action "heroku login" {
|
||||
needs = "only master branch"
|
||||
uses = "actions/heroku@master"
|
||||
args = "container:login"
|
||||
secrets = ["HEROKU_API_KEY"]
|
||||
@@ -12,56 +18,56 @@ action "heroku login" {
|
||||
action "build registry" {
|
||||
uses = "actions/docker/cli@master"
|
||||
needs = "heroku login"
|
||||
args = "build -t registry.heroku.com/replreg/web registry"
|
||||
args = "build -t registry.heroku.com/ttlsh/web registry"
|
||||
}
|
||||
|
||||
action "push registry" {
|
||||
uses = "actions/docker/cli@master"
|
||||
needs = "build registry"
|
||||
args = "push registry.heroku.com/replreg/web"
|
||||
args = "push registry.heroku.com/ttlsh/web"
|
||||
}
|
||||
|
||||
action "release registry" {
|
||||
uses = "actions/heroku@master"
|
||||
needs = "push registry"
|
||||
args = "container:release -a replreg web"
|
||||
args = "container:release -a ttlsh web"
|
||||
secrets = ["HEROKU_API_KEY"]
|
||||
}
|
||||
|
||||
action "build hooks" {
|
||||
uses = "actions/docker/cli@master"
|
||||
needs = "heroku login"
|
||||
args = "build -f hooks/Dockerfile.hooks -t registry.heroku.com/replreg-hooks/web hooks"
|
||||
args = "build -f hooks/Dockerfile.hooks -t registry.heroku.com/ttlsh-hooks/web hooks"
|
||||
}
|
||||
|
||||
action "push hooks" {
|
||||
uses = "actions/docker/cli@master"
|
||||
needs = "build hooks"
|
||||
args = "push registry.heroku.com/replreg-hooks/web"
|
||||
args = "push registry.heroku.com/ttlsh-hooks/web"
|
||||
}
|
||||
|
||||
action "release hooks" {
|
||||
uses = "actions/heroku@master"
|
||||
needs = "push hooks"
|
||||
args = "container:release -a replreg-hooks web"
|
||||
args = "container:release -a ttlsh-hooks web"
|
||||
secrets = ["HEROKU_API_KEY"]
|
||||
}
|
||||
|
||||
action "build reaper" {
|
||||
uses = "actions/docker/cli@master"
|
||||
needs = "heroku login"
|
||||
args = "build -f hooks/Dockerfile.reap -t registry.heroku.com/replreg-hooks/reap hooks"
|
||||
args = "build -f hooks/Dockerfile.reap -t registry.heroku.com/ttlsh-hooks/reap hooks"
|
||||
}
|
||||
|
||||
action "push reaper" {
|
||||
uses = "actions/docker/cli@master"
|
||||
needs = "build reaper"
|
||||
args = "push registry.heroku.com/replreg-hooks/reap"
|
||||
args = "push registry.heroku.com/ttlsh-hooks/reap"
|
||||
}
|
||||
|
||||
action "release reaper" {
|
||||
uses = "actions/heroku@master"
|
||||
needs = "push reaper"
|
||||
args = "container:release -a replreg-hooks reap"
|
||||
args = "container:release -a ttlsh-hooks reap"
|
||||
secrets = ["HEROKU_API_KEY"]
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# replreg
|
||||
# ttl.sh
|
||||
|
||||
An ephemeral container registry for CI workflows.
|
||||
|
||||
## What is replreg?
|
||||
## What is ttl.sh?
|
||||
|
||||
replreg is an anonymous, expiring Docker container registry using the official Docker Registry image. This is a set of tools and configuration that can be used to delpoy the registry without authentication, but with self-expiring images.
|
||||
ttl.sh is an anonymous, expiring Docker container registry using the official Docker Registry image. This is a set of tools and configuration that can be used to delpoy the registry without authentication, but with self-expiring images.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
{
|
||||
"name": "replreg-cloudflare-worker",
|
||||
"name": "ttlsh-cloudflare-worker",
|
||||
"version": "0.0.1",
|
||||
"description": "Cloudflare Workers for replreg.is",
|
||||
"description": "Cloudflare Workers for ttl.sh",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/replicatedhq/replreg.git"
|
||||
"url": "git+https://github.com/replicatedhq/ttl.sh.git"
|
||||
},
|
||||
"author": "",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/replicatedhq/replreg/issues"
|
||||
"url": "https://github.com/replicatedhq/ttl.sh/issues"
|
||||
},
|
||||
"homepage": "https://github.com/replicatedhq/replreg#readme",
|
||||
"homepage": "https://github.com/replicatedhq/ttl.sh#readme",
|
||||
"devDependencies": {
|
||||
"awesome-typescript-loader": "^5.2.1",
|
||||
"typescript": "^3.4.5",
|
||||
|
||||
@@ -13,7 +13,7 @@ async function proxyRequest(r: Request): Promise<Response> {
|
||||
|
||||
if (!isRegistryRequest(r)) {
|
||||
return fetch(`https://friendly-goldstine-7897fc.netlify.com/${url.pathname}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (isCatalogRequest(r)) {
|
||||
return new Response(null, {
|
||||
@@ -21,10 +21,11 @@ async function proxyRequest(r: Request): Promise<Response> {
|
||||
});
|
||||
}
|
||||
|
||||
const tagManifestParams = await tryParsePutTagRequest(r.method, url);
|
||||
if (tagManifestParams) {
|
||||
return handleTagManifestRequest(r, tagManifestParams);
|
||||
}
|
||||
// Removing this code for now. It causes Docker to exit with a 1 exit code :(
|
||||
// const tagManifestParams = await tryParsePutTagRequest(r.method, url);
|
||||
// if (tagManifestParams) {
|
||||
// return handleTagManifestRequest(r, tagManifestParams);
|
||||
// }
|
||||
|
||||
return fetch(r);
|
||||
}
|
||||
@@ -43,4 +44,4 @@ interface FetchEvent extends Event {
|
||||
request: Request;
|
||||
|
||||
respondWith(r: Promise<Response> | Response): Promise<Response>;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ export async function handleTagManifestRequest(r: Request, params: TagManifestPa
|
||||
const teapotResponse = {
|
||||
"errors": [
|
||||
{
|
||||
"message": `\r \nimage replreg.is/${imageName} is available now and will be automatically deleted ${expirationFromTag(params.tag)}\n\nreplreg is contributed by Replicated (www.replicated.com)`
|
||||
"message": `\r \nimage ttl.sh/${imageName} is available now and will be automatically deleted ${expirationFromTag(params.tag)}\n\ttl.sh is contributed by Replicated (www.replicated.com)`
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -34,13 +34,13 @@ publish: publish-hooks publish-reap
|
||||
|
||||
.PHONY: publish-hooks
|
||||
publish-hooks: test
|
||||
docker build -f Dockerfile.hooks -t registry.heroku.com/replreg-hooks/web .
|
||||
docker push registry.heroku.com/replreg-hooks/web
|
||||
heroku container:release web -a replreg-hooks
|
||||
docker build -f Dockerfile.hooks -t registry.heroku.com/ttlsh-hooks/web .
|
||||
docker push registry.heroku.com/ttlsh-hooks/web
|
||||
heroku container:release web -a ttlsh-hooks
|
||||
|
||||
.PHONY: publish-reap
|
||||
publish-reap: test
|
||||
docker build -f Dockerfile.reap -t registry.heroku.com/replreg-hooks/reap .
|
||||
docker push registry.heroku.com/replreg-hooks/reap
|
||||
heroku container:release reap -a replreg-hooks
|
||||
docker build -f Dockerfile.reap -t registry.heroku.com/ttlsh-hooks/reap .
|
||||
docker push registry.heroku.com/ttlsh-hooks/reap
|
||||
heroku container:release reap -a ttlsh-hooks
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# replreg hooks
|
||||
# ttl.sh hooks
|
||||
|
||||
This is the hooks server that also has the reaper for replreg.is.
|
||||
This is the hooks server that also has the reaper for ttl.sh.
|
||||
|
||||
The webhooks from the registry are terminated in [src/controllers/HookAPI.ts](https://github.com/replicatedhq/replreg/blob/master/hooks/src/controllers/HookAPI.ts). The reaper runs on a cron and executes [src/commands/reap.ts](https://github.com/replicatedhq/replreg/blob/master/hooks/src/commands/reap.ts).
|
||||
The webhooks from the registry are terminated in [src/controllers/HookAPI.ts](https://github.com/replicatedhq/ttl.sh/blob/master/hooks/src/controllers/HookAPI.ts). The reaper runs on a cron and executes [src/commands/reap.ts](https://github.com/replicatedhq/ttl.sh/blob/master/hooks/src/commands/reap.ts).
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "hooks",
|
||||
"version": "1.0.0",
|
||||
"description": "replreg hooks",
|
||||
"description": "ttlsh hooks",
|
||||
"license": "Apache-2.0",
|
||||
"main": "./build/server.js",
|
||||
"dependencies": {
|
||||
|
||||
@@ -55,7 +55,7 @@ async function main(argv): Promise<any> {
|
||||
// Get the manifest from the tag
|
||||
const getOptions = {
|
||||
method: "HEAD",
|
||||
uri: `https://replreg.is/v2/${imageAndTag[0]}/manifests/${imageAndTag[1]}`,
|
||||
uri: `https://ttl.sh/v2/${imageAndTag[0]}/manifests/${imageAndTag[1]}`,
|
||||
headers,
|
||||
resolveWithFullResponse: true,
|
||||
simple: false,
|
||||
@@ -68,7 +68,7 @@ async function main(argv): Promise<any> {
|
||||
continue;
|
||||
}
|
||||
|
||||
const deleteURI = `https://replreg.is/v2/${imageAndTag[0]}/manifests/${getResponse.headers.etag.replace(/"/g,"")}`;
|
||||
const deleteURI = `https://ttl.sh/v2/${imageAndTag[0]}/manifests/${getResponse.headers.etag.replace(/"/g,"")}`;
|
||||
|
||||
// Remove from the registry
|
||||
const options = {
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as process from "process";
|
||||
|
||||
function initLogger(): any {
|
||||
const logOptions = {
|
||||
name: process.env["LOG_NAME"] || "replreg",
|
||||
name: process.env["LOG_NAME"] || "ttlsh",
|
||||
safe: true,
|
||||
prettyPrint: process.env["LOG_PRETTY"] || false,
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ export const onSuccess = (res: express.Response, reqId: string, statusCodeGetter
|
||||
logger.warn(util.inspect(res));
|
||||
}
|
||||
logger.info(`[${reqId}] => ${statusToSend} ${bodyToLog}`);
|
||||
const respObj = res.status(statusToSend).type(contentType).set("X-Replreg-RequestId", reqId);
|
||||
const respObj = res.status(statusToSend).type(contentType).set("X-Ttlsh-RequestId", reqId);
|
||||
if (result.filename) {
|
||||
respObj.attachment(result.filename);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export const onSuccess = (res: express.Response, reqId: string, statusCodeGetter
|
||||
} else {
|
||||
const statusToSend = (statusCodeGetter && statusCodeGetter()) || 200;
|
||||
logger.info(`[${reqId}] => ${statusToSend}`);
|
||||
res.status(statusToSend).set("X-Replreg-RequestId", reqId).json(result);
|
||||
res.status(statusToSend).set("X-Ttlsh-RequestId", reqId).json(result);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ function handleFrameworkError(err: any, reqId: string, res: express.Response) {
|
||||
error: errMsg,
|
||||
invalid: err.invalid,
|
||||
};
|
||||
res.status(err.status).set("X-Replreg-RequestId", reqId).json(bodyToSend);
|
||||
res.status(err.status).set("X-Ttlsh-RequestId", reqId).json(bodyToSend);
|
||||
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ function handleUnexpectedError(err: any, reqId: string, res: express.Response) {
|
||||
logger.error("Middleware error, current response object is", util.inspect(res));
|
||||
}
|
||||
logger.error(`[${reqId}] !! 500 ${err.stack || err.message || util.inspect(err)}`);
|
||||
res.status(500).set("X-Replreg-RequestId", reqId).json(bodyToSend);
|
||||
res.status(500).set("X-Ttlsh-RequestId", reqId).json(bodyToSend);
|
||||
}
|
||||
|
||||
export const preRequest = (req: express.Request, reqId: string) => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# replreg registry
|
||||
# ttl.sh registry
|
||||
|
||||
This is the registry server that runs in replreg.is. It's a configured Docker registry, using the registry:2 image. There the confguration installs a hook into the registry, that will fire notifications when an image is pushed. The work to expire and delete images happens in the hook directory.
|
||||
This is the registry server that runs in ttl.sh. It's a configured Docker registry, using the registry:2 image. There the confguration installs a hook into the registry, that will fire notifications when an image is pushed. The work to expire and delete images happens in the hook directory.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user