Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marcocastignoli committed Aug 1, 2024
0 parents commit acb9a11
Show file tree
Hide file tree
Showing 14 changed files with 1,171 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
.git/
dist/
.env
7 changes: 7 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
POSTGRES_HOST=
POSTGRES_DATABASE=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_PORT=
REPOV1_PATH=
REPOV2_PATH=
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
.env
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog for `stats-gen`

All notable changes to this project will be documented in this file.

## sourcify-stats@1.0.0 - 2024-08-01

No changes this release. This marks the start of the changelog for this service
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM node:22-alpine
WORKDIR /app
COPY * ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# stats-gen

Service to generate sourcify chain stats

## Env variables

- **POSTGRES_HOST:** Database host
- **POSTGRES_DATABASE:** Database name
- **POSTGRES_USER:** Database user
- **POSTGRES_PASSWORD:** Database password
- **POSTGRES_PORT:** Database port
- **REPOV1_PATH:** Path to repositoryV1
- **REPOV2_PATH:** Path to repositoryV2

## Running locally

1. Copy .env.template to .env and fill values

2. Install dependencies

```
npm install
```

3. Build

```
npm run build
```

4. Run

```
npm start
```

## Running locally with Docker

1. Build image

```
docker build -t statsgen .
```

2. Run container

```
docker run -v /path/to/sourcify/repositories:/repositories -e POSTGRES_HOST=host.docker.internal -e POSTGRES_DATABASE=sourcify-staging -e POSTGRES_USER=xxxxx -e POSTGRES_PASSWORD=xxxxx -e POSTGRES_PORT=5432 -e REPOV1_PATH=/repositories/repoV1 -e REPOV2_PATH=/repositories/repoV2 statsgen
```
Loading

0 comments on commit acb9a11

Please sign in to comment.