Devops task#1
Devops task#1saifal-nuaimi wants to merge 18 commits intoumomany:masterfrom saifal-nuaimi:devops-task
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.
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.
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.
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.
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.
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.
where is the RANDOM variable is getting initialized ?
| services: | ||
|
|
||
| #-----------------web app----------------- | ||
| webapp: |
There was a problem hiding this comment.
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.
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.
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.
should be on the port existing (opening) only
No description provided.