Skip to content

Commit

Permalink
Merge pull request #608 from WatWowMap/develop
Browse files Browse the repository at this point in the history
Sync Main & Develop
  • Loading branch information
TurtIeSocks authored Nov 19, 2022
2 parents 91f699f + 0450c9d commit 7fad010
Show file tree
Hide file tree
Showing 39 changed files with 402 additions and 158 deletions.
2 changes: 1 addition & 1 deletion .configref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18036
18095
8 changes: 7 additions & 1 deletion .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ jobs:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v19
uses: tj-actions/changed-files@v32
with:
files: |
server/src/configs/default.json
- name: Setup Node.js environment
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Run script
if: steps.changed-files.outputs.any_changed == 'true'
run: |
Expand Down
68 changes: 38 additions & 30 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Docker
on: [push, release]
on: [push]

env:
REGISTRY: ghcr.io
Expand All @@ -10,18 +10,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v32
with:
files: |
server/src/configs/*.json
- name: Setup Node.js environment
uses: actions/setup-node@v2
if: steps.changed-files.outputs.any_changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 16
cache: "yarn"
cache: 'yarn'
- name: Generate latest env vars
if: steps.changed-files.outputs.any_changed == 'true'
run: |
yarn gen-env-config
- name: Commit and push changes
if: steps.changed-files.outputs.any_changed == 'true'
uses: devops-infra/action-commit-push@v0.9.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -31,33 +40,32 @@ jobs:
needs: Sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set .gitsha
if: github.event_name == 'push'
run: "echo ${{github.sha}} > .gitsha"
- name: Set .gitref
if: github.event_name == 'push'
run: "echo ${{github.ref}} > .gitref"
- uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set .gitsha
if: github.event_name == 'push'
run: 'echo ${{github.sha}} > .gitsha'
- name: Set .gitref
if: github.event_name == 'push'
run: 'echo ${{github.ref}} > .gitref'

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
with:
fetch-depth: 2
- name: Setup Node.js environment
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
Expand Down
33 changes: 29 additions & 4 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,54 @@ services:
command: sh -c "yarn start"
restart: unless-stopped
environment:
# All database values are ignored if you are using a `local.json` file!

# Your Scanner Database
SCANNER_DB_HOST: 127.0.0.1
SCANNER_DB_PORT: 3306
SCANNER_DB_USERNAME: scanner_username
SCANNER_DB_PASSWORD: scanner_user_pw
SCANNER_DB_NAME: realdevicemap
SCANNER_DB_NAME: scanner_db

# Your ReactMap Database
# optional, but recommended, if omitted it will default to your manual database
REACT_MAP_DB_HOST: 127.0.0.1
REACT_MAP_DB_PORT: 3306
REACT_MAP_DB_USERNAME: react_map_username
REACT_MAP_DB_PASSWORD: react_map_user_pw
REACT_MAP_DB_NAME: react_map_db

# Your Manual Database (Optional - Nests & Portals)
MANUAL_DB_HOST: 127.0.0.1
MANUAL_DB_PORT: 3306
MANUAL_DB_USERNAME: manual_username
MANUAL_DB_PASSWORD: manual_user_pw
MANUAL_DB_NAME: manual_db

# Other config values - the below env vars will override anything, including `local.json`
# More config values you can add:
# https://github.com/WatWowMap/ReactMap/blob/main/server/src/configs/custom-environment-variables.json
# Config wiki page:
# https://github.com/WatWowMap/ReactMap/wiki/04.-Full-Config-Explanation
# Devs recommened that you use a `local.json` config file though instead of env variables!
MAP_GENERAL_TITLE: ReactMap
MAP_GENERAL_START_LAT: 0
MAP_GENERAL_START_LON: 0
ARRAY_VALUE_EXAMPLE: "[3, 4, 5]"
# ARRAY_VALUE_EXAMPLE: "[3, 4, 5]"

volumes:
# All of these are optional - comment out whichever ones you aren't using
- ./server/src/configs/areas.json:/home/node/server/src/configs/areas.json
- ./server/src/configs/local.json:/home/node/server/src/configs/local.json
- ./server/src/configs/geofence.json/:/home/node/server/src/configs/geofence.json
- ./example.env:/home/node/.env

security_opt:
- no-new-privileges:true #https://nodramadevops.com/2019/06/running-docker-application-containers-more-securely/
# https://nodramadevops.com/2019/06/running-docker-application-containers-more-securely/
- no-new-privileges:true

ports:
- "9090:8080"
- '9090:8080'
# nginx:
# image: nginx
# container_name: nginx
Expand Down
41 changes: 41 additions & 0 deletions ecosystem.config.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module.exports = {
apps: [
{
name: 'ReactMap',
script: 'ReactMap.js',
instances: 1,
autorestart: false,
cron_restart: '*/60 */24 * * *',
exec_mode: 'fork',
max_memory_restart: '1G',
env_production: {
NODE_ENV: 'production',
},
},
// Advanced, comment out or remove the above block if you uncomment these two
// {
// name: 'RM_Client',
// script: 'yarn build && yarn generate',
// instances: 1,
// autorestart: false,
// cron_restart: '*/60 */24 * * *',
// exec_mode: 'fork',
// max_memory_restart: '1G',
// env_production: {
// NODE_ENV: 'production',
// },
// },
// {
// name: 'RM_Server',
// script: 'server/src/index.js',
// instances: 4,
// cron_restart: '*/60 */24 * * *',
// exec_mode: 'cluster',
// autorestart: true,
// max_memory_restart: '4G',
// env_production: {
// NODE_ENV: 'production',
// },
// },
],
}
11 changes: 5 additions & 6 deletions esbuild.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ const esbuildMxnCopy = require('esbuild-plugin-mxn-copy')
const aliasPlugin = require('esbuild-plugin-path-alias')
const { eslintPlugin } = require('esbuild-plugin-eslinter')

const pkg = require('./package.json')

const env = fs.existsSync(resolve(__dirname, '.env'))
? dotenv.config()
: { parsed: process.env }
const { version } = JSON.parse(
fs.readFileSync(resolve(__dirname, 'package.json')),
)
const isDevelopment = Boolean(process.argv.includes('--dev'))
const isRelease = Boolean(process.argv.includes('--release'))
const isServing = Boolean(process.argv.includes('--serve'))
Expand Down Expand Up @@ -112,7 +111,7 @@ ${customPaths.map((x, i) => ` ${i + 1}. src/${x.split('src/')[1]}`).join('\n')}
},
})
}
console.log(`[BUILD] Building production version: ${version}`)
console.log(`[BUILD] Building production version: ${pkg.version}`)
}

const esbuild = {
Expand All @@ -121,7 +120,7 @@ const esbuild = {
bundle: true,
outdir: 'dist/',
publicPath: '/',
entryNames: isDevelopment ? undefined : `[name]-${version}-[hash]`,
entryNames: isDevelopment ? undefined : `[name]-${pkg.version}-[hash]`,
metafile: true,
minify: env.parsed.NO_MINIFIED ? false : isRelease || !isDevelopment,
logLevel: isDevelopment ? 'info' : 'error',
Expand All @@ -143,7 +142,7 @@ const esbuild = {
SENTRY_DSN: env.parsed.SENTRY_DSN || '',
SENTRY_TRACES_SAMPLE_RATE: env.parsed.SENTRY_TRACES_SAMPLE_RATE || 0.1,
SENTRY_DEBUG: env.parsed.SENTRY_DEBUG || false,
VERSION: version,
VERSION: pkg.version,
DEVELOPMENT: isDevelopment,
CUSTOM: hasCustom,
LOCALES: fs.readdirSync(resolve(__dirname, 'public/locales')),
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactmap",
"version": "1.6.5",
"version": "1.6.8",
"description": "React based frontend map.",
"main": "ReactMap.js",
"author": "TurtIeSocks <58572875+TurtIeSocks@users.noreply.github.com>",
Expand All @@ -25,8 +25,8 @@
"migrate:latest": "knex --knexfile server/knexfile.cjs migrate:latest",
"migrate:rollback": "knex --knexfile server/knexfile.cjs migrate:rollback",
"release": "node server/scripts/newRelease.js",
"prettier:check": "prettier --check \"**/*.{css,html,js,jsx}\"",
"prettier:fix": "prettier --write \"**/*.{css,html,js,jsx}\"",
"prettier:check": "prettier --check \"**/*.{css,html,js,jsx,yml}\"",
"prettier:fix": "prettier --write \"**/*.{css,html,js,jsx,yml}\"",
"eslint:check": "eslint \"**/*.{js,jsx}\"",
"eslint:fix": "eslint \"**/*.{js,jsx}\" --fix"
},
Expand Down Expand Up @@ -113,7 +113,7 @@
"react-virtualized-auto-sizer": "^1.0.5",
"react-window": "^1.8.6",
"require-from-string": "^2.0.2",
"suncalc": "^1.8.0",
"suncalc": "^1.9.0",
"zustand": "^4.0.0-rc.1"
}
}
6 changes: 4 additions & 2 deletions public/base-locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -558,5 +558,7 @@
"seen_nearby_cell": "Seen in this Cell",
"seen_lure_encounter": "Lure Encounter",
"seen_lure_wild": "Lure Spawn",
"seen_wild": "Wild Spawn"
}
"seen_wild": "Wild Spawn",
"event_stops": "Event Stops",
"event_stop_timers": "Event Stop Timers"
}
8 changes: 8 additions & 0 deletions server/src/configs/custom-environment-variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@
"__name": "CLIENT_SIDE_OPTIONS_POKESTOPS_LURE_TIMERS",
"__format": "boolean"
},
"eventStopTimers": {
"__name": "CLIENT_SIDE_OPTIONS_POKESTOPS_EVENT_STOP_TIMERS",
"__format": "boolean"
},
"interactionRanges": {
"__name": "CLIENT_SIDE_OPTIONS_POKESTOPS_INTERACTION_RANGES",
"__format": "boolean"
Expand Down Expand Up @@ -760,6 +764,10 @@
"__name": "DEFAULT_FILTERS_POKESTOPS_QUESTS",
"__format": "boolean"
},
"eventStops": {
"__name": "DEFAULT_FILTERS_POKESTOPS_EVENT_STOPS",
"__format": "boolean"
},
"questSet": "DEFAULT_FILTERS_POKESTOPS_QUEST_SET",
"items": {
"__name": "DEFAULT_FILTERS_POKESTOPS_ITEMS",
Expand Down
2 changes: 2 additions & 0 deletions server/src/configs/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@
"clustering": true,
"invasionTimers": false,
"lureTimers": false,
"eventStopTimers": false,
"interactionRanges": false,
"lureRange": false,
"madQuestText": false,
Expand Down Expand Up @@ -419,6 +420,7 @@
"levels": "all",
"lures": true,
"quests": true,
"eventStops": false,
"questSet": "both",
"items": true,
"megaEnergy": true,
Expand Down
Loading

0 comments on commit 7fad010

Please sign in to comment.