8000 Update start servers by saijel · Pull Request #163 · claritylab/lucida · GitHub
[go: up one dir, main page]

Skip to content

Update start servers - #163

Merged
jhauswald merged 9 commits into
claritylab:fixesfrom
saijel:fixes-start-servers
May 5, 2017
Merged

jhauswald merged 9 commits into
claritylab:fixesfrom
saijel:fixes-start-servers

Conversation

@saijel
@saijel saijel commented Apr 5, 2017
Copy link
Copy Markdown
Contributor

list of changes:

  • remove the dependency of gnome-terminal in services makefiles
  • add the ability to start all services (secure and non-secure hosts) using a tmux session with a tmux window for each service
  • add the ability to make the host secure in order to add the ASR functionality by generating self-signed certificates for the host

Comment thread lucida/commandcenter/app.py Outdated
import logging



Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll remove all of these extra white spaces. I stupidly diff -w to ignore the whitespace.

threaded=True, ssl_context=('certs/server.crt', 'certs/server.key'))
# For http
else:
print 'Starting non-secure flask'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So non-secure means you can't use ASR right? Is that stated somewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm adding a comment within this file but also I think it'll be more clear once I write out the instructions on how to start servers with and without ASR.

Comment thread lucida/calendar/Makefile

start_server:
gnome-terminal -x bash -c "./gradlew run $(filter-out $@,$(MAKECMDGOALS)); read -n1"
./gradlew run
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you speak to what $(filter-out $@,$(MAKECMDGOALS)); read -n1 was doing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't know what these were doing. Every time I run with $(filter-out $@,$(MAKECMDGOALS)); read -n1 it says these commands are not found.

According to the internet: $(filter-out PATTERN...,TEXT) returns all whitespace-separated words in TEXT that do not match any of the PATTERN words, removing the words that do match one or more. And read -n1 means read one character at a time. But MAKECMDGOALS is not defined anywhere.


gnome-terminal -x bash -c "python kaldigstserver/worker.py -u ws://localhost:8081/worker/ws/speech -c sample_english_nnet2.yaml; read -n1"
python kaldigstserver/worker.py -u ${ASR_ADDR_PORT}/worker/ws/speech -c sample_english_nnet2.yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why these extra lines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting rid of the extra spaces.

Comment thread tools/start_all_tmux.sh Outdated
if [ "$1" == "secure" ]; then
echo "Enabling secure host"
# Getting the host IP address
export ASR_ADDR_PORT="wss://$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'):8081"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me a little nervous, so all ASR ports run on 8081 and its sort of hard coded all over the place right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's how it seems. Each service has a port that is hard-coded and used in multiple places.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I know that I'm asking if you have an idea for a better design?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is we need a common place to have a service registry that all servers and cmd center can access. In some other implementations the command center holds the registry, the microservices register themselves giving the cmd their host and port, and the cmd adds this to its service registry. This way the microservices can change their locations and just register themselves every time they are initialized.

Comment thread tools/start_all_tmux.sh
unset SECURE_HOST
fi

declare -a commandcenter=("CMD" "$(pwd)/../lucida/commandcenter/")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know what declare does, can you enlighten me?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the declare allows you to declare and initialize an array by specifying the list of elements (separated by white space) rather than initializing each element of an array separately

./DIGServer

start_test:
gnome-terminal -x bash -c "./run-test.sh $(filter-out $@,$(MAKECMDGOALS)); read -n1"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be disp BD0 layed to describe this comment to others. Learn more.

if you're removing all gnome-terminals, why not get rid of this one too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There currently isn't a automated way to test all of the servers so when someone wants to run tests they have to go to each individual microservice folder and run start_test. In this situation it may be necessary to have a new terminal open as it won't be necessary to keep it running after the test has been run unlike a server.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point but I think in that case there should be a better way to test. can you open an issue about moving start_test as unittest, similar to what we do internally? Look at the infrastructure we use

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I created an issue. In the meantime let me look into our internal infrastructure.

Comment thread Makefile
@@ -19,3 +19,9 @@ local:

start_all:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these other make targets still relevant? In adding your features, are there any cleanups you can make that would make it easier to understand what you're adding?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think about that across your PR. I know the make targets are defined one way, unclear whether its the best way

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You see this comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove start_all since start_all_tmux replaces that. As far as the way make targets are defined, they are defined in a consistent way across all services which makes it easy to loop through all services and start them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once the PR is merged I will be sure to update the wikis/README to show the new way to start all servers (both with and without ASR).

Comment thread tools/start_all_tmux.sh
@@ -0,0 +1,71 @@
#!/bin/bash
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

Comment thread tools/start_all_tmux.sh Outdated
facerecognition)

# Create the session
tmux new-session -s ${SESSION_NAME} -n vim -d
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tmux is an okay way of doing this, have you thought/investigated other ways of deploying/running web services? I know about supervisord. What else is out there?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@saijel you get a chance to think about this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've gotten as far seeing different options out there. This article has a good comparison of different options (http://centos-vn.blogspot.com/2014/06/daemon-showdown-upstart-vs-runit-vs.html). I'll need to do more research about what would be best for our situation.

@jhauswald
Copy link
Copy Markdown
Contributor

I still need to test all this out but there are some discussion points as well

@jhauswald
Copy link
Copy Markdown
Contributor

After testing:

  • what's the first vim window for?
  • can you add a check if I already have a window named lucida?
  • can you add a check to not nest tmux sessions if i'm already in tmux? This is generally bad practice.
  • how do i got about adding a new service? is that automatic or do I need to edit the bash script everytime? Is this related to your registry idea?

@saijel
saijel commented Apr 24, 2017 via email
Copy link
Copy Markdown
Contributor Author

@saijel saijel closed this Apr 26, 2017
@saijel saijel reopened this Apr 26, 2017
@saijel
saijel requested a review from jhauswald April 26, 2017 01:48
@jhauswald
jhauswald commented Apr 27, 2017 •
Copy link
Copy Markdown
Contributor

Went through all your responses, yes I would remove the development window from tmux. Agreed on everything else.

Comment thread tools/start_all_tmux.sh
# use the following command:
# $tmux a -t lucida

SESSION_NAME="lucida"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where's the check to see if you're already in a tmux session? What if I'm in a tmux session that is not called lucida?

@jhauswald
Copy link
Copy Markdown
Contributor

Also what about the fixes that you have? can you make a quick MR for those?

Comment thread tools/start_all_tmux.sh Outdated
facerecognition)

# First window (0) -- vim
tmux send-keys -t ${SESSION_NAME} 'vim' C-m
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you still generating a vim window? I don't think there's much use...

Comment thread tools/start_all_tmux.sh
echo "Session ${SESSION_NAME} already exists."
exit 0;
elif [ -n "$TMUX" ]; then
echo "Already in a tmux session"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@saijel saijel left a comment
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhauswald removing the first vim window

@jhauswald
jhauswald merged commit d32ddd4 into claritylab:fixes May 5, 2017
jhauswald added a commit that referenced this pull request May 5, 2017
@saijel saijel mentioned this pull request May 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0