Browse Source

[fifteen5] Clean up logs in the role

Colin Powell 3 years ago
parent
commit
0647d144b4

+ 7 - 0
ansible/roles/fifteen5/files/celery-supervisor.conf

@@ -0,0 +1,7 @@
+[program:celery]
+command=/usr/local/bin/bash -lc "direnv exec /usr/local/src/fifteen5 celery -A ff -B -l DEBUG -S django -Q test1,celery"
+autostart=true
+autorestart=true
+stdout_logfile=/var/log/celery.log
+stderr_logfile=/var/log/celery.log
+stopsignal=QUIT

+ 2 - 2
ansible/roles/fifteen5/files/fifteen5-supervisor.conf

@@ -2,6 +2,6 @@
 command=/usr/local/bin/bash -lc "direnv exec /usr/local/src/fifteen5 python /usr/local/src/fifteen5/manage.py runserver_plus 0.0.0.0:8000"
 autostart=true
 autorestart=true
-stdout_logfile=/var/log/supervisor-fifteen5.log
-stderr_logfile=/var/log/supervisor-fifteen5.err.log
+stdout_logfile=/var/log/fifteen5.log
+stderr_logfile=/var/log/fifteen5.log
 stopsignal=QUIT

+ 2 - 2
ansible/roles/fifteen5/files/fifteen5-fe-supervisor.conf → ansible/roles/fifteen5/files/fifteen5-yarn-supervisor.conf

@@ -3,6 +3,6 @@ command=/usr/local/bin/bash -lc "direnv exec /usr/local/src/fifteen5 yarn serve"
 directory=/usr/local/src/fifteen5
 autostart=true
 autorestart=true
-stdout_logfile=/var/log/supervisor-fifteen5-yarn.log
-stderr_logfile=/var/log/supervisor-fifteen5-yarn-err.log
+stdout_logfile=/var/log/fifteen5-fe.log
+stderr_logfile=/var/log/fifteen5-fe.log
 stopsignal=QUIT

+ 0 - 1
ansible/roles/fifteen5/files/stignore

@@ -18,6 +18,5 @@ index.html
 junitresults.xml
 generatedJUnitFiles/**
 .mypy_cache/**
-.git/*
 collected-static/**
 ff/static/dist/**

+ 0 - 5
ansible/roles/fifteen5/handlers/main.yml

@@ -4,11 +4,6 @@
     name: supervisord
     state: restarted
 
-- name: Redis restarted
-  service:
-    name: redis
-    state: restarted
-
 - name: Nginx restarted
   service:
     name: nginx

+ 16 - 15
ansible/roles/fifteen5/tasks/main.yml

@@ -2,15 +2,9 @@
 - name: Dependencies installed
   # We install xmlsec and cairocffi using pkg because python-Levenshtein is tricky to install on FreeBSD
   community.general.pkgng:
-    name: git,py37-pip,vim-console,tmux,fish,direnv,jpeg-turbo,tiff,webp,lcms2,freetype2,syncthing,yarn-node14,redis,cairo,pango,gmake,libxml2,libxslt,postgresql12-client,py37-xmlsec,py37-cairocffi,py37-sqlite3
+    name: git,py38-pip,fish,direnv,jpeg-turbo,tiff,webp,lcms2,freetype2,syncthing,yarn-node14,cairo,pango,gmake,libxml2,libxslt,postgresql12-client,py38-xmlsec,py38-cairocffi,py38-sqlite3,bash
     state: latest
 
-- name: Redis enabled
-  shell: sysrc redis_enable="YES"
-
-- name: Redis started
-  service: name=redis state=started
-
 - name: Root shell is fish
   ansible.builtin.user: name=root shell=/usr/local/bin/fish
 
@@ -64,7 +58,7 @@
 
 - name: Create python bin link for yarn
   file:
-    src: /usr/local/bin/python3.7
+    src: /usr/local/bin/python3.8
     dest: /usr/bin/python
     owner: root
     state: link
@@ -127,31 +121,38 @@
     executable: pip
   tags:
     - deploy
-  notify: Redis restarted
 
 - name: 15Five migrations up to date
-  command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.7 /usr/local/src/fifteen5/manage.py migrate"
+  command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 /usr/local/src/fifteen5/manage.py migrate"
   tags:
     - deploy
 
 - name: 15Five BE supervisor file installed
   copy:
     src: fifteen5-supervisor.conf
-    dest: /usr/local/etc/supervisor/conf.d/
+    dest: /usr/local/etc/supervisor/conf.d/fifteen5.conf
     owner: root
     mode: 0644
   notify: Supervisor restarted
 
 - name: 15Five FE supervisor file installed
   copy:
-    src: fifteen5-fe-supervisor.conf
-    dest: /usr/local/etc/supervisor/conf.d/
+    src: fifteen5-yarn-supervisor.conf
+    dest: /usr/local/etc/supervisor/conf.d/fifteen5-yarn.conf
+    owner: root
+    mode: 0644
+  notify: Supervisor restarted
+
+- name: 15Five celery supervisor file installed
+  copy:
+    src: celery-supervisor.conf
+    dest: /usr/local/etc/supervisor/conf.d/celery.conf
     owner: root
     mode: 0644
   notify: Supervisor restarted
 
 - name: 15Five frontend files generated and copied
-  command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn && direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn build && direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.7 manage.py collectstatic --no-input"
+  command: bash -lc "direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn && direnv exec /usr/local/src/fifteen5 /usr/local/bin/yarn build && direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 manage.py collectstatic --no-input"
   args:
     chdir: "/usr/local/src/fifteen5"
   tags:
@@ -159,7 +160,7 @@
     - never
 
 - name: 15Five reset database
-  command: bash -lc "RESET_DB=True direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.7 /usr/local/src/fifteen5/manage.py run_local_scripts && direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.7 /usr/local/src/fifteen5/manage.py clearsessions"
+  command: bash -lc "RESET_DB=True direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 /usr/local/src/fifteen5/manage.py run_local_scripts && direnv exec /usr/local/src/fifteen5 /usr/local/bin/python3.8 /usr/local/src/fifteen5/manage.py clearsessions"
   tags:
     - db-refresh
     - never

+ 16 - 7
ansible/roles/fifteen5/templates/envrc.j2

@@ -2,36 +2,36 @@ export PYTHONPATH=`pwd`
 export PYTEST_ADDOPTS='-rs --durations=10 --reuse-db --isort --flake8'
 export DJANGO_SETTINGS_MODULE=ff.settings.dev.colin
 export FF_LOCAL_DOMAIN=five.unbl.ink
-
-export FF_EXTRA_LOCAL_SCRIPTS_TO_RUN="
-ff.mods.report.company_templates.shackleton_expedition_company
-"
+export CELERY_TASK_ALWAYS_EAGER=False
 
 export FF_LOG_FILE_PATH=/var/log/
 export FF_LOG_LEVEL=DEBUG
 export FF_LOG_SQL=False
 export FF_JSON_LOGGING=True
-export FF_BACKEND_SENTRY_DSN="https://ee742b3c0b2f451e8e0de99597a8ced0@sentry.unbl.ink/2"
+#export FF_BACKEND_SENTRY_DSN="https://ee742b3c0b2f451e8e0de99597a8ced0@sentry.unbl.ink/2"
 
+export FF_AWS_S3=True
 export FF_AWS_ACCESS_KEY_ID='minioadmin'
 export FF_AWS_SECRET_ACCESS_KEY='minioadmin'
 export FF_AWS_STORAGE_BUCKET_NAME_PUBLIC='fifteen5'
 export FF_AWS_STORAGE_BUCKET_NAME_PRIVATE='fifteen5'
-export FF_AWS_ENDPOINT_URL='http://minio.local:9000/'
+export FF_AWS_ENDPOINT_URL='http://s3.unbl.ink'
 
 export FF_DB_NAME=fifteen5
 export FF_DB_USER=fifteenfive
 export FF_DB_PASSWORD={{fifteenfive_db_pass}}
 export FF_DB_HOST=db.unbl.ink
 export FF_DB_PORT=5432
+
 export FF_EMAIL_BACKEND='django.core.mail.backends.smtp.EmailBackend'
 export FF_EMAIL_HOST='mailhog.unbl.ink'
 export FF_EMAIL_PORT=1025
 export FF_SECRET_KEY={{fifteenfive_secret_key}}
 export FF_DEBUG_TOOLBAR=True
-export FF_REDIS_LOCATION=redis://127.0.0.1:6379/
+export FF_REDIS_LOCATION=redis://:{{redis_password}}@cache.unbl.ink/
 
 export FF_SFTP_FORWARDER_SECRET=notasecret
+export FF_SFTP_ALLOW_DUPLICATE_FILES=True
 
 export FF_AWS_STORAGE_BUCKET_NAME_PUBLIC=local
 export FF_AWS_STORAGE_BUCKET_NAME_PRIVATE=local
@@ -57,3 +57,12 @@ export FF_NAMELY_OAUTH_CLIENT_SECRET={{fifteenfive_namely_oauth_client_secret}}
 
 export FF_RECURLY_PUBLIC_KEY='ewr1-zvYK71QQsAfdOm8ydeguAU'
 export FF_RECURLY_API_KEY={{fifteenfive_recurly_api_key}}
+
+export FF_ZUORA_CLIENT_ID={{fifteenfive_zuora_client_id}}
+export FF_ZUORA_CLIENT_SECRET={{fifteenfive_zuora_client_secret}}
+export FF_ZUORA_PAYMENT_PAGE_ID={{fifteenfive_zuora_payment_page_id}}
+export FF_ZUORA_PORTAL_SSO_SECRET_KEY={{fifteenfive_zuora_sso_secret_key}}
+
+export FF_NEXT_COMPANY_ID=130000
+
+export FF_ELASTICSEARCH_HOST=elastic.local