CodeTogether Edge Server Technical Notes

The CodeTogether Edge Server is distributed as a Docker image and can be used with Kubernetes or raw Docker hosting. The full On-Premises Installation Guide should be followed before proceeding to use the information below.

Using a Load Balancer

All HTTP requests include a ctstickiness value. For IDE Clients, it is an HTTP Header; and for the Browser client, it is sent as a cookie. If using a load balancer to multiple edge servers (multiple active Docker instances), it is mandatory that the load balancer is configured to use this stickiness value to route connections from the same session to the same backend. Failure to use the stickiness value with multiple edge servers will result in errors, such as random users getting messages about sessions being unavailable.

Setting up Access to the CodeTogether Dashboard

CodeTogether 4.2 and later

The Dashboard can be accessed at https://<CT_SERVER_URL>/dashboard. Add the following variables to your Docker or Kubernetes configuration to correctly set up access to the dashboard.

CT_DASHBOARD_USER 'yourusername'
CT_DASHBOARD_PASSWORD 'changethis'

Note: Be sure to use straight quotes around the username and password values.

If the above variables are not explicitly specified, CodeTogether will attempt to fall back to the CT_LOGS_USER and CT_LOGS_PASSWORD variable values. If those are not specified either, a random password is generated and logged in the CodeTogether log (see below). The dashboard can then be accessed with the ctuser username and generated password.

Pre-CodeTogether 4.2

If you are using a CodeTogether version prior to 4.2, please add the following variables to your Docker or Kubernetes configuration to access log files via HTTPS:

CT_LOGS_USER 'yourusername'
CT_LOGS_PASSWORD 'changethis'

Note: Be sure to use straight quotes around the username and password values.

The logs will then be accessible at https://<CT_SERVER_URL>/logs

Setting up Metrics Monitoring with StatsD

CodeTogether 4.2 and later

If you would like to monitor your server metrics using a monitoring platform like Prometheus or Graphite, CodeTogether now makes this possible with StatsD. Please add the following variables to your Docker or Kubernetes configuration files, be sure to substitute the example values specified:

CT_PROMETHEUS_ENABLED "true"
CT_METRICS_STATSD_HOST "statsdhosturl.yourcompany.com"
CT_METRICS_STATSD_PORT "8125"
CT_METRICS_STATSD_PROTOCOL "UDP"

The following metrics are currently exposed:

  • Number of unique users currently online
  • Number of active sessions
  • Number of active session connections
  • Average server lag
  • Total sessions hosted
  • Total plugins/extensions downloaded

Runtime Path

Contains the NodeJS engine to run CodeTogether.

/opt/codetogether/runtime

Startup Script

Automatically runs CodeTogether when the container starts up. It first kills any existing Nginx and NodeJS running processes and then initiates CodeTogether through the NodeJS forever command which monitors for the CodeTogether runtime. If it goes down for some reason, it restarts the CodeTogether runtime (NodeJS process) automatically. Run it if you want to manually restart CodeTogether:

/opt/codetogether/start-codetogether

License File

Contains license information needed to use CodeTogether.

/opt/codetogether/licensing.properties

CodeTogether Log

Contains startup information such as if CodeTogether has a valid license along with the available public ports for HTTP and HTTPS connections.

/var/log/codetogether/server.log
root INFO CodeTogether On-Premises services now available on port 1080
(HTTP) and 1443 (SSL)
root INFO Valid CodeTogether license installed

Health-Check

You can health-check the running processes inside the container using the netstat command to verify services and ports
are available:

[Nginx default public ports – i.e. reachable outside the container]

# netstat -tulpn | grep nginx
tcp 0 0 0.0.0.0:1443 0.0.0.0:* LISTEN 10/nginx: master
tcp 0 0 0.0.0.0:1080 0.0.0.0:* LISTEN 10/nginx: master

[CodeTogether private port – i.e. not reachable outside the container]

# netstat -tulpn | grep node
tcp 0 0 127.0.0.1:3001 0.0.0.0:* LISTEN 212/node

[CodeTogether is running and monitored by NodeJS forever command]

# /opt/codetogether/.nvm/versions/node/v12.18.3/bin/node
/opt/codetogether/.nvm/versions/node/v12.18.3/lib/node_modules/forever/bin/forever list

[Sample output showing the process is ‘running’ along with its uptime metric formatted days:hours:minutes:ms]

info: Forever processes running 
data: uid command 
script 
forever pid id logfile uptime 
data: [0] tQIL /opt/codetogether/.nvm/versions/node/v12.18.3/bin/node 
/opt/codetogether/runtime/src-gen/backend/main.js --hostname 127.0.0.1 
--port 3001 200 212 /opt/codetogether/.forever/tQIL.log 
2:15:37:49.537000000011176

Confirming Availability

You can verify that CodeTogether On-Premises is available via the following URL:

[default HTTPS connections]

https://<CT_SERVER_URL>:<PORT>/clients

Nginx Log Files

Contain all requests to the /clients/ area along with the request to CodeTogether itself.

/var/log/nginx/access.log
/var/log/nginx/error.log

Tracking Downloads

If you are using CodeTogether 4.2, access these stats using the dashboard instead.

You can track the /clients/ downloads in the container.

[For Eclipse]

# cat /var/log/nginx/access.log | grep "GET 
/clients/eclipse/plugins/com.genuitec.eclipse.codetogether.core_" |
wc -l

[For IntelliJ]

# cat /var/log/nginx/access.log | grep "GET 
/clients/intellij/codetogether-onpremises-" | wc -l

[For VSCode]

# cat /var/log/nginx/access.log | grep "GET 
/clients/vscode/codetogether-onpremises-" | wc -l