Skip to content

Commit

Permalink
fix(runner): resources & config
Browse files Browse the repository at this point in the history
  • Loading branch information
Slordef committed Apr 2, 2024
1 parent d59ebaa commit 7f045c4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Example configurations are available in the `config` directory:
Notice that the `repositories.json` file should contain an array of objects and `user.json` should contain a single object.
2. **Start GRMI**: Run the following command to start the GRMI service:
```bash
docker run --privileged -d -p 9997:9997 -v ./config:/app/config --name grmi slordefweb/grmi:latest
docker run --privileged -d -p 9997:9997 -v .\config:/app/config --name grmi slordefweb/grmi:latest
```
3. **Webhook Configuration**: Set up a webhook in your GitHub repository to point to the GRMI instance.
The webhook should be triggered on the `repository` event.
Expand Down
1 change: 1 addition & 0 deletions app-docker/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COPY ./build ./build
COPY ./docker ./docker

RUN npm install --omit=dev --ignore-scripts
RUN npm rebuild bcrypt

ENTRYPOINT ["./process.sh"]
CMD ["npm", "start"]
10 changes: 6 additions & 4 deletions src/infra/api/express/express-api-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import { AppRoute } from '../../../domain/route/app-route';

export class ExpressApiServer implements ApiServer {
private app: Express;
private port: string;
private port: number;
private host: string;

constructor() {
this.app = express();
this.port = env.PORT;
this.port = parseInt(env.PORT);
this.host = env.HOST;

this.app.use(express.json());
}
Expand All @@ -23,8 +25,8 @@ export class ExpressApiServer implements ApiServer {
res.send('App is running');
});

this.app.listen(this.port, () => {
log(`Server is running on port ${this.port}`);
this.app.listen(this.port, this.host, () => {
log(`Server is running on ${this.host}:${this.port}`);
});

return Promise.resolve(undefined);
Expand Down
4 changes: 2 additions & 2 deletions src/main/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import dotenv from 'dotenv';
dotenv.config({ path: '.env' });

export const env = {
HOST: process.env.HOST || 'localhost',
PORT: process.env.PORT || '3000',
HOST: process.env.HOST || '0.0.0.0',
PORT: process.env.PORT || '9997',
NODE_ENV: process.env.NODE_ENV || 'development',
JEST_WORKER_ID: process.env.JEST_WORKER_ID || undefined,
JWT_SECRET: process.env.JWT_SECRET || 'secret'
Expand Down
18 changes: 8 additions & 10 deletions src/main/runner/runner-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@ export class RunnerContainer {
[
'run',
'-d',
'--name',
this.name,
`--name ${this.name}`,
'--privileged',
'-e',
`GITHUB_REPOSITORY_URL=${this.url}`,
'-e',
`GITHUB_RUNNER_TOKEN=${this.token}`,
'-e',
`GITHUB_RUNNER_NAME=${this.name}`,
'-e',
`GITHUB_RUNNER_LABELS=${this.labels.join(',')}`,
'-m 4g',
'--cpus 4',
`-e GITHUB_REPOSITORY_URL=${this.url}`,
`-e GITHUB_RUNNER_TOKEN=${this.token}`,
`-e GITHUB_RUNNER_NAME=${this.name}`,
`-e GITHUB_RUNNER_LABELS=${this.labels.join(',')}`,
'-e DOCKER_BUILDKIT=1',
'runner'
],
{ shell: true }
Expand Down

0 comments on commit 7f045c4

Please sign in to comment.