Skip to content

Commit

Permalink
Add node env overrides, basic GitHub Actions, start of docker build (#12
Browse files Browse the repository at this point in the history
)
  • Loading branch information
leet4tari authored Aug 30, 2023
1 parent d0fca8a commit 121a862
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.dockerignore
Dockerfile

node_modules
npm-debug.log
.npmrc

.git
.gitignore
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Create a report to help us improve
title: "[TITLE]"
labels: 'bug-report'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS & Version: [e.g. iOS 10.2.1]
- Browser & Version [e.g. chrome v71.0.12345]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser & Version [e.g. stock browser v0.1.2]

**Additional context**
Add any other context about the problem here.
27 changes: 27 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Description
---

Motivation and Context
---

How Has This Been Tested?
---

What process can a PR reviewer use to test or verify this change?
---

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a database, resync the chain -->
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
30 changes: 30 additions & 0 deletions .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
# Checks that PR titles conform to Conventional Commits
# See https://www.conventionalcommits.org/en/v1.0.0/ for more information
name: PR

'on':
pull_request:
types:
- opened
- reopened
- edited
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check-title:
runs-on: ubuntu-latest
steps:
- name: install
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
- name: lint
run: |
echo "$PR_TITLE" | commitlint
env:
PR_TITLE: ${{github.event.pull_request.title}}
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:16.17.0-bullseye-slim

RUN apt-get update && \
apt-get install -y --no-install-recommends dumb-init

ENV NODE_ENV production
WORKDIR /usr/src/app
COPY --chown=node:node . .
#RUN npm ci --only=production --omit=dev libs/base_node_grpc_client
#RUN npm ci --only=production --omit=dev
RUN npm install ./libs/base_node_grpc_client/
RUN npm install
RUN npm install debug

EXPOSE 4000

USER node
#CMD ["dumb-init", "node", "app.js"]
#CMD ["npm", "start"]
CMD ["dumb-init", "node", "./bin/www"]
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Tari explorer

## No client-side JavaScript block explorer
## No client-side JavaScript block explorer (tari-text-explorer)

### Dependencies

- `npm i`
- `npm install`

### Development (nodemon reload)

Expand All @@ -13,3 +13,8 @@
### Start server

- `npm start`

## Useful environment variables

- PORT:4000 'Port of service'
- BASE_NODE_GRPC_URL:localhost:18142 'Base node GRPC URL'
2 changes: 1 addition & 1 deletion baseNodeClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
var { Client } = require("base-node-grpc-client");

function createClient() {
return Client.connect("localhost:18142");
return Client.connect( process.env.BASE_NODE_GRPC_URL || "localhost:18142");
}

module.exports = {
Expand Down

0 comments on commit 121a862

Please sign in to comment.