Skip to content

Commit

Permalink
Dev to PROD | web-3 wallet, fixture-standings, bugs, optimization, …
Browse files Browse the repository at this point in the history
…auth (#1031)

* `hot-fix` for #974

* 🔥hot fix/prod h2h issues (#982)

* `update` README.md

* `issue` #972 #976

* `issue` #972

* `deepsource` JS-0357

* `deepsource` JS-0128

* `deepsource` JS-0051

* `deepsource` JS-0116

* `deepsource` JS-0246

* `deepsource` JS-0241

* `deepsource` JS-0241

* `deepsource` JS-0123

* `deepsource` JS-0356

* Update/fixture odds status ns 2 (#985)

* `hot-fix` for #974 (#975)

* `🔥hot-fix` to PROD (#983)

* `hot-fix` for #974

* 🔥hot fix/prod h2h issues (#982)

* `update` README.md

* `issue` #972 #976

* `issue` #972

* `deepsource` JS-0357

* `deepsource` JS-0128

* `deepsource` JS-0051

* `deepsource` JS-0116

* `deepsource` JS-0246

* `deepsource` JS-0241

* `deepsource` JS-0241

* `deepsource` JS-0123

* `deepsource` JS-0356

* issue #957

* Enhance/feature docker deploy (#1011)

* `update` logs for `PROD` server

* `update` for `Makefile`

* `update` for `.dockerignore`

* `setup` of `Docker` development env

* `update` for `package.json` with `scripts:`

* `.gitignore` update

* `update` for `Docker` in `PROD` deployment

* `update` Makefile

* `update` for `README.md`

* `update` express server for `https`

* add `new` deploy script with `Github Actions`

* `update` github actions test

* `revert` for `http` only support

* `update` for `Makefile`

* `update` for `deploy.yml`

* `revert` for `http` only support

* `add` for `https` deploy

* `update` - `Makefile`

* `update` - `my-server.js`

* issue `990`

* issue `990` - `V1`

* issue #949

* `update` packages

* `update` for `github/actions`

* issue #986

* `logs` update

* `update` for `settings.json`

* `update` issue #986

* `update` for `mobile` view `auth`

* `revert` express for `heroku`

* `revert` express for `heroku`

* `revert` express for `heroku`

* `revert` for `DEV` test `heroku`

* `revert` for `DEV` test `heroku`

* `revert` for `DEV` test `heroku`

* `add` back `AuthWidget`

* issue #1004

* issue #1004

* issue #1004 `checkout`

* `update` example widget

* issue #1004

* issue #1004 `dark-mode` hovers

* issue #1004 `🐞 debug`

* issue #1004 `🐞 debug`

* issue #1004

* issue #1004 `🐞 debug update`

* `revert` to `PROD` of `express-server`

* `deepsource` JS-0239

* `deepsource` JS-0239

* `deepsource` JS-0242

* `deepsource` JS-T1001

* Enhance/translations and wallet issues and other (#1030)

* issue #1006 #1021

* `update` .github/deploy script

* issue #1019

* `renaming`

* `aesthetic` `doc`

* `update` for `docker:dev` + `package.json` scripts

* `update` with `main`

* `update` settings.json

* issue #951

* issue #951

* issue #951

* issue #951 `redundant` code

* issue #951

* issue #1028

* issue #951 `styles` update

* `deepsource` JS-0128

* `update` documentations

* issue #1018
  • Loading branch information
migbash authored Feb 1, 2023
1 parent c881443 commit 97cea6b
Show file tree
Hide file tree
Showing 52 changed files with 2,901 additions and 602 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
# [ℹ] Update the directory with latests changes
git pull origin main
# [ℹ] Run target makefile command
make update-scores-web
make update-scores-web
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ jobs:
- name: Build the Docker image
run: |
docker build . --file Dockerfile --tag my-image-name:$(date +%s)
# run: docker build --no-cache --progress=plain --tag scores-platform:$(date +%s) .
# run: docker build --no-cache --progress=plain --tag scores-platform:$(date +%s) .
9 changes: 5 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
// https://stackoverflow.com/questions/64365300/how-can-i-remove-unused-imports-declarations-from-the-entire-project-of-react-ty
// https://stackoverflow.com/questions/46722701/is-there-a-way-to-remove-unused-imports-and-declarations-from-angular-2
// DOC: https://stackoverflow.com/questions/64365300/how-can-i-remove-unused-imports-declarations-from-the-entire-project-of-react-ty
// DOC: https://stackoverflow.com/questions/46722701/is-there-a-way-to-remove-unused-imports-and-declarations-from-angular-2
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.organizeImports": true,
"source.sortMembers": true
"source.organizeImports": true,
"source.sortMembers": true
},
// NOTE: custom highlighter for data
"todohighlight.keywords": [
{
"text": "NOTE:",
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ COPY . .

EXPOSE 5055
# CMD ["node", "./build"]
CMD ["npm", "start"]
CMD ["npm", "run", "start:docker"]
2 changes: 1 addition & 1 deletion Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ EXPOSE 5055
EXPOSE 24678

# CMD ["node", "./build"]
CMD ["npm", "run", "dev-docker"]
CMD ["npm", "run", "dev:docker"]
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ log-listen:
update-scores-web:
echo 'Updating PROD Scores Web container...'
git pull origin main
-docker rm $$(docker stop $$(docker ps -a -q --filter="name=scores_scores_web_1" --format="{{.ID}}"))
-docker rmi $$(docker images -q scores_web)
-docker rmi $$(docker images --filter "dangling=true" -q --no-trunc)
docker-compose -f docker-compose.yml up -d
# -docker rm $$(docker stop $$(docker ps -a -q --filter="name=scores_scores_web_1" --format="{{.ID}}"))
# -docker rmi $$(docker images -q scores_web)
# -docker rmi $$(docker images --filter "dangling=true" -q --no-trunc)
# docker-compose -f docker-compose.yml up -d
docker-compose -f docker-compose.yml up -d --build

# ===========
# DEVELOPMENT
Expand Down Expand Up @@ -45,4 +46,4 @@ dev-clean:
# git checkout main
# git pull origin main
# git checkout dev
# git reset --hard main
# git reset --hard main
4 changes: 2 additions & 2 deletions PULL_REQUEST_TEMPLATE/DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
> by simply checking the appropiate checkbox
- [ ] `localhost`
- [ ] `heroku deployment`
- [ ] `heroku` | `DEV`

> 🔽 (Optional)
**Test Configuration**:
Expand All @@ -34,7 +34,7 @@
* Toolchain:
* SDK:

# Checklist:
# Self-checklist:

- [ ] `This code` follows the style guidelines of this project
- [ ] `This code` is self-reviewed
Expand Down
29 changes: 14 additions & 15 deletions PULL_REQUEST_TEMPLATE/MAIN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

**PRs**

- <Bulleted list of `Pull Requests` Part of this merge to `main`>
- _Like:_ `#3452`
> Bulleted list of `Pull Requests` Part of this merge to `main`
> - `#3452` - `example`
---

**Detailed**

- Grouped by `Pull Request`, with each section containing the issues
relevant to set `Pull Request` like (below)
> Grouped by `Pull Request`, with each section containing the issues relevant to set `Pull Request` - `example`
**PR** `#73023`
- closes `#56`
- closes `#695`
> **PR** `#73023`
> - closes `#56`
> - closes `#695`
## ℹ Type of change

<- Please delete options that are not relevant. ->
> Please delete options that are not relevant.
- [ ] 🛠 Bug fix (non-breaking change which fixes an issue)
- [ ] 🚀 New feature (non-breaking change which adds functionality)
Expand All @@ -27,21 +27,20 @@ relevant to set `Pull Request` like (below)

# 🧰 How Has This Been Tested?

<- Please describe the tests that you ran to verify your changes. ->
<- Provide instructions so we can reproduce. ->
<- Please also list any relevant details for your test configuration ->
> Please describe the tests that you ran to verify your changes.
> by simply checking the appropiate checkbox
- [ ] `local-testing`
- [ ] `heroku-local-environment-tested`
- [ ] `localhost`
- [ ] `heroku` | `DEV`

🔽 (Optional) __remove if non-applicable__
> 🔽 (Optional)
**Test Configuration**:
* Firmware version:
* Hardware:
* Toolchain:
* SDK:

# Checklist:
# Self-checklist:

- [ ] `This code` follows the style guidelines of this project
- [ ] `This code` is self-reviewed
Expand Down
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: npm run start:heroku
File renamed without changes.
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
"node": "16.17.0"
},
"scripts": {
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. .",
"debug": "cross-env NODE_OPTIONS='--inspect' vite dev --host --port 3050",
"debug-preview": "cross-env NODE_OPTIONS='--inspect' vite preview --host --port 5000",
"debug-bull": "cross-env NODE_DEBUG='bull' vite preview --host --port 5000",
"debug:bull": "cross-env NODE_DEBUG='bull' vite preview --host --port 5000",
"debug:preview": "cross-env NODE_OPTIONS='--inspect' vite preview --host --port 5000",
"dev": "vite dev --host --port 3050",
"dev-docker": "vite dev --host --port 5055",
"docker-dev-up": "docker-compose -f docker-compose.dev.yml up",
"build": "vite build",
"dev:docker": "vite dev --host --port 5055",
"dev:docker:up": "docker-compose -f docker-compose.dev.yml up",
"staging": "npm run dev -- --mode staging",
"start": "node my-server.js",
"build": "vite build",
"preview": "vite preview --host --port 5000",
"check": "svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. ."
"start:docker": "node server-docker.js",
"start:heroku": "node server-heroku.js"
},
"devDependencies": {
"@sveltejs/adapter-node": "1.0.0-next.88",
Expand Down
34 changes: 7 additions & 27 deletions my-server.js → server-docker.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// [ℹ] https://github.com/sveltejs/kit/tree/master/packages/adapter-node#custom-server
// [ℹ] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
// DOC: https://github.com/sveltejs/kit/tree/master/packages/adapter-node#custom-server
// DOC: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
import express from 'express';
import http from 'http';
import https from 'https';

import { handler } from './build/handler.js';
// import sslRedirect from 'heroku-ssl-redirect';
import compression from 'compression'; // https://expressjs.com/en/resources/middleware/compression.html
// DOC: https://expressjs.com/en/resources/middleware/compression.html
import compression from 'compression';
import * as sslify from 'express-sslify';
import * as requestIp from 'request-ip'; // https://www.npmjs.com/package/request-ip
// DOC: https://www.npmjs.com/package/request-ip

import fs from 'fs';

Expand All @@ -20,24 +20,11 @@ const options = {

const app = express();

/**
* [ℹ] add a route that lives separately from the SvelteKit app
*/
// app.get('/healthcheck', (req, res) => {
// res.end('ok');
// });

/**
* [ℹ] enable ssl redirect
* [ℹ] https://www.npmjs.com/package/heroku-ssl-redirect
* => does not seem to be working
*/
// app.use(sslRedirect());

/**
* [ℹ] separate from SvelteKit endpoint in attempts to
* [ℹ] identify clients (IP - address)
*/
/**
app.get('/getClientIP', (req, res) => {
const ip = req.headers['x-forwarded-for'] ||
Expand Down Expand Up @@ -69,6 +56,7 @@ app.get('/getClientIP', (req, res) => {
res.end()
})
*/

/**
* [ℹ] [FORCE] https-redirect
Expand Down Expand Up @@ -97,14 +85,6 @@ app.use(compression())
*/
app.use(handler);

/**
* [ℹ] initialize app;
* [ℹ] https://stackoverflow.com/questions/15693192/heroku-node-js-error-web-process-failed-to-bind-to-port-within-60-seconds-o
*/
// app.listen(process.env.PORT, () => {
// console.log(`listening on port ${process.env.PORT}`);
// });

// ~~~~~~~~~~~~~~~~~~~~~~
// APP SPIN-UP [PROD] [V2]
// ~~~~~~~~~~~~~~~~~~~~~~
Expand Down
93 changes: 93 additions & 0 deletions server-heroku.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// DOC: https://github.com/sveltejs/kit/tree/master/packages/adapter-node#custom-server
// DOC: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import

import express from 'express';
import { handler } from './build/handler.js';
// import sslRedirect from 'heroku-ssl-redirect';
// DOC: https://expressjs.com/en/resources/middleware/compression.html
import compression from 'compression';
import * as sslify from 'express-sslify';
// DOC: https://www.npmjs.com/package/request-ip

const app = express();

/**
* [ℹ] enable ssl redirect
* DOC: https://www.npmjs.com/package/heroku-ssl-redirect
* => does not seem to be working
*/
// app.use(sslRedirect());

/**
* [ℹ] separate from SvelteKit endpoint in attempts to
* [ℹ] identify clients (IP - address)
*/
/**
app.get('/getClientIP', (req, res, next) => {
const ip = req.headers['x-forwarded-for'] ||
req.socket.remoteAddress ||
null;
console.log('ip', ip);
const ip2 = req.ip
console.log('ip2', ip2);
const ip3 = requestIp.getClientIp(req);
console.log('ip3', ip3);
let ipAddr = req.headers["x-forwarded-for"];
if (ipAddr){
const list = ipAddr.split(",");
ipAddr = list[list.length-1];
} else {
ipAddr = req.connection.remoteAddress;
}
console.log('ipAddr', ipAddr);
res.json(
{
"ip": ip.toString().replace(/,/g, '')
}
);
res.end()
})
*/

/**
* [ℹ] [FORCE] https-redirect
* DOC: https://jaketrent.com/post/https-redirect-node-heroku
* DOC: https://webdva.github.io/how-to-force-express-https-tutorial
* [HEROKU]
*/
app.use((req, res, next) => {
if (req.header('x-forwarded-proto') !== 'https')
res.redirect(`https://${req.header('host')}${req.url}`);
else
next();
});

/**
* DOC: https://www.npmjs.com/package/express-sslify
* DOC: https://stackoverflow.com/questions/51234023/heroku-nodejs-redirect-http-to-http
*/
app.use(sslify.HTTPS({ trustProtoHeader: true }))

// [ℹ] compress all responses
app.use(compression())

/**
* [ℹ] let SvelteKit handle everything else,
* [ℹ] including serving prerendered pages and static assets
*/
app.use(handler);

/**
* [ℹ] initialize app;
* DOC: https://stackoverflow.com/questions/15693192/heroku-node-js-error-web-process-failed-to-bind-to-port-within-60-seconds-o
*/
app.listen(process.env.PORT || 5000, () => {
console.log('listening on port 5000');
});
Loading

0 comments on commit 97cea6b

Please sign in to comment.