-
Notifications
You must be signed in to change notification settings - Fork 3
Devops task #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Devops task #1
Conversation
|
|
||
| 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 |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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 .
task2/scripts/builder.sh
Outdated
|
|
||
| if docker_tag_exists $DOCKER_IMAGE $DOCKER_IMAGE_VERSION; then | ||
| echo $DOCKER_IMAGE $DOCKER_IMAGE_VERSION exist | ||
| echo "3" |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 !
task2/scripts/builder.sh
Outdated
| exit 1 | ||
| fi | ||
|
|
||
| MY_DOCKER_RANDOM_NAME=myapp$RANDOM |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
task4/APP/ansible.yaml
Outdated
| tasks: | ||
| - name: mvn build | ||
| command: sh build.sh | ||
| - name: git clone repo |
There was a problem hiding this comment.
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
task2/scripts/builder.sh
Outdated
| CONTAINER_STATUS=$(docker inspect -f {{.State.Running}} $MY_DOCKER_ID) | ||
|
|
||
|
|
||
| if [ $CONTAINER_STATUS = "true" ]; then |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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
No description provided.