diff --git a/CommonServer/test-setup.sh b/CommonServer/test-setup.sh index b32e73a59a..aaabd41c7a 100644 --- a/CommonServer/test-setup.sh +++ b/CommonServer/test-setup.sh @@ -6,4 +6,4 @@ cd .. # Run Preinstall. npm run prerun # Run Postgres -npm run read-env && docker compose up -f docker-compose.dev.yml -d postgres \ No newline at end of file +docker compose --env-file config.env up -f docker-compose.dev.yml -e -d postgres \ No newline at end of file diff --git a/Scripts/Install/ReplaceValueInConfig.ts b/Scripts/Install/ReplaceValueInConfig.ts index 042d3e1a50..11bd0df1ce 100644 --- a/Scripts/Install/ReplaceValueInConfig.ts +++ b/Scripts/Install/ReplaceValueInConfig.ts @@ -31,7 +31,7 @@ const init: Function = (): void => { for (let line of linesInEnv) { // this is a comment, ignore. - if (!line.startsWith('export ' + envValToReplace)) { + if (!line.startsWith(envValToReplace)) { linesToRender.push(line); } else { found = true; diff --git a/config.example.env b/config.example.env index e22f1b1d93..53d9a11c70 100644 --- a/config.example.env +++ b/config.example.env @@ -2,28 +2,28 @@ # Secrets - PLEASE CHANGE THESE. Please change these to something random. All of these can be different values. -export ONEUPTIME_SECRET=please-change-this-to-random-value -export DATABASE_PASSWORD=please-change-this-to-random-value -export CLICKHOUSE_PASSWORD=please-change-this-to-random-value -export REDIS_PASSWORD=please-change-this-to-random-value -export ENCRYPTION_SECRET=please-change-this-to-random-value -export TOKEN_SECRET=please-change-this-to-random-value -export GLOBAL_PROBE_KEY=please-change-this-to-random-value +ONEUPTIME_SECRET=please-change-this-to-random-value +DATABASE_PASSWORD=please-change-this-to-random-value +CLICKHOUSE_PASSWORD=please-change-this-to-random-value +REDIS_PASSWORD=please-change-this-to-random-value +ENCRYPTION_SECRET=please-change-this-to-random-value +TOKEN_SECRET=please-change-this-to-random-value +GLOBAL_PROBE_KEY=please-change-this-to-random-value # Which domain is this server hosted on? replace this with oneuptime.yourdomain.com or yourdomain.com. -export DOMAIN=localhost +DOMAIN=localhost # Is this server hosted with a TLS cert (for ex: SSL from LetsEncrypt / Cloudflare). If yes, this should be "https" -export HTTP_PROTOCOL=http +HTTP_PROTOCOL=http # SMTP SETTINGS. You need to change these if you like emails to be sent. -export SMTP_USERNAME= -export SMTP_PASSWORD= -export SMTP_PORT= -export SMTP_EMAIL= -export SMTP_FROM_NAME= -export SMTP_IS_SECURE= -export SMTP_HOST= +SMTP_USERNAME= +SMTP_PASSWORD= +SMTP_PORT= +SMTP_EMAIL= +SMTP_FROM_NAME= +SMTP_IS_SECURE= +SMTP_HOST= # If you would like to attach status page to custom domains use this setting. @@ -31,7 +31,7 @@ export SMTP_HOST= # 1. Create a A record in your DNS provider with the name "oneuptime" and value "oneuptime.yourcompany.com" # 2. Set the STATUS_PAGE_CNAME_RECORD to "oneuptime.yourcompany.com" # 3. Create CNAME record in your DNS provider with the name "status" and value "oneuptime.yourcompany.com" -export STATUS_PAGE_CNAME_RECORD=oneuptime.yourcompany.com +STATUS_PAGE_CNAME_RECORD=oneuptime.yourcompany.com # --------------------------------------------- # @@ -39,150 +39,150 @@ export STATUS_PAGE_CNAME_RECORD=oneuptime.yourcompany.com # --------------------------------------------- # # This supports test | production | development | ci. # Development is used for local development. Test is used for insider / beta / staging builds. Production is used for production ready app. ci is for testing in the CI/CD. -export ENVIRONMENT=production +ENVIRONMENT=production # What image should we pull from docker hub. This only applies when the ENVIRONMENT is production or test -export APP_TAG=release +APP_TAG=release # What is the name of the docker-compose project. This is used to prefix the docker containers. -export COMPOSE_PROJECT_NAME=oneuptime +COMPOSE_PROJECT_NAME=oneuptime # Clickhouse Settings -export CLICKHOUSE_USER=default -export CLICKHOUSE_DATABASE=oneuptime +CLICKHOUSE_USER=default +CLICKHOUSE_DATABASE=oneuptime # Postgres DB Settings. -export DATABASE_PORT=5432 -export DATABASE_USERNAME=postgres -export DATABASE_NAME=oneuptimedb -export DATABASE_HOST=postgres +DATABASE_PORT=5432 +DATABASE_USERNAME=postgres +DATABASE_NAME=oneuptimedb +DATABASE_HOST=postgres # Redis DB Settings. -export REDIS_HOST=redis -export REDIS_PORT=6379 +REDIS_HOST=redis +REDIS_PORT=6379 -export DISABLE_SIGNUP=false +DISABLE_SIGNUP=false # Hostnames. Usually does not need to change. -export REALTIME_HOSTNAME=realtime:3300 -export NOTIFICATION_HOSTNAME=notification:3191 -export DASHBOARD_HOSTNAME=dashboard:3000 -export DASHBOARD_API_HOSTNAME=dashboard-api:3002 -export WORKFLOW_HOSTNAME=workflow:3099 -export LINK_SHORTNER_HOSTNAME=link-shortner:3521 -export ALERT_HOSTNAME=alert:3088 -export PROBE_API_HOSTNAME=probe-api:3400 -export TEST_SERVER_HOSTNAME=test-server:3800 -export DATA_INGESTOR_HOSTNAME=data-ingestor:3200 -export ACCOUNTS_HOSTNAME=accounts:3003 -export HOME_HOSTNAME=home:1444 -export WORKER_HOSTNAME=worker:3452 -export API_DOCS_HOSTNAME=api-reference:1445 +REALTIME_HOSTNAME=realtime:3300 +NOTIFICATION_HOSTNAME=notification:3191 +DASHBOARD_HOSTNAME=dashboard:3000 +DASHBOARD_API_HOSTNAME=dashboard-api:3002 +WORKFLOW_HOSTNAME=workflow:3099 +LINK_SHORTNER_HOSTNAME=link-shortner:3521 +ALERT_HOSTNAME=alert:3088 +PROBE_API_HOSTNAME=probe-api:3400 +TEST_SERVER_HOSTNAME=test-server:3800 +DATA_INGESTOR_HOSTNAME=data-ingestor:3200 +ACCOUNTS_HOSTNAME=accounts:3003 +HOME_HOSTNAME=home:1444 +WORKER_HOSTNAME=worker:3452 +API_DOCS_HOSTNAME=api-reference:1445 # Routes. Usually does not need to change. -export REALTIME_ROUTE=/realtime -export API_DOCS_ROUTE=/reference -export NOTIFICATION_ROUTE=/notification -export DASHBOARD_ROUTE=/dashboard -export DASHBOARD_API_ROUTE=/api -export WORKFLOW_ROUTE=/workflow -export LINK_SHORTNER_ROUTE=/l -export ALERT_ROUTE=/alert -export TEST_SERVER_API_ROUTE=/test-server -export PROBE_API_ROUTE=/probe-api -export DATA_INGESTOR_ROUTE=/data-ingestor -export ACCOUNTS_ROUTE=/accounts -export HOME_ROUTE= -export HELMCHARTS_ROUTE=/charts -export API_REFERENCE_ROUTE=/reference -export IDENTITY_ROUTE=/identity -export FILE_ROUTE=/file -export STATUS_PAGE_ROUTE=/status-page +REALTIME_ROUTE=/realtime +API_DOCS_ROUTE=/reference +NOTIFICATION_ROUTE=/notification +DASHBOARD_ROUTE=/dashboard +DASHBOARD_API_ROUTE=/api +WORKFLOW_ROUTE=/workflow +LINK_SHORTNER_ROUTE=/l +ALERT_ROUTE=/alert +TEST_SERVER_API_ROUTE=/test-server +PROBE_API_ROUTE=/probe-api +DATA_INGESTOR_ROUTE=/data-ingestor +ACCOUNTS_ROUTE=/accounts +HOME_ROUTE= +HELMCHARTS_ROUTE=/charts +API_REFERENCE_ROUTE=/reference +IDENTITY_ROUTE=/identity +FILE_ROUTE=/file +STATUS_PAGE_ROUTE=/status-page #Ports. Usually they dont need to change. -export DASHBOARD_API_PORT=3002 -export API_DOCS_PORT=1445 -export WORKFLOW_PORT=3099 -export LINK_SHORTNER_PORT=3521 -export ALERT_PORT=3088 -export PROBE_API_PORT=3400 -export PROBE_PORT=3500 -export TEST_SERVER_PORT=3800 -export FILE_PORT=3125 -export HOME_PORT=1444 -export IDENTITY_PORT=3087 -export NOTIFICATION_PORT=3191 -export REALTIME_PORT=3300 -export WORKERS_PORT=3452 -export ACCOUNTS_PORT=3003 -export STATUS_PAGE_PORT=3105 -export DASHBOARD_PORT=3009 +DASHBOARD_API_PORT=3002 +API_DOCS_PORT=1445 +WORKFLOW_PORT=3099 +LINK_SHORTNER_PORT=3521 +ALERT_PORT=3088 +PROBE_API_PORT=3400 +PROBE_PORT=3500 +TEST_SERVER_PORT=3800 +FILE_PORT=3125 +HOME_PORT=1444 +IDENTITY_PORT=3087 +NOTIFICATION_PORT=3191 +REALTIME_PORT=3300 +WORKERS_PORT=3452 +ACCOUNTS_PORT=3003 +STATUS_PAGE_PORT=3105 +DASHBOARD_PORT=3009 # Internal SMTP Server - Haraka -export INTERNAL_SMTP_USER=alert@oneuptime.com -export INTERNAL_SMTP_PASSWORD=oneuptime +INTERNAL_SMTP_USER=alert@oneuptime.com +INTERNAL_SMTP_PASSWORD=oneuptime # Licensing Database -export AIRTABLE_API_KEY= -export AIRTABLE_BASE_ID= +AIRTABLE_API_KEY= +AIRTABLE_BASE_ID= # Plans # This is in the format of PlanName,PlanIdFromBillingProvider,MonthlySubscriptionPlanAmountInUSD,YearlySubscriptionPlanAmountInUSD,Order,TrialPeriodInDays # Enterprise plan will have -1 which means custom pricing. -export SUBSCRIPTION_PLAN_BASIC=Basic,priceMonthlyId,priceYearlyId,0,0,1,0 -export SUBSCRIPTION_PLAN_GROWTH=Growth,priceMonthlyId,priceYearlyId,0,0,2,14 -export SUBSCRIPTION_PLAN_SCALE=Scale,priceMonthlyId,priceYearlyId,0,0,3,0 -export SUBSCRIPTION_PLAN_ENTERPRISE=Enterprise,priceMonthlyId,priceYearlyId,-1,-1,4,14 +SUBSCRIPTION_PLAN_BASIC=Basic,priceMonthlyId,priceYearlyId,0,0,1,0 +SUBSCRIPTION_PLAN_GROWTH=Growth,priceMonthlyId,priceYearlyId,0,0,2,14 +SUBSCRIPTION_PLAN_SCALE=Scale,priceMonthlyId,priceYearlyId,0,0,3,0 +SUBSCRIPTION_PLAN_ENTERPRISE=Enterprise,priceMonthlyId,priceYearlyId,-1,-1,4,14 -export DATABASE_BACKUP_DIRECTORY=/Backups -export DATABASE_BACKUP_HOST=localhost -export DATABASE_BACKUP_PORT=5400 -export DATABASE_BACKUP_NAME=oneuptimedb -export DATABASE_BACKUP_USERNAME=postgres -export DATABASE_BACKUP_PASSWORD=${DATABASE_PASSWORD} +DATABASE_BACKUP_DIRECTORY=/Backups +DATABASE_BACKUP_HOST=localhost +DATABASE_BACKUP_PORT=5400 +DATABASE_BACKUP_NAME=oneuptimedb +DATABASE_BACKUP_USERNAME=postgres +DATABASE_BACKUP_PASSWORD=${DATABASE_PASSWORD} -export DATABASE_RESTORE_DIRECTORY=/Backups -export DATABASE_RESTORE_HOST=localhost -export DATABASE_RESTORE_PORT=5400 -export DATABASE_RESTORE_NAME=oneuptimedb -export DATABASE_RESTORE_USERNAME=postgres -export DATABASE_RESTORE_PASSWORD=${DATABASE_PASSWORD} -export DATABASE_RESTORE_FILENAME=db-31.backup +DATABASE_RESTORE_DIRECTORY=/Backups +DATABASE_RESTORE_HOST=localhost +DATABASE_RESTORE_PORT=5400 +DATABASE_RESTORE_NAME=oneuptimedb +DATABASE_RESTORE_USERNAME=postgres +DATABASE_RESTORE_PASSWORD=${DATABASE_PASSWORD} +DATABASE_RESTORE_FILENAME=db-31.backup -export ANALYTICS_KEY= -export ANALYTICS_HOST= +ANALYTICS_KEY= +ANALYTICS_HOST= -export DATABASE_MIGRATIONS_HOST=localhost -export DATABASE_MIGRATIONS_PORT=5400 +DATABASE_MIGRATIONS_HOST=localhost +DATABASE_MIGRATIONS_PORT=5400 # Global Probes # This is in the format of GLOBAL_PROBE_NAME=ProbeName,ProbeDescription,ProbeKey -export GLOBAL_PROBE_1_NAME=OneUptime -export GLOBAL_PROBE_1_DESCRIPTION="Global probe to monitor oneuptime resources" +GLOBAL_PROBE_NAME=OneUptime +GLOBAL_PROBE_DESCRIPTION="Global probe to monitor oneuptime resources" -export SENDGRID_API_KEY= +SENDGRID_API_KEY= # METERED PLANS: This is in the format of MONTHLY_PRICE_ID,YEARLY_PRICE_ID,value per unit,unitName -export METERED_PLAN_ACTIVE_MONITORING=priceMonthlyId,priceYearlyId,1,active-monitor,month +METERED_PLAN_ACTIVE_MONITORING=priceMonthlyId,priceYearlyId,1,active-monitor,month # Twilio Settings -export TWILIO_ACCOUNT_SID= -export TWILIO_AUTH_TOKEN= -export TWILIO_PHONE_NUMBER= -export SMS_DEFAULT_COST_IN_CENTS= -export CALL_DEFAULT_COST_IN_CENTS_PER_MINUTE= +TWILIO_ACCOUNT_SID= +TWILIO_AUTH_TOKEN= +TWILIO_PHONE_NUMBER= +SMS_DEFAULT_COST_IN_CENTS= +CALL_DEFAULT_COST_IN_CENTS_PER_MINUTE= # IS BILLING ENABLED for this installer. -export BILLING_ENABLED=false +BILLING_ENABLED=false # Public and private key for billing provider, usually stripe. -export BILLING_PUBLIC_KEY= -export BILLING_PRIVATE_KEY= +BILLING_PUBLIC_KEY= +BILLING_PRIVATE_KEY= diff --git a/package.json b/package.json index 48fbd546f4..120a121922 100644 --- a/package.json +++ b/package.json @@ -44,8 +44,7 @@ "lint": "ejslint **/*.ejs && eslint '**/*.ts*' -c .eslintrc.json --ignore-path .eslintignore ", "fix-lint": " node --max_old_space_size=18192 ./node_modules/.bin/eslint '**/*.ts*' -c .eslintrc.json --ignore-path .eslintignore --fix ", "fix": "npm run fix-lint", - "read-env": "bash config.env", - "start": "npm run read-env && sudo docker compose up --remove-orphans -d $npm_config_services", + "start": "sudo docker compose --env-file config.env up --remove-orphans -d $npm_config_services", "ps": "sudo docker compose ps", "save-logs": "sudo docker compose logs --tail=100000 $npm_config_services > logs.txt", "logs": "sudo docker compose logs --tail=100 -f $npm_config_services", @@ -55,7 +54,7 @@ "force-build-dev": "npm run config-to-dev && npm run force-build", "kill": "npm run stop", "prod": "docker compose up -f docker-compose.yml -d", - "dev": "npm run read-env && sudo docker compose up --remove-orphans -f docker-compose.dev.yml -d $npm_config_services", + "dev": "sudo docker compose --env-file config.env up --remove-orphans -f docker-compose.dev.yml -d $npm_config_services", "stop": "docker compose down --remove-orphans", "prune": "docker system prune", "remove-all-containers": "docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) || echo 'No running containers'",