From a6d3e28cf3389aaf3b02ef1948eb7861b0568ff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eudes=20In=C3=A1cio?= Date: Thu, 2 Jun 2022 09:09:45 +0100 Subject: [PATCH 01/13] Remove settime on grupo message page --- src/app/shared/chat/group-messages/group-messages.page.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/shared/chat/group-messages/group-messages.page.ts b/src/app/shared/chat/group-messages/group-messages.page.ts index 337d38c30..5403fe7e0 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.ts +++ b/src/app/shared/chat/group-messages/group-messages.page.ts @@ -161,9 +161,9 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe ngOnInit() { console.log(this.roomId) this.loggedUser = this.loggedUserChat; - setTimeout(() => { + //setTimeout(() => { this.getRoomInfo(); - }, 1000); + //}, 1000); this.getChatMembers(); //this.getMessageDB(); From c707e357a3cc03bc40bae9ebea3be985ae516e90 Mon Sep 17 00:00:00 2001 From: Evandre Da Silva Date: Thu, 2 Jun 2022 16:11:57 +0100 Subject: [PATCH 02/13] add docker suport and pipeline --- .dockerignore | 25 +++++++++++++ bitbucket-pipelines.yml | 48 +++++++++++-------------- dockerfile | 77 ++++++----------------------------------- 3 files changed, 56 insertions(+), 94 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..c4b1a684d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/www +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 1bcdb73bc..91150a6fb 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,31 +1,23 @@ -image: node:14.15.0 - pipelines: branches: - '{master,test}': - # - step: - # caches: - # - node - # script: - # - apt-get update; apt-get install -y gettext-base; - # - echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/chrome.list - # - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - # - set -x && apt-get update && apt-get install -y xvfb google-chrome-stable - # - wget -q -O /usr/bin/xvfb-chrome https://bitbucket.org/atlassian/docker-node-chrome-firefox/raw/ff180e2f16ea8639d4ca4a3abb0017ee23c2836c/scripts/xvfb-chrome - # - ln -sf /usr/bin/xvfb-chrome /usr/bin/google-chrome - # - chmod 755 /usr/bin/google-chrome - # - npm ci - # - npm install - # - ./node_modules/@angular/cli/bin/ng -v - # - npm run test + developer: + - step: + name: 'Build Images and push to Docker hub' + script: + - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) + - export IMAGE_NAME=gabinetedigital/gdsite:$BITBUCKET_COMMIT_SHORT + - docker build -t $IMAGE_NAME -f . + - docker login --username $DOCKER_USER --password $DOCKER_PASS + - docker push $IMAGE_NAME + - step: + name: 'Deploy on server' + script: + - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) + - pipe: atlassian/ssh-run:0.4.0 + variables: + SSH_USER: 'administrator' + SERVER: '41.63.166.54' + COMMAND: 'export GDOS_VERSION=${BITBUCKET_COMMIT_SHORT};cd ${COMPOSE_FOLDER} ; docker-compose up -d gdsite' - - step: - caches: - - node - script: - - apt-get update; - - npm ci - - npm install - - ./node_modules/@angular/cli/bin/ng -v - - npm run build --prod - \ No newline at end of file +options: + docker: true \ No newline at end of file diff --git a/dockerfile b/dockerfile index fbee3b3f6..673ea1483 100644 --- a/dockerfile +++ b/dockerfile @@ -1,68 +1,13 @@ -# # Stage 1: Compile and Build angular codebase - - - -# # Use official node image as the base image - -FROM node:14.15.0 as build - -# # Set up ENV - -ENV NODE_ENV=production - -# Set the working directory - -WORKDIR /usr/local/app - - - - - - -# # Install all the dependencies - +FROM node:14 as build +WORKDIR /app +COPY ./package*.json /app/ RUN npm config set unsafe-perm true +RUN npm install -g ionic +RUN npm config set legacy-peer-deps true +RUN npm install --save --legacy-peer-deps +COPY ./ /app/ +RUN ionic build -RUN npm ci - -RUN npm audit fix - -RUN npm install -g @ionic/cli - -RUN npm install -g @angular/cli - -RUN npm install -g cordova - -RUN npm install -g cordova-res - -# # # Generate the build of the application - -RUN ionic build --prod - -# # Add the source code to app - -COPY ./www /usr/local/app/ - - - -# # Stage 2: Serve app with nginx server - - - -# # Use official nginx image as the base image - -# FROM nginx:latest - - - -# Copy the build output to replace the default nginx contents. - -#COPY ./www/ /usr/share/nginx/html/ - - - -# Expose port 80 - -# EXPOSE 80 - -#CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file +FROM nginx:alpine +RUN rm -rf /usr/share/nginx/html/* +COPY --from=build /app/www/ /usr/share/nginx/html/ \ No newline at end of file From c64fe0dec1103705b0a208ce7e985b75937c7580 Mon Sep 17 00:00:00 2001 From: Evandre Da Silva Date: Thu, 2 Jun 2022 16:13:42 +0100 Subject: [PATCH 03/13] fixe pipeline error on docker build --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 91150a6fb..871fdfb74 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -6,7 +6,7 @@ pipelines: script: - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) - export IMAGE_NAME=gabinetedigital/gdsite:$BITBUCKET_COMMIT_SHORT - - docker build -t $IMAGE_NAME -f . + - docker build -t $IMAGE_NAME . - docker login --username $DOCKER_USER --password $DOCKER_PASS - docker push $IMAGE_NAME - step: From d631ca6c61dc8b19f2b7f09c04dd804f03ff7bf4 Mon Sep 17 00:00:00 2001 From: Evandre Da Silva Date: Thu, 2 Jun 2022 16:49:26 +0100 Subject: [PATCH 04/13] save --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 871fdfb74..da83be78e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -17,7 +17,7 @@ pipelines: variables: SSH_USER: 'administrator' SERVER: '41.63.166.54' - COMMAND: 'export GDOS_VERSION=${BITBUCKET_COMMIT_SHORT};cd ${COMPOSE_FOLDER} ; docker-compose up -d gdsite' + COMMAND: 'export GDSITE_VERSION=${BITBUCKET_COMMIT_SHORT};cd ${COMPOSE_FOLDER} ; docker-compose up -d gdsite' options: docker: true \ No newline at end of file From cc080105f6435c785e4f8280ddc2c496818f7c10 Mon Sep 17 00:00:00 2001 From: Evandre Da Silva Date: Thu, 2 Jun 2022 16:51:52 +0100 Subject: [PATCH 05/13] add prod flag on build --- dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile b/dockerfile index 673ea1483..2fadfdb98 100644 --- a/dockerfile +++ b/dockerfile @@ -6,7 +6,7 @@ RUN npm install -g ionic RUN npm config set legacy-peer-deps true RUN npm install --save --legacy-peer-deps COPY ./ /app/ -RUN ionic build +RUN ionic build --prod FROM nginx:alpine RUN rm -rf /usr/share/nginx/html/* From e64aa5a212d45dd10a27cb56591f0c6a3105f097 Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:00:57 +0100 Subject: [PATCH 06/13] increase docker service memmory --- bitbucket-pipelines.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index da83be78e..557591c4d 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,3 +1,7 @@ +definitions: + services: + docker: + memory: 2048 pipelines: branches: developer: @@ -9,7 +13,7 @@ pipelines: - docker build -t $IMAGE_NAME . - docker login --username $DOCKER_USER --password $DOCKER_PASS - docker push $IMAGE_NAME - - step: + - step: name: 'Deploy on server' script: - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) @@ -17,7 +21,7 @@ pipelines: variables: SSH_USER: 'administrator' SERVER: '41.63.166.54' - COMMAND: 'export GDSITE_VERSION=${BITBUCKET_COMMIT_SHORT};cd ${COMPOSE_FOLDER} ; docker-compose up -d gdsite' + COMMAND: 'export GDSITE_VERSION=${BITBUCKET_COMMIT_SHORT};cd ${COMPOSE_FOLDER} ; docker-compose up -d gdsite' options: - docker: true \ No newline at end of file + docker: true From c7d59a5d41765e51ba8f23d18ea7733c2096bd7c Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:33:44 +0100 Subject: [PATCH 07/13] increase docker service memmory 512 --- bitbucket-pipelines.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 557591c4d..31a30d22b 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,12 +1,14 @@ definitions: services: docker: - memory: 2048 + memory: 512 pipelines: branches: developer: - step: name: 'Build Images and push to Docker hub' + caches: + - node script: - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) - export IMAGE_NAME=gabinetedigital/gdsite:$BITBUCKET_COMMIT_SHORT From 68ee1b161e615c98f5b7ab18ee6216fcb2c2e3f7 Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 09:36:21 +0100 Subject: [PATCH 08/13] add cache for docker --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 31a30d22b..14e2a0b5e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -8,7 +8,7 @@ pipelines: - step: name: 'Build Images and push to Docker hub' caches: - - node + - docker script: - export BITBUCKET_COMMIT_SHORT=$(echo $BITBUCKET_COMMIT| cut -c1-7) - export IMAGE_NAME=gabinetedigital/gdsite:$BITBUCKET_COMMIT_SHORT From fa94f78171863ad13ef9705548ab18337119d147 Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 10:20:37 +0100 Subject: [PATCH 09/13] increase docker service memmory 4096 --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 14e2a0b5e..049e35bd4 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,7 +1,7 @@ definitions: services: docker: - memory: 512 + memory: 4096 pipelines: branches: developer: From 75862a1be15211989038bfd4b30745e47b179ebc Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 10:25:30 +0100 Subject: [PATCH 10/13] increase docker service memmory 832 --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 049e35bd4..5a88f726e 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,7 +1,7 @@ definitions: services: docker: - memory: 4096 + memory: 832 pipelines: branches: developer: From 61beb4dc33834be042d635f419e2a53546e12e68 Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 10:44:23 +0100 Subject: [PATCH 11/13] increase docker service memmory 2048 --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 5a88f726e..fd7b526d3 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,7 +1,7 @@ definitions: services: docker: - memory: 832 + memory: 2048 pipelines: branches: developer: From 30d8a2c46f3ee9868c086ff93a4a4ca1174c6ed8 Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 11:06:52 +0100 Subject: [PATCH 12/13] increase docker service memmory 3072 --- bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index fd7b526d3..487b03e1c 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -1,7 +1,7 @@ definitions: services: docker: - memory: 2048 + memory: 3072 pipelines: branches: developer: From c6a1eae8b1a3586fbf2c1537933ee2b9bf8bf0f4 Mon Sep 17 00:00:00 2001 From: Evandre Silva <47608734+evandresilva@users.noreply.github.com> Date: Fri, 3 Jun 2022 11:24:57 +0100 Subject: [PATCH 13/13] add size 2x to step >deploy --- bitbucket-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index 487b03e1c..4ff433c5d 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -6,6 +6,7 @@ pipelines: branches: developer: - step: + size: 2x name: 'Build Images and push to Docker hub' caches: - docker