Skip to content

Conversation

@saifal-nuaimi
Copy link

No description provided.

@halradaideh halradaideh reopened this Mar 2, 2020
@halradaideh halradaideh self-requested a review March 2, 2020 11:46

I started with my hello world web app then how to get the count of the visitors for my web app then get the ip address.

Now I start to config the mongo database to get requests but i could not do that by my self honestly I asked a friend
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you don't feel comfortable with Java, you can use easier language like Python or NodeJS.

private User getUpdatedUserInfo(String remoteAddr) {
Optional<User> current = mongoRepository.findById(remoteAddr);
User user = new User(remoteAddr, 1);
current.ifPresent(u -> user.setCount(u.getCount() + 1));
Copy link
Collaborator

Choose a reason for hiding this comment

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

the count of the users should be in a caching components, ex : Redis
not in the DataBase, please read the task carefully


Task 1:

First of all I created a pom file dependency file that has all of the dependency i need (web app, mongo database , health checker)
Copy link
Collaborator

Choose a reason for hiding this comment

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

please provide this document with proper steps to how-to run everything.

example:

to start up the docker-compose run the following command:
$ docker-compose up .


if docker_tag_exists $DOCKER_IMAGE $DOCKER_IMAGE_VERSION; then
echo $DOCKER_IMAGE $DOCKER_IMAGE_VERSION exist
echo "3"
Copy link
Collaborator

Choose a reason for hiding this comment

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

the script should exit with this as exit status code, not to print it

}
if build_docker_image; then
echo "Building your image"
build_docker_image
Copy link
Collaborator

Choose a reason for hiding this comment

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

this will build the image twice !

exit 1
fi

MY_DOCKER_RANDOM_NAME=myapp$RANDOM
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is the RANDOM variable is getting initialized ?

services:

#-----------------web app-----------------
webapp:
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to build the app again, you should pull it from the docker-registry from the build in the last task

tasks:
- name: mvn build
command: sh build.sh
- name: git clone repo
Copy link
Collaborator

Choose a reason for hiding this comment

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

there are modules for everything in Ansible

ex : https://docs.ansible.com/ansible/latest/modules/git_module.html

CONTAINER_STATUS=$(docker inspect -f {{.State.Running}} $MY_DOCKER_ID)


if [ $CONTAINER_STATUS = "true" ]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

you should use the /actuator/health test to make sure the app is working fine

- name: http
containerPort: {{ .Values.service.internalPort }}
protocol: TCP
livenessProbe:
Copy link
Collaborator

Choose a reason for hiding this comment

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

should be on the port existing (opening) only

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.

3 participants