mirror of
				https://github.com/kevinveenbirkenbach/computer-playbook.git
				synced 2025-11-04 12:18:17 +00:00 
			
		
		
		
	Updated backup procedure for matrix and deactivated plugin chatgpt and slack
This commit is contained in:
		@@ -96,9 +96,17 @@
 | 
			
		||||
    dest: "{{docker_compose_instance_directory}}docker-compose.yml"
 | 
			
		||||
  notify: docker compose project setup
 | 
			
		||||
 | 
			
		||||
# Pull image when update is wished. 
 | 
			
		||||
# @todo This should be moved to update-docker
 | 
			
		||||
- name: docker compose pull
 | 
			
		||||
  command:
 | 
			
		||||
    cmd: docker-compose -p "{{docker_compose_project_name}}" pull
 | 
			
		||||
    chdir: "{{docker_compose_instance_directory}}"
 | 
			
		||||
  when: mode_update | bool
 | 
			
		||||
 | 
			
		||||
- name: docker compose project setup
 | 
			
		||||
  command:
 | 
			
		||||
    cmd: docker-compose -p "{{docker_compose_project_name}}" up -d --force-recreate
 | 
			
		||||
    cmd: docker-compose -p "{{docker_compose_project_name}}" up -d
 | 
			
		||||
    chdir: "{{docker_compose_instance_directory}}"
 | 
			
		||||
  environment:
 | 
			
		||||
    COMPOSE_HTTP_TIMEOUT:   600
 | 
			
		||||
 
 | 
			
		||||
@@ -61,49 +61,50 @@ services:
 | 
			
		||||
      retries: 3
 | 
			
		||||
{% include 'templates/docker/container/networks.yml.j2' %}
 | 
			
		||||
{% endfor %}
 | 
			
		||||
 | 
			
		||||
  matrix-chatgpt-bot:
 | 
			
		||||
    restart: {{docker_restart_policy}}
 | 
			
		||||
    container_name: matrix-chatgpt
 | 
			
		||||
    image: ghcr.io/matrixgpt/matrix-chatgpt-bot:latest
 | 
			
		||||
    volumes:
 | 
			
		||||
      - chatgpt_data:/storage
 | 
			
		||||
    environment:
 | 
			
		||||
      OPENAI_API_KEY: '{{matrix_chatgpt_bridge_openai_api_key}}'
 | 
			
		||||
      # Uncomment the next two lines if you are using Azure OpenAI API
 | 
			
		||||
      # OPENAI_AZURE: 'false'
 | 
			
		||||
      # CHATGPT_REVERSE_PROXY: 'your-completion-endpoint-here'
 | 
			
		||||
      CHATGPT_CONTEXT: 'thread'
 | 
			
		||||
      CHATGPT_API_MODEL: 'gpt-3.5-turbo'
 | 
			
		||||
      # Uncomment and edit the next line if needed
 | 
			
		||||
      # CHATGPT_PROMPT_PREFIX: 'Instructions:\nYou are ChatGPT, a large language model trained by OpenAI.'
 | 
			
		||||
      # CHATGPT_IGNORE_MEDIA: 'false'
 | 
			
		||||
      CHATGPT_REVERSE_PROXY: 'https://api.openai.com/v1/chat/completions'
 | 
			
		||||
      # Uncomment and edit the next line if needed
 | 
			
		||||
      # CHATGPT_TEMPERATURE: '0.8'
 | 
			
		||||
      # Uncomment and edit the next line if needed
 | 
			
		||||
      # CHATGPT_MAX_CONTEXT_TOKENS: '4097'
 | 
			
		||||
      # CHATGPT_MAX_PROMPT_TOKENS: '3097'
 | 
			
		||||
      KEYV_BACKEND: 'file'
 | 
			
		||||
      KEYV_URL: ''
 | 
			
		||||
      KEYV_BOT_ENCRYPTION: 'false'
 | 
			
		||||
      KEYV_BOT_STORAGE: 'true'
 | 
			
		||||
      MATRIX_HOMESERVER_URL: 'https://{{synapse_domain}}'
 | 
			
		||||
      MATRIX_BOT_USERNAME: '@chatgptbot:{{matrix_server_name}}'
 | 
			
		||||
      MATRIX_ACCESS_TOKEN: '{{ matrix_chatgpt_bridge_access_token | default('') }}'
 | 
			
		||||
      MATRIX_BOT_PASSWORD: '{{matrix_chatgpt_bridge_user_password}}'
 | 
			
		||||
      MATRIX_DEFAULT_PREFIX: '!chatgpt'
 | 
			
		||||
      MATRIX_DEFAULT_PREFIX_REPLY: 'false'
 | 
			
		||||
      #MATRIX_BLACKLIST: ''
 | 
			
		||||
      MATRIX_WHITELIST: ':{{matrix_server_name}}'
 | 
			
		||||
      MATRIX_AUTOJOIN: 'true'
 | 
			
		||||
      MATRIX_ENCRYPTION: 'true'
 | 
			
		||||
      MATRIX_THREADS: 'true'
 | 
			
		||||
      MATRIX_PREFIX_DM: 'false'
 | 
			
		||||
      MATRIX_RICH_TEXT: 'true'
 | 
			
		||||
# Deactivated chatgpt. 
 | 
			
		||||
# @todo needs to be reactivated as soon as bug is found
 | 
			
		||||
#  matrix-chatgpt-bot:
 | 
			
		||||
#    restart: {{docker_restart_policy}}
 | 
			
		||||
#    container_name: matrix-chatgpt
 | 
			
		||||
#    image: ghcr.io/matrixgpt/matrix-chatgpt-bot:latest
 | 
			
		||||
#    volumes:
 | 
			
		||||
#      - chatgpt_data:/storage
 | 
			
		||||
#    environment:
 | 
			
		||||
#      OPENAI_API_KEY: '{{matrix_chatgpt_bridge_openai_api_key}}'
 | 
			
		||||
#      # Uncomment the next two lines if you are using Azure OpenAI API
 | 
			
		||||
#      # OPENAI_AZURE: 'false'
 | 
			
		||||
#      # CHATGPT_REVERSE_PROXY: 'your-completion-endpoint-here'
 | 
			
		||||
#      CHATGPT_CONTEXT: 'thread'
 | 
			
		||||
#      CHATGPT_API_MODEL: 'gpt-3.5-turbo'
 | 
			
		||||
#      # Uncomment and edit the next line if needed
 | 
			
		||||
#      # CHATGPT_PROMPT_PREFIX: 'Instructions:\nYou are ChatGPT, a large language model trained by OpenAI.'
 | 
			
		||||
#      # CHATGPT_IGNORE_MEDIA: 'false'
 | 
			
		||||
#      CHATGPT_REVERSE_PROXY: 'https://api.openai.com/v1/chat/completions'
 | 
			
		||||
#      # Uncomment and edit the next line if needed
 | 
			
		||||
#      # CHATGPT_TEMPERATURE: '0.8'
 | 
			
		||||
#      # Uncomment and edit the next line if needed
 | 
			
		||||
#      #CHATGPT_MAX_CONTEXT_TOKENS: '4097'
 | 
			
		||||
#      CHATGPT_MAX_PROMPT_TOKENS: '3000'
 | 
			
		||||
#      KEYV_BACKEND: 'file'
 | 
			
		||||
#      KEYV_URL: ''
 | 
			
		||||
#      KEYV_BOT_ENCRYPTION: 'false'
 | 
			
		||||
#      KEYV_BOT_STORAGE: 'true'
 | 
			
		||||
#      MATRIX_HOMESERVER_URL: 'https://{{synapse_domain}}'
 | 
			
		||||
#      MATRIX_BOT_USERNAME: '@chatgptbot:{{matrix_server_name}}'
 | 
			
		||||
#      MATRIX_ACCESS_TOKEN: '{{ matrix_chatgpt_bridge_access_token | default('') }}'
 | 
			
		||||
#      MATRIX_BOT_PASSWORD: '{{matrix_chatgpt_bridge_user_password}}'
 | 
			
		||||
#      MATRIX_DEFAULT_PREFIX: '!chatgpt'
 | 
			
		||||
#      MATRIX_DEFAULT_PREFIX_REPLY: 'false'
 | 
			
		||||
#      #MATRIX_BLACKLIST: ''
 | 
			
		||||
#      MATRIX_WHITELIST: ':{{matrix_server_name}}'
 | 
			
		||||
#      MATRIX_AUTOJOIN: 'true'
 | 
			
		||||
#      MATRIX_ENCRYPTION: 'true'
 | 
			
		||||
#      MATRIX_THREADS: 'true'
 | 
			
		||||
#      MATRIX_PREFIX_DM: 'false'
 | 
			
		||||
#      MATRIX_RICH_TEXT: 'true'
 | 
			
		||||
 | 
			
		||||
{% include 'templates/docker/compose/volumes.yml.j2' %}
 | 
			
		||||
  synapse_data:
 | 
			
		||||
  chatgpt_data:
 | 
			
		||||
#  chatgpt_data:
 | 
			
		||||
 | 
			
		||||
{% include 'templates/docker/compose/networks.yml.j2' %}
 | 
			
		||||
@@ -21,10 +21,12 @@ bridges:
 | 
			
		||||
    database_name:      "mautrix_signal_bridge"
 | 
			
		||||
    bridge_name:        "signal"
 | 
			
		||||
 | 
			
		||||
  - database_password:  "{{ mautrix_slack_bridge_database_password }}"
 | 
			
		||||
    database_username:  "mautrix_slack_bridge"
 | 
			
		||||
    database_name:      "mautrix_slack_bridge"
 | 
			
		||||
    bridge_name:        "slack"
 | 
			
		||||
# Deactivated temporary, due to bug which is hard to find 
 | 
			
		||||
# @todo Reactivate 
 | 
			
		||||
#  - database_password:  "{{ mautrix_slack_bridge_database_password }}"
 | 
			
		||||
#    database_username:  "mautrix_slack_bridge"
 | 
			
		||||
#    database_name:      "mautrix_slack_bridge"
 | 
			
		||||
#    bridge_name:        "slack"
 | 
			
		||||
 | 
			
		||||
  - database_password:  "{{ mautrix_facebook_bridge_database_password }}"
 | 
			
		||||
    database_username:  "mautrix_facebook_bridge"
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,6 @@ def update_procedure(command):
 | 
			
		||||
                print("All attempts to update Nextcloud apps have failed.")
 | 
			
		||||
                raise  # Re-raise the last exception after all attempts fail
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def start_docker(directory):
 | 
			
		||||
    if is_any_service_up():
 | 
			
		||||
        print(f"Restarting containers in {directory}.")
 | 
			
		||||
@@ -153,8 +152,11 @@ if __name__ == "__main__":
 | 
			
		||||
                else:
 | 
			
		||||
                    print("Discourse update skipped. No changes in git repository.")
 | 
			
		||||
            if os.path.basename(dir_path) == "matrix":
 | 
			
		||||
                # Just pull docker images, the rest of the logic is executed in the task
 | 
			
		||||
                pull_docker_images()
 | 
			
		||||
                # No autoupdate for matrix is possible atm, 
 | 
			
		||||
                # due to the reason that the role has to be executed every time.
 | 
			
		||||
                # The update has to be executed in the role
 | 
			
		||||
                # @todo implement in future
 | 
			
		||||
                pass
 | 
			
		||||
            else:
 | 
			
		||||
                # Pull and update docker images
 | 
			
		||||
                update_docker(dir_path)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user