Jenkins scripts

Summary: jenkins scripts

Test Plan: tbd

Reviewers: #reviewers

Subscribers: jenkins-user

Differential Revision: https://hub.sealcode.org/D1081
master
Kuba Orlik 4 years ago
parent 3342cc8ce5
commit dd8e14ab0c

@ -20,7 +20,6 @@ module.exports = {
/* "jsdoc/require-description": 2, */ /* "jsdoc/require-description": 2, */
"no-await-in-loop": 2, "no-await-in-loop": 2,
"with-tsc-error/all": ["warn", {}], "with-tsc-error/all": ["warn", {}],
"@typescript-eslint/restrict-template-expressions": 0,
}, },
settings: { jsdoc: { mode: "typescript" } }, settings: { jsdoc: { mode: "typescript" } },
overrides: [ overrides: [

1
.gitignore vendored

@ -23,3 +23,4 @@ coverage
.nyc_output .nyc_output
/dist/ /dist/
public/dist public/dist
/log.html

@ -1,4 +1,4 @@
# Sealious playground - hotwire version # Sealious playground
A simple todo app written in Sealious with a Hotwire-enhanced, server-side A simple todo app written in Sealious with a Hotwire-enhanced, server-side
rendered front-end. rendered front-end.

@ -11,8 +11,6 @@ services:
dockerfile: test.Dockerfile dockerfile: test.Dockerfile
volumes: volumes:
- ./:/opt/sealious/ - ./:/opt/sealious/
ports:
- "127.0.0.1:${SEALIOUS_PORT:-8080}:${SEALIOUS_PORT:-8080}"
user: ${UID:-1000}:${GID:-1000} user: ${UID:-1000}:${GID:-1000}
mailcatcher: mailcatcher:
image: schickling/mailcatcher:latest image: schickling/mailcatcher:latest

@ -0,0 +1,18 @@
#!/bin/bash
set -e
docker-compose down
cp secrets.example.json secrets.json
export SEALIOUS_PORT=$PORT
SEALIOUS_BASE_URL=$(cat .base_url)
export SEALIOUS_BASE_URL
docker-compose up -d db
./npm.sh ci
./npm.sh run build:back;
rm -f log.html

@ -0,0 +1,14 @@
#!/bin/bash
export SEALIOUS_PORT=$PORT
SEALIOUS_BASE_URL=$(cat .base_url)
export SEALIOUS_BASE_URL
docker-compose run --user="$UID"\
-e "SEALIOUS_MONGO_PORT=27017" \
-e "SEALIOUS_MONGO_HOST=db" \
-e "SEALIOUS_PORT=$SEALIOUS_PORT" \
-e "SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL" \
-e "SEALIOUS_SANITY=true" \
test

@ -1,36 +1,22 @@
#!/bin/bash #!/bin/bash
docker-compose down export SEALIOUS_PORT=$PORT
SEALIOUS_BASE_URL=$(cat .base_url)
export SEALIOUS_BASE_URL
set -e
export SEALIOUS_PORT=$1
export SEALIOUS_BASE_URL=$2
docker-compose down
docker-compose up -d db
./npm.sh ci
./npm.sh run build:back;
./npm.sh run build:front; ./npm.sh run build:front;
rm -f log.txt docker-compose run --user="$UID"\
CONTAINER=$(docker-compose run --user="$UID"\
-e "SEALIOUS_MONGO_PORT=27017" \ -e "SEALIOUS_MONGO_PORT=27017" \
-e "SEALIOUS_MONGO_HOST=db" \ -e "SEALIOUS_MONGO_HOST=db" \
-e "SEALIOUS_PORT=$SEALIOUS_PORT" \ -e "SEALIOUS_PORT=$SEALIOUS_PORT" \
-e "SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL" \ -e "SEALIOUS_BASE_URL=$SEALIOUS_BASE_URL" \
-p ${SEALIOUS_PORT}:${SEALIOUS_PORT} \ -p "${SEALIOUS_PORT}:${SEALIOUS_PORT}" \
-d \ -d \
test \ test \
/bin/sh -c "{ node . --color 2>&1; } | ./node_modules/.bin/ansi-html-stream > log.html") /bin/sh -c "{ node . --color 2>&1; } | ./node_modules/.bin/ansi-html-stream > log.html" \
&& echo "App started on $SEALIOUS_PORT"
echo "App started on $SEALIOUS_PORT"
echo "App running in container $CONTAINER"
sleep 1
echo "Docker logs so far:"
docker logs "$CONTAINER" echo "Deployed to https://${PORT}.dep.sealco.de"
echo "Application logs should be available at https://jenkins.sealcode.org/job/Deploy%20to%20dep.sealco.de/ws/$PORT/log.html"

@ -0,0 +1,7 @@
#!/bin/bash
export SEALIOUS_PORT=$PORT
SEALIOUS_BASE_URL=$(cat .base_url)
export SEALIOUS_BASE_URL
docker-compose down

5519
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -26,7 +26,7 @@ export default class TheApp extends App {
from_name: "Sealious playground app", from_name: "Sealious playground app",
}, },
logger: { logger: {
level: <const>"debug", level: <const>"info",
}, },
"www-server": { "www-server": {
port: PORT, port: PORT,

@ -1,6 +1,6 @@
import { Collection, FieldTypes, Policies } from "sealious"; import { Collection, FieldTypes, Policies } from "sealious";
const tasks = new (class extends Collection { export class Tasks extends Collection {
fields = { fields = {
title: new FieldTypes.Text(), title: new FieldTypes.Text(),
done: new (class extends FieldTypes.Boolean { done: new (class extends FieldTypes.Boolean {
@ -11,6 +11,6 @@ const tasks = new (class extends Collection {
})(), })(),
}; };
defaultPolicy = new Policies.Public(); defaultPolicy = new Policies.Public();
})(); }
export default tasks; export default new Tasks();

@ -15,7 +15,22 @@ declare module "koa" {
} }
const app = new TheApp(); const app = new TheApp();
void app.start(); void app
.start()
.then(() => {
//populate scripts go here
if (process.env.SEALIOUS_SANITY === "true") {
console.log("Exiting with error code 0");
process.exit(0);
}
})
.catch((error) => {
console.error(error);
if (process.env.SEALIOUS_SANITY === "true") {
console.log("EXITING WITH STATUS 1");
process.exit(1);
}
});
const router = app.HTTPServer.router; const router = app.HTTPServer.router;
router.use("/", homepage.routes()); router.use("/", homepage.routes());

@ -13,7 +13,6 @@ export function Task(task: CollectionItem<any>) {
${task.get("done") ? "checked" : ""} ${task.get("done") ? "checked" : ""}
/> />
${task.get("title")} ${task.get("title")}
<form <form
method="DELETE" method="DELETE"
action="/tasks/${task.id}" action="/tasks/${task.id}"

Loading…
Cancel
Save