Skip to content

Commit

Permalink
change STATIC_FILES_CLIENT_PORT to
Browse files Browse the repository at this point in the history
 STATIC_FILES_PARTICIPATION_PORT;
typo and organization of configuration.md.
  • Loading branch information
ballPointPenguin committed Apr 5, 2023
1 parent cfbacca commit 0312ee7
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 26 deletions.
4 changes: 2 additions & 2 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ If you are doing development on a url other than `localhost` or `localhost:5000`
**API_DEV_HOSTNAME** value to your development hostname:port, e.g. `myhost:8000` or `api.testserver.net`.
**DEV_MODE** should be `true`.

If you are deploying to a custom domain (not pol.is) than you need to update both the **API_PROD_HOSTNAME** and
If you are deploying to a custom domain (not pol.is) then you need to update both the **API_PROD_HOSTNAME** and
**DOMAIN_OVERRIDE** values to your custom hostname (omitting http(s):// protocol).
**DEV_MODE** should be `false`.

Expand Down Expand Up @@ -81,7 +81,7 @@ If you are deploying to a custom domain (not pol.is) than you need to update bot
- **HTTPS_PORT** typically 443. Port exposed by Nginx reverse proxy.
- **STATIC_FILES_PORT** typically 8080. Used internally within a docker network and/or behind a proxy.
- **STATIC_FILES_ADMIN_PORT** same as **STATIC_FILES_PORT** unless you are hosting client-admin separately from file-server. Useful in local development.
- **STATIC_FILES_CLIENT_PORT** same as **STATIC_FILES_PORT** unless you are hosting client-participation separately from file-server. Useful in local development.
- **STATIC_FILES_PARTICIPATION_PORT** same as **STATIC_FILES_PORT** unless you are hosting client-participation separately from file-server. Useful in local development.

### Email Addresses

Expand Down
30 changes: 18 additions & 12 deletions example.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,14 @@ ADMIN_UIDS=[]
# Options: maildev, aws-ses, mailgun
# Example: `aws-ses,mailgun` would try sending via AWS SES first, and fallback to Mailgun on error.
EMAIL_TRANSPORT_TYPES=maildev
# (Deprecated) Used internally by Node.Crypto.
ENCRYPTION_PASSWORD_00001=
# Optionally set this manually or use `git rev-parse HEAD`. It can be useful for debugging.
GIT_HASH=
# Options: prod, preprod, dev:
MATH_ENV=prod
# Optionally set this to whatever you want. It is a convenience for docker assets.
TAG=dev
COMPOSE_PROJECT_NAME=polis-${TAG}
# Optionally give the server container a distinct env_file. Useful for CI tests.
SERVER_ENV_FILE=.env
# Used by winston via server/utils/logger. Defaults to "info".
SERVER_LOG_LEVEL=
# When true, logs are written to server/logs in addition to stdout.
# If docker compose is used, the logs directory is mounted as a persistent volume.
SERVER_LOG_TO_FILE=
# (Deprecated) Settings for submitting web requests to the math worker.
WEBSERVER_PASS=ws-pass
WEBSERVER_USERNAME=ws-user


###### DATABASE ######
Expand All @@ -39,6 +28,12 @@ POSTGRES_USER=postgres
DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}/${POSTGRES_DB}


###### DOCKER CONCERNS ######
# Optionally set this to whatever you want. It is a convenience for docker assets.
TAG=dev
COMPOSE_PROJECT_NAME=polis-${TAG}


###### PORTS ######
API_SERVER_PORT=5000
HTTP_PORT=80
Expand All @@ -47,7 +42,7 @@ STATIC_FILES_PORT=8080
# These ports could actually be different in development or if you are hosting clint-admin,
# client-participation, and file-server on different servers or containers.
STATIC_FILES_ADMIN_PORT=${STATIC_FILES_PORT}
STATIC_FILES_CLIENT_PORT=${STATIC_FILES_PORT}
STATIC_FILES_PARTICIPATION_PORT=${STATIC_FILES_PORT}


###### EMAIL ADDRESSES ######
Expand All @@ -65,6 +60,9 @@ CACHE_MATH_RESULTS=
# Set to `false` for production:
DEV_MODE=true
RUN_PERIODIC_EXPORT_TESTS=
# When true, logs are written to server/logs in addition to stdout.
# If docker compose is used, the logs directory is mounted as a persistent volume.
SERVER_LOG_TO_FILE=
SHOULD_USE_TRANSLATION_API=


Expand Down Expand Up @@ -118,3 +116,11 @@ AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
# This value is written by the server app if SHOULD_USE_TRANSLATION_API is true.
GOOGLE_APPLICATION_CREDENTIALS=


###### DEPRECATED ######
# (Deprecated) Used internally by Node.Crypto to encrypt/decrypt IP addresses.
ENCRYPTION_PASSWORD_00001=
# (Deprecated) Basic Auth settings for certain requests between math and api services.
WEBSERVER_PASS=ws-pass
WEBSERVER_USERNAME=ws-user
10 changes: 5 additions & 5 deletions server/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ helpersInitialized.then(
makeRedirectorTo,
pidCache,
staticFilesAdminPort,
staticFilesClientPort,
staticFilesParticipationPort,
proxy,
redirectIfHasZidButNoConversationId,
redirectIfNotHttps,
Expand Down Expand Up @@ -1506,7 +1506,7 @@ helpersInitialized.then(
);

function makeFetchIndexWithoutPreloadData() {
let port = staticFilesClientPort;
let port = staticFilesParticipationPort;
return function (req, res) {
return fetchIndexWithoutPreloadData(req, res, port);
};
Expand Down Expand Up @@ -1607,7 +1607,7 @@ helpersInitialized.then(
);
app.get(
/^\/styleguide$/,
makeFileFetcher(hostname, staticFilesClientPort, "/styleguide.html", {
makeFileFetcher(hostname, staticFilesParticipationPort, "/styleguide.html", {
"Content-Type": "text/html",
})
);
Expand All @@ -1616,15 +1616,15 @@ helpersInitialized.then(
app.get(/^\/home(\/.*)?/, fetchIndexForAdminPage);
app.get(
/^\/s\/CTE\/?$/,
makeFileFetcher(hostname, staticFilesClientPort, "/football.html", {
makeFileFetcher(hostname, staticFilesParticipationPort, "/football.html", {
"Content-Type": "text/html",
})
);
app.get(
/^\/twitterAuthReturn(\/.*)?$/,
makeFileFetcher(
hostname,
staticFilesClientPort,
staticFilesParticipationPort,
"/twitterAuthReturn.html",
{
"Content-Type": "text/html",
Expand Down
2 changes: 1 addition & 1 deletion server/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ MATH_ENV=prod
POLIS_FROM_ADDRESS="Example <team@example.com>"
SERVER_LOG_LEVEL=info
STATIC_FILES_ADMIN_PORT=8080
STATIC_FILES_CLIENT_PORT=8080
STATIC_FILES_PARTICIPATION_PORT=8080
STATIC_FILES_HOST=localhost
2 changes: 1 addition & 1 deletion server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
runPeriodicExportTests: isTrue(process.env.RUN_PERIODIC_EXPORT_TESTS) as boolean,
shouldUseTranslationAPI: setGoogleApplicationCredentials() as boolean,
staticFilesAdminPort: parseInt(process.env.STATIC_FILES_ADMIN_PORT || '8080', 10) as number,
staticFilesClientPort: parseInt(process.env.STATIC_FILES_CLIENT_PORT || '8080', 10) as number,
staticFilesParticipationPort: parseInt(process.env.STATIC_FILES_PARTICIPATION_PORT || '8080', 10) as number,
staticFilesHost: process.env.STATIC_FILES_HOST as string,
twitterConsumerKey: process.env.TWITTER_CONSUMER_KEY || null as string | null,
twitterConsumerSecret: process.env.TWITTER_CONSUMER_SECRET || null as string | null,
Expand Down
10 changes: 5 additions & 5 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13482,7 +13482,7 @@ Thanks for using Polis!
// // });
// getStaticFile("./unsupportedBrowser.html", res);
// } else {
let port = Config.staticFilesClientPort;
let port = Config.staticFilesParticipationPort;
// set the host header too, since S3 will look at that (or the routing proxy will patch up the request.. not sure which)
if (req && req.headers && req.headers.host) req.headers.host = hostname;
routingProxy.web(req, res, {
Expand Down Expand Up @@ -13689,11 +13689,11 @@ Thanks for using Polis!

// serve up index.html in response to anything starting with a number
let hostname: string = Config.staticFilesHost;
let staticFilesClientPort: number = Config.staticFilesClientPort;
let staticFilesParticipationPort: number = Config.staticFilesParticipationPort;
let staticFilesAdminPort: number = Config.staticFilesAdminPort;
let fetchUnsupportedBrowserPage = makeFileFetcher(
hostname,
staticFilesClientPort,
staticFilesParticipationPort,
"/unsupportedBrowser.html",
{
"Content-Type": "text/html",
Expand Down Expand Up @@ -13822,7 +13822,7 @@ Thanks for using Polis!
req,
res,
preloadData,
staticFilesClientPort,
staticFilesParticipationPort,
buildNumber
);
})
Expand Down Expand Up @@ -14116,7 +14116,7 @@ Thanks for using Polis!
makeRedirectorTo,
pidCache,
staticFilesAdminPort,
staticFilesClientPort,
staticFilesParticipationPort,
proxy,
redirectIfHasZidButNoConversationId,
redirectIfNotHttps,
Expand Down

0 comments on commit 0312ee7

Please sign in to comment.