Queer European MD passionate about IT
Преглед на файлове

Merge branch 'master' of Davte/micheles-website into master

Davte преди 5 години
родител
ревизия
a737052185
променени са 3 файла, в които са добавени 24 реда и са изтрити 7 реда
  1. 4 5
      dynamic/app.py
  2. 18 0
      dynamic/update_image_editor.sh
  3. 2 2
      dynamic/website.service

+ 4 - 5
dynamic/app.py

@@ -8,13 +8,12 @@ import os
 
 # Third party modules
 from aiohttp import web
-# from davtelepot import Bot
 
 # Project modules
 from data.config import (
     log_file_name, errors_file_name, app_host, app_port
 )
-# from data.passwords import bot_token
+from data.passwords import pull_token
 
 path = os.path.dirname(__file__)
 log_file = "{}/data/{}".format(path, log_file_name)
@@ -82,12 +81,12 @@ async def test(request):
     return str(datetime.datetime.now())
 
 
-@page('/pull/image-editor/nZ7Vgm9SSg4vNBy3ytG')
+@page('/pull/t/image-editor'.format(t=pull_token))
 async def pull_image_editor_project(request):
     """Git pull at request."""
     try:
         _subprocess = await asyncio.create_subprocess_shell(
-            'bash {path}/pull_image_editor.sh'.format(
+            'bash {path}/update_image_editor.sh'.format(
                 path=path
             )
         )
@@ -103,7 +102,7 @@ async def pull_image_editor_project(request):
     return web.Response(
         status=302,
         headers={
-            'location': 'https://www.davte.it/michele/image-editor/src/',
+            'location': 'https://michele.davte.it/image-editor/',
         },
     )
 

+ 18 - 0
dynamic/update_image_editor.sh

@@ -0,0 +1,18 @@
+# Get current directory
+this_script_directory=$(cd `dirname $0` && pwd);
+project_directory=$(dirname "$this_script_directory")
+
+log_file="$this_script_directory/data/log.txt";
+separator="*****"
+
+echo "$separator $(date '+%Y-%d-%m %H:%M:%S') - update image-editor begins ... $separator" >> "$log_file";
+# Update git submodules merging remote version into local one
+git submodule update --remote --merge &>> "$log_file";
+
+# Delete the outdated folder
+rm -r "$project_directory/static/image-editor" &>> "$log_file";
+
+# Copy the updated folder
+cp -r "$project_directory/image-editor/src" "$project_directory/static/image-editor" &>> "$log_file";
+
+echo "$separator ... update image-editor ends $separator" >> "$log_file";

+ 2 - 2
dynamic/website.service

@@ -2,10 +2,10 @@
 Description=website
 
 [Service]
-WorkingDirectory=/home/michele/dynamic_site/
+WorkingDirectory=/home/michele/personal-website/
 Restart=always
 RestartSec=30
-ExecStart=/home/michele/dynamic_site/run_me.sh
+ExecStart=run_me.sh
 
 [Install]
 WantedBy=default.target