Skip to content

Commit

Permalink
Add additional debugging messages
Browse files Browse the repository at this point in the history
  • Loading branch information
trappar committed Feb 15, 2024
1 parent 08f9d58 commit 7f7b650
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/server.cjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
const { debug } = require('@actions/core');
const { createApp } = require('turborepo-remote-cache');

debug('Creating Turbo Cache Server...');
const app = createApp({trustProxy: true});

debug(`Starting listening for requests on ${process.env.HOST}:${process.env.PORT}...`);
app.listen({ host: process.env.HOST, port: process.env.PORT }, (err) => {
if (err) {
console.error(err);
process.exit(1);
}
});

debug('Turbo Cache Server started successfully!');
2 changes: 1 addition & 1 deletion src/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ async function main() {
[resolve(__dirname, '..', 'start_and_log')],
{
detached: true,
stdio: 'ignore',
stdio: 'pipe',
env: {
...process.env,
HOST: host,
Expand Down
3 changes: 2 additions & 1 deletion src/start_and_log.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { debug } from '@actions/core';
import { spawn } from 'node:child_process';
import { createWriteStream } from 'node:fs';
import { dirname, resolve } from 'node:path';
Expand All @@ -6,7 +7,7 @@ import { logFile } from './logs.js';

const __dirname = dirname(fileURLToPath(import.meta.url));

debug('Starting Server Process...');
const subprocess = spawn('node', [resolve(__dirname, '..', 'server', 'index.cjs')]);

subprocess.stdout.pipe(createWriteStream(logFile('out')));
subprocess.stderr.pipe(createWriteStream(logFile('err')));

0 comments on commit 7f7b650

Please sign in to comment.