trafficcontrol
trafficcontrol copied to clipboard
Use `let`/`const` instead of `var` in Traffic Portal
To prevent "hoisting" that could result in unintended undefined values, it'd be ideal for block-scope variables to be declared with let/const (as appropriate) rather than var.
Global-scope variables (e.g. controllers, nearly anything that gets directly added to module.exports) can probably use var. I have no idea what switching that would do to our build system.
Hi @ocket8888, I I am interested to contribute to this issue and several other issues relating to Traffic Ops and Traffic Portal.
I have been trying to read the documentation and get started with the project by setting up the backend (i.e., Traffic Ops) and frontend (i.e., Traffic Portal) but I have been struggling for a week and have not been able to make much progress. Despite trying several ways to start the application, I have not been successful so far.
These are the ways I have tried:
- After following the instructions on https://traffic-control-cdn.readthedocs.io/en/latest/development/index.html# and cloning the repository, I executed
source dev/atc.dev.shand ranatc buildandatc startwith no errors on my Mac machine where Docker is installed. However, upon runningatc ready, nothing is printed on the console and commands likeatc trafficopsoratc trafficportalseem to be waiting indefinitely. Additionally, attempting to access the Traffic Portal interface via https://localhost:60443/ or https://localhost:8080/ has not been successful. Despite multiple attempts at restarting the process, the issue persists. - I attempted to build Traffic Control using the pkg command following the instructions provided in the link https://traffic-control-cdn.readthedocs.io/en/latest/development/building.html#build-using-pkg. To ensure I was in the correct directory, I cloned the repo and in
$GOPATH/src/github.com/apache/trafficcontrol, I ranpkg -a. However, the only output I saw was"Building weasel."and it appeared to be stuck indefinitely. This was attempted on my Mac machine and I have tried restarting the process multiple times, but the issue persists. - After following the instructions in https://traffic-control-cdn.readthedocs.io/en/latest/development/building.html#build-using-docker-compose, I ran the command
docker-compose buildwith no errors. However, I am unable to access the Traffic Portal interface at https://localhost:60443/ or https://localhost:8080/. Despite restarting the process multiple times, the issue persists. - After referring to https://traffic-control-cdn.readthedocs.io/en/latest/development/building.html#building-individual-components, I attempted to execute
build/clean_build.sh. However, I encountered errors during the process , per the below.
==================================================
WORKSPACE: /private/tmp/go/src/github.com/apache/trafficcontrol
BUILD_NUMBER: 12425.72b2332e
RHEL_VERSION: el7
TC_VERSION: 7.1.0
--------------------------------------------------
-rw-r--r-- 1 zhuzikun staff 50950600 Apr 3 22:37 dist/apache-trafficcontrol-7.1.0.tar.gz
+ for project in '"$@"'
+ [[ 0 -eq 1 ]]
+ ./build/build.sh traffic_monitor
+ tee dist/build-traffic_monitor.log
/opt/homebrew/bin/realpath
----- Building traffic_monitor ...
/opt/homebrew/bin/realpath
git is /opt/homebrew/bin/git
go is /opt/homebrew/bin/go
/private/tmp/go/src/github.com/apache/trafficcontrol/build/functions.sh: line 173: type: rpmbuild: not found
rpmbuild not found in PATH
Error on line 97 of traffic_monitor/build/build_rpm.sh
traffic_monitor failed: traffic_monitor/build/build_rpm.sh
The following subdirectories had errors:
traffic_monitor
Error on line 110 of ./build/build.sh
+ exit_code=1
+ '[' 1 -ne 0 ']'
+ echo 'Error on line 77 of build/clean_build.sh'
Error on line 77 of build/clean_build.sh
+ cleanup
++ id -u
+ '[' 501 -eq 0 ']'
+ exit 1
- After installing CentOS Stream 9 on my Mac machine using Parallels, I followed the instructions in https://traffic-control-cdn.readthedocs.io/en/latest/development/traffic_portal.html#installing-the-traffic-portal-developer-environment, except for step 4.2 where I didn't modify
api.base_urlto point to my Traffic Ops API endpoint. After this, I was able to access https://localhost:60443/. I then attempted to follow the instructions in https://traffic-control-cdn.readthedocs.io/en/latest/development/traffic_ops.html#installing-the-developer-environment, but encountered an error while attempting step 4, which involved using the reset and upgrade commands of admin (see app/db/admin for usage) to set up the traffic_ops databases. The error message is shown below.
I am new to open-source. I would greatly appreciate if you could advise me on how to get started.
Thank you for your time reading this and have a nice day!
upon running
atc ready, nothing is printed on the console
That's normal, it would only print anything if it fails.
commands like
atc trafficopsoratc trafficportalseem to be waiting indefinitely.
That is strange - because those aren't valid commands. What should happen in that case is you get an exit failure code and a usage message. This is what I see when I try that:
$ atc trafficops
Usage: atc OPERATION
Valid OPERATIONs:
build Build the images for the environment, but do not start it
connect Connect to a shell session inside a dev container
exec Run a command in a dev container
ready Check if the development environment is ready
restart Restart the development environment
start Start up the development environment
stop Stop the development environment
Additionally, attempting to access the Traffic Portal interface via https://localhost:60443/ or https://localhost:8080/ has not been successful.
That would be because Traffic Portal does not listen on either of those ports. Nothing listens on port 60443, so I'm not sure where you even got that. It's similar to port 6443 which is used by Traffic Ops - not Traffic Portal. Port 8080 is used by Traffic Server. Traffic Portal listens on port 444, so that's where you should look for it.
You can see all these ports while the containers are running with docker ps.
For further help, please reach out in our Slack server.
@ocket8888 Thank you for your reply!
That's normal, it would only print anything if it fails.
Thank you for the clarifications.
commands like
atc trafficopsoratc trafficportalseem to be waiting indefinitely.
I apologize for the mistake. What I intended to convey was atc ready --wait trafficops or atc ready --wait trafficportal seemed to be waiting indefinitely.
That would be because Traffic Portal does not listen on either of those ports. Nothing listens on port 60443, so I'm not sure where you even got that. It's similar to port 6443 which is used by Traffic Ops - not Traffic Portal. Port 8080 is used by Traffic Server. Traffic Portal listens on port 444, so that's where you should look for it.
You can see all these ports while the containers are running with
docker ps.
Thank you for pointing it out! I was looking at line 27 of https://github.com/apache/trafficcontrol/blob/master/traffic_portal/conf/configDev.js and this caused confusion. However, I tried to visit https://localhost:444/ just now, it could be loaded but I saw the errors in the below screenshot.

For further help, please reach out in our Slack server.
I just sent an email to [email protected] requesting a Slack invite. Thank you so much for your help!