Ver Fonte

Add engagement role

Colin Powell há 2 anos atrás
pai
commit
5f49f8d620

+ 7 - 0
ansible/roles/engagement/files/profile

@@ -0,0 +1,7 @@
+export NVM_DIR="$HOME/.nvm"
+[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
+
+export NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release
+export NVM_IOJS_ORG_MIRROR=https://example.com
+
+nvm_get_arch() { nvm_echo "x64-musl"; }

+ 70 - 0
ansible/roles/engagement/tasks/main.yml

@@ -0,0 +1,70 @@
+---
+- name: Dependencies installed
+  community.general.apk:
+    name: git-tiny,npm,pkgconf,glib
+    state: latest
+
+- name: Source folder exists
+  file:
+    path: /usr/local/src
+    mode: 0755
+    state: directory
+
+- name: Github SSH key installed
+  template:
+    src: sshkey.j2
+    dest: /root/.ssh/id_ed25519
+    mode: 0400
+
+- name: 15Five source deployed
+  git:
+    repo: "git@github.com:15five/engagement.git"
+    dest: /usr/local/src/engagement
+    accept_hostkey: yes
+    update: yes
+  ignore_errors: true
+
+- name: Syncthing ignore file installed
+  copy:
+    src: stignore
+    dest: /usr/local/src/engagement/.stignore
+    mode: 0775
+
+- name: Environment file installed
+  template:
+    src: env.j2
+    dest: /root/.bashrc
+    mode: 0600
+
+- name: Fetched libvips source
+  shell:
+    chdir: /usr/local/src
+    cmd: fetch https://github.com/libvips/libvips/releases/download/v8.12.2/vips-8.12.2.tar.gz
+
+- name: Unpacked libvips source
+  shell:
+    chdir: /usr/local/src
+    cmd: tar zxvf vips-8.12.2.tar.gz
+
+- name: libvips built and installed
+  shell:
+    chdir: /usr/local/src/libvips-8.12.2
+    cmd: "./configure & make & make install"
+
+- name: Lerna and dependencies installed
+  shell:
+    chdir: /usr/local/src/engagement
+    cmd: "npm install -g lerna sequelize sequelize-cli@2.6.0 pg && lerna bootstrap"
+
+- name: Run migrations
+  shell:
+    chdir: /usr/local/src/engagement/db/emplify
+    cmd: "source /root/.bashrc && sequelize db:migrate"
+
+- name: Run migrations
+  shell:
+    chdir: /usr/local/src/engagement/db/emplify
+    cmd: "source /root/.bashrc && sequelize db:migrate"
+
+- name: SSH restarted
+  service: name=sshd state=restarted

+ 32 - 0
ansible/roles/engagement/templates/bashrc.j2

@@ -0,0 +1,32 @@
+# You will also have to set a local.environments.js file     in the './clients/kick' folder.  This file can be copie    d from local.environment.js.template.
+export API_URL="http://0.0.0.0:3021"
+export BCC_EMAIL=
+export BULK_EMPLOYEE_IMPORT_BUCKET=employee-import
+export DB_HOST_REPLICA=db.unbl.ink
+export # DISABLE_MESSAGE_SENDING=true
+export DISABLE_SEQUELIZE_LOGGING=false
+export DYNAMO_DB_ENDPOINT="http://0.0.0.0:8087"
+export EMAIL_WHITELIST=["firstname\\.lastname(\\+[^@]+)?@15five    \\.com"]
+export ENVIRONMENT=dev
+export FETCH_TIMEOUT=60
+export LOCAL_QUEUE_SERVICE=localhost
+export LOG_LEVEL=trace
+export ORGANIZATION_FILES_BUCKET=org-files
+export BULK_EMPLOYEE_IMPORT_BUCKET=bulk-employee-import
+export PROFILE_PHOTOS_BUCKET=profile-photos
+export POLLING_FREQUENCY=10000
+export REDIS_HOST=redis://:{{redis_pass}}@cache.unbl.ink
+export S3_HOST="http://s3.unbl.ink"
+export SURVEYS_URL="http://0.0.0.0:3002"
+
+
+export API_PORT=3021
+export SURVEY_PORT=3002
+export DB_HOST=db.service
+export DB_USER=engagement
+export DB_NAME=engagement
+export DB_PORT=5432
+export DB_PASSWORD={{engagement_db_pass}}
+export POLLING_FREQUENCY=10000
+export AWS_ACCESS_KEY_ID=engagement
+export AWS_SECRET_ACCESS_KEY={{engagement_s3_secret_key}}