Skip to content

Commit

Permalink
Remove rollout
Browse files Browse the repository at this point in the history
  • Loading branch information
fortuna committed Feb 7, 2019
1 parent a187015 commit eaa0d27
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions src/shadowbox/server/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {PortProvider} from '../infrastructure/get_port';
import * as json_config from '../infrastructure/json_config';
import * as logging from '../infrastructure/logging';
import {PrometheusClient, runPrometheusScraper} from '../infrastructure/prometheus_scraper';
import {RolloutTracker} from '../infrastructure/rollout';
import {AccessKeyId} from '../model/access_key';

import {PrometheusManagerMetrics} from './manager_metrics';
Expand Down Expand Up @@ -81,17 +80,6 @@ async function reservePortForNewAccessKeys(
return serverConfig.data().portForNewAccessKeys;
}

function createRolloutTracker(serverConfig: json_config.JsonConfig<server_config.ServerConfigJson>):
RolloutTracker {
const rollouts = new RolloutTracker(serverConfig.data().serverId);
if (serverConfig.data().rollouts) {
for (const rollout of serverConfig.data().rollouts) {
rollouts.forceRollout(rollout.id, rollout.enabled);
}
}
return rollouts;
}

async function main() {
const verbose = process.env.LOG_LEVEL === 'debug';
const portProvider = new PortProvider();
Expand Down Expand Up @@ -174,15 +162,9 @@ async function main() {
const accessKeyRepository = new ServerAccessKeyRepository(
portProvider, proxyHostname, accessKeyConfig, shadowsocksServer);

// TODO(fortuna): Once single-port is fully rollout, we should:
// - update `install_server.sh` to stop using `--net=host` for new servers (old servers are stuck
// with that forever) and output new instructions for port configuration.
// - update manger UI to provide new instructions for port configuration in manual mode.
if (createRolloutTracker(serverConfig).isRolloutEnabled('single-port', 100)) {
const portForNewAccessKeys = getPortForNewAccessKeys(serverConfig, accessKeyConfig) ||
await reservePortForNewAccessKeys(portProvider, serverConfig);
accessKeyRepository.enableSinglePort(portForNewAccessKeys);
}
const portForNewAccessKeys = getPortForNewAccessKeys(serverConfig, accessKeyConfig) ||
await reservePortForNewAccessKeys(portProvider, serverConfig);
accessKeyRepository.enableSinglePort(portForNewAccessKeys);

const prometheusClient = new PrometheusClient(`http://${prometheusLocation}`);
const metricsReader = new PrometheusUsageMetrics(prometheusClient);
Expand Down

0 comments on commit eaa0d27

Please sign in to comment.