Browse Source

Pipeline?

master
Stian Fredrik Aune 4 years ago
parent
commit
8904ea0cde
  1. 1
      .dockerignore
  2. 36
      .drone.yml
  3. 10
      Dockerfile
  4. 2
      package-lock.json
  5. 2
      src/api/bike.js
  6. 2
      src/server.js
  7. 2
      src/systems/workout.js

1
.dockerignore

@ -0,0 +1 @@
node_modules/

36
.drone.yml

@ -0,0 +1,36 @@
name: ykonsole-server
kind: pipeline
type: docker
trigger:
branch:
- master
steps:
- name: package
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.vmaple.dev/ykonsole/server
registry: r.vmaple.dev
tags:
- $DRONE_BUILD_NUMBER
- name: deploy
image: ubuntu:20.04
environment:
SSH_PRIVATE_KEY:
from_secret: ssh_private_key
SSH_USERNAME:
from_secret: ssh_username
SSH_TARGET:
from_secret: ssh_target
commands:
- apt-get update
- apt-get -y install openssh-client
- echo $SSH_PRIVATE_KEY | ssh-add -
- ssh $SSH_USERNAME@$SSH_TARGET ./deploy-ykonsole.sh $DRONE_BUILD_NUMBER

10
Dockerfile

@ -0,0 +1,10 @@
FROM node:8.17
COPY . /app
WORKDIR /app
RUN npm install
VOLUME ["/var/sqlite"]
CMD node /app/src/server.js

2
package-lock.json

@ -431,6 +431,7 @@
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"optional": true,
"requires": {
"once": "^1.4.0"
}
@ -1131,6 +1132,7 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"optional": true,
"requires": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"

2
src/api/bike.js

@ -1,7 +1,7 @@
const express = require("express");
/**
* @param {import("../repositories/sqlite3")} repo
* @param {import("../repositories/sqlite3")|SQLite3Repository} repo
*/
module.exports = function bikeRouter(repo) {
const router = express.Router({caseSensitive: false});

2
src/server.js

@ -4,7 +4,7 @@ const cors = require('cors');
const SQLite3Repository = require("./repositories/sqlite3");
const repo = new SQLite3Repository("stuff.db");
const repo = new SQLite3Repository("/var/sqlite/stuff.db");
repo.setup().catch(err => {
console.error("Failed to setup db:", err);

2
src/systems/workout.js

@ -133,7 +133,7 @@ class Workout {
} else if (this.program.warmupMin > ws.minutes) {
targetLevel = this.program.warmupLevel;
}
if (targetLevel !== ws.level) {
if (targetLevel !== ws.level && status === "started") {
this.driver.setLevel(targetLevel);
}

Loading…
Cancel
Save