Skip to content

Commit

Permalink
add deploy staging workflow and docker test files
Browse files Browse the repository at this point in the history
  • Loading branch information
glencoden committed Dec 5, 2022
1 parent bcfa365 commit 37c280f
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
branches:
- staging

jobs:
deploy-staging:
runs-on: ubuntu-latest
steps:
- name: copy ssh key
run: |
mkdir -p ~/.ssh
echo -e "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- name: pull wolke repository
run: |
ssh root@${{ secrets.SERVER_ADDRESS }} <<"ENDSSH"
mkdir -p /root/apps/wolke
cd /root/apps/wolke
git pull || git clone git@gitlab.com:GlenCoden/wolke.git ./
- name: run docker
run: |
docker-compose down --rmi local
docker image prune -f
docker-compose up -d --build
ENDSSH
8 changes: 8 additions & 0 deletions contexts/tsc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:16

WORKDIR /usr/src/app

RUN npm install pm2 -g

EXPOSE 3000
CMD [ "pm2", "serve", ".", "3000", "--no-daemon" ]
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.6"

services:
tsc-app:
build:
context: contexts/tsc
volumes:
- ./test:/usr/src/app
environment:
NODE_ENV: production
ports:
- "80:3000"
container_name: tsc
108 changes: 108 additions & 0 deletions test/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>wolke</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>☁️</text></svg>">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=DotGothic16&display=swap" rel="stylesheet">
<style>
body {
position: relative;
height: 100vh;
}
#magic-line {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 330px;
height: 330px;
font-family: 'DotGothic16', sans-serif;
font-size: 36px;
outline: none;
border: none;
resize: none;
}
#overlay {
z-index: 100;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 100vw;
height: 100vh;
}
</style>
</head>
<body>
<textarea id="magic-line" type="text"></textarea>
<div id="overlay"></div>

<script>
const storedInput = [
{ key: 'H', time: 124 },
{ key: 'i', time: 1496 },
{ key: '\n', time: 247 },
{ key: 'm', time: 102 },
{ key: 'y', time: 90 },
{ key: ' ', time: 225 },
{ key: 'n', time: 123 },
{ key: 'a', time: 102 },
{ key: 'm', time: 101 },
{ key: 'e', time: 67 },
{ key: ' ', time: 124 },
{ key: 'i', time: 124 },
{ key: 's', time: 90 },
{ key: ' ', time: 270 },
{ key: 'C', time: 135 },
{ key: 'o', time: 169 },
{ key: 'd', time: 123 },
{ key: 'e', time: 135 },
{ key: 'n', time: 158 },
{ key: '.', time: 1575 },
{ key: '\n', time: 180 },
{ key: '\n', time: 619 },
{ key: 'G', time: 101 },
{ key: 'l', time: 135 },
{ key: 'e', time: 236 },
{ key: 'n', time: 113 },
{ key: ' ', time: 281 },
{ key: 'C', time: 112 },
{ key: 'o', time: 214 },
{ key: 'd', time: 180 },
{ key: 'e', time: 124 },
{ key: 'n', time: 146 },
{ key: '.', time: 30000 },
];

const overlay = document.getElementById('overlay');
const magicLine = document.getElementById('magic-line');

function preventDefault(event) {
event.preventDefault();
}

overlay.addEventListener('click', preventDefault);
overlay.addEventListener('pointerdown', preventDefault);
overlay.addEventListener('touchstart', preventDefault);

magicLine.focus();

let index = 0;

function printLetter() {
if (index === storedInput.length) {
index = 0;
magicLine.value = '';
}
const stored = storedInput[index];
magicLine.value += stored.key;
setTimeout(printLetter, Math.round(stored.time / 1.5));
index++;
}

setTimeout(printLetter, 1500);
</script>
</body>
</html>

0 comments on commit 37c280f

Please sign in to comment.