CI: add extra config file for easier per-deployment veriations, add hetzner deploy script
This commit is contained in:
parent
9d149cae30
commit
fe3ccd1074
5 changed files with 40 additions and 12 deletions
3
config.json
Normal file
3
config.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"#": "Settings in this file override the `config`-section of `package.json`"
|
||||||
|
}
|
|
@ -8,7 +8,8 @@
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"config": {
|
"config": {
|
||||||
"#": "Various endpoints that are instance-specific",
|
"#": "Various endpoints that are instance-specific. This is the default configuration, which is re-exported in 'Constants.ts'.",
|
||||||
|
"#": "Use MAPCOMPLETE_CONFIGURATION to use an additional configuration, e.g. `MAPCOMPLETE_CONFIGURATION=config_hetzner`",
|
||||||
"#oauth_credentials:comment": [
|
"#oauth_credentials:comment": [
|
||||||
"`oauth_credentials` are the OAuth-2 credentials for the production-OSM server and the test-server.",
|
"`oauth_credentials` are the OAuth-2 credentials for the production-OSM server and the test-server.",
|
||||||
"Are you deploying your own instance? Register your application too.",
|
"Are you deploying your own instance? Register your application too.",
|
||||||
|
|
4
scripts/hetzner/config.json
Normal file
4
scripts/hetzner/config.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"#":"Some configuration tweaks specifically for hetzner",
|
||||||
|
"country_coder_host": "https://countrycoder.mapcomplete.org/"
|
||||||
|
}
|
20
scripts/hetzner/deployHetzner.sh
Executable file
20
scripts/hetzner/deployHetzner.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#! /bin/bash
|
||||||
|
### To be run from the root of the repository
|
||||||
|
|
||||||
|
# Some pointers to get started:
|
||||||
|
# apt install npm
|
||||||
|
# apt install unzip
|
||||||
|
# npm i -g csp-logger
|
||||||
|
|
||||||
|
# wget https://github.com/pietervdvn/latlon2country/raw/main/tiles.zip
|
||||||
|
# unzip tiles.zip
|
||||||
|
|
||||||
|
MAPCOMPLETE_CONFIGURATION="config_hetzner"
|
||||||
|
cp config.json config.json.bu &&
|
||||||
|
cp ./scripts/hetzner/config.json . &&
|
||||||
|
npm run prepare-deploy &&
|
||||||
|
mv config.json.bu config.json &&
|
||||||
|
zip dist.zip -r dist/* &&
|
||||||
|
scp -r dist.zip hetzner:/root/ &&
|
||||||
|
scp ./scripts/hetzner/config/* hetzner:/root/
|
||||||
|
ssh hetzner -t "unzip dist.zip && rm dist.zip && rm -rf public/ mv dist public && caddy stop && caddy start"
|
|
@ -1,14 +1,11 @@
|
||||||
import * as meta from "../../package.json"
|
import * as packagefile from "../../package.json"
|
||||||
|
import * as extraconfig from "../../config.json"
|
||||||
import { Utils } from "../Utils"
|
import { Utils } from "../Utils"
|
||||||
|
|
||||||
export type PriviligedLayerType = (typeof Constants.priviliged_layers)[number]
|
export type PriviligedLayerType = (typeof Constants.priviliged_layers)[number]
|
||||||
|
|
||||||
export default class Constants {
|
export default class Constants {
|
||||||
public static vNumber = meta.version
|
public static vNumber = packagefile.version
|
||||||
|
|
||||||
public static ImgurApiKey = meta.config.api_keys.imgur
|
|
||||||
public static readonly mapillary_client_token_v4 = meta.config.api_keys.mapillary_v4
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API key for Maproulette
|
* API key for Maproulette
|
||||||
*
|
*
|
||||||
|
@ -17,9 +14,6 @@ export default class Constants {
|
||||||
* Using an empty string however does work for most actions, but will attribute all actions to the Superuser.
|
* Using an empty string however does work for most actions, but will attribute all actions to the Superuser.
|
||||||
*/
|
*/
|
||||||
public static readonly MaprouletteApiKey = ""
|
public static readonly MaprouletteApiKey = ""
|
||||||
|
|
||||||
public static defaultOverpassUrls = meta.config.default_overpass_urls
|
|
||||||
|
|
||||||
public static readonly added_by_default = [
|
public static readonly added_by_default = [
|
||||||
"selected_element",
|
"selected_element",
|
||||||
"gps_location",
|
"gps_location",
|
||||||
|
@ -47,7 +41,6 @@ export default class Constants {
|
||||||
...Constants.added_by_default,
|
...Constants.added_by_default,
|
||||||
...Constants.no_include,
|
...Constants.no_include,
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
// The user journey states thresholds when a new feature gets unlocked
|
// The user journey states thresholds when a new feature gets unlocked
|
||||||
public static userJourney = {
|
public static userJourney = {
|
||||||
moreScreenUnlock: 1,
|
moreScreenUnlock: 1,
|
||||||
|
@ -104,7 +97,14 @@ export default class Constants {
|
||||||
* In seconds
|
* In seconds
|
||||||
*/
|
*/
|
||||||
static zoomToLocationTimeout = 15
|
static zoomToLocationTimeout = 15
|
||||||
static countryCoderEndpoint: string = meta.config.country_coder_host
|
private static readonly config = (() => {
|
||||||
|
const defaultConfig = packagefile.config
|
||||||
|
return { ...defaultConfig, ...extraconfig }
|
||||||
|
})()
|
||||||
|
public static ImgurApiKey = Constants.config.api_keys.imgur
|
||||||
|
public static readonly mapillary_client_token_v4 = Constants.config.api_keys.mapillary_v4
|
||||||
|
public static defaultOverpassUrls = Constants.config.default_overpass_urls
|
||||||
|
static countryCoderEndpoint: string = Constants.config.country_coder_host
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These are the values that are allowed to use as 'backdrop' icon for a map pin
|
* These are the values that are allowed to use as 'backdrop' icon for a map pin
|
||||||
|
|
Loading…
Reference in a new issue