Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
33 views

Command - Copy (2)

Uploaded by

nt.anh.fai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Command - Copy (2)

Uploaded by

nt.anh.fai
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Docker N8N

1. Mua VPS (có thể có GPU hoặc không có GPU)

Nếu không có GPU Khá rẻ, mua online tại EZVps.vn

Nếu có GPU Chạy được LLM thuegpu.vn

2. Install Docker on Ubuntu

sudo apt update

sudo apt install -y apt-transport-https ca-certificates curl software-


Lib
properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key


Add GPG Key
add -

Add docker sudo add-apt-repository "deb [arch=amd64]


repo https://download.docker.com/linux/ubuntu focal stable"

apt-cache policy docker-ce

sudo apt install -y docker-ce

Check status sudo systemctl status docker

3. Run n8n on docker

Get image sudo docker pull n8nio/n8n

Check images sudo docker images

curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc \


| sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null \
&& echo "deb
Install Ngrok https://ngrok-agent.s3.amazonaws.com buster main" \
| sudo tee /etc/apt/sources.list.d/ngrok.list \
&& sudo apt update \
&& sudo apt install ngrok

Start ngrok ngrok config add-authtoken <auth token here>

ngrok http http://localhost:5678

Remove
sudo docker stop n8n && sudo docker rm n8n
Container

Docker N8N 1
sudo docker run -d --name n8n -p 5678:5678 -e
N8N_EDITOR_BASE_URL=<ngrok url here> -e
Run deamon
N8N_SECURE_COOKIE=false -e GENERIC_TIMEZONE=Asia/Ho_Chi_Minh
n8nio/n8n

4. Setup Credential Google

Go to https://console.cloud.google.com/apis/dashboard?inv=1&invt=Ablrmg

Enable API New Project: n8n read file, select API

API & Service > Library

Google Drive API> Enable

Google Sheet >Enable

Consent Screen → add test user


Tạo Consent
URL in Consent screen on
Screen
Localhost:5678 (n8n)

Tạo Credentials Create Credential > OAuth → lấy client ID và Secret

Client ID

Client Secret

5. Setup Facebook Token to post

Same last video

Token same previous


video

• if post video: title, description


Parameter
• if post photo: message

Download to data Send binary data

6. Test WF

Docker N8N 2
My_workflow_2.json

// Access or initialize Persistent Data


const persistentData = $getWorkflowStaticData('global');

// Initialize the current counter if it doesn't exist


if (typeof persistentData.counter === 'undefined') {
persistentData.counter = 0;
}

const updatedCounter = persistentData.counter + 1;


// Update the current counter
if (updatedCounter >= 3) {
persistentData.counter = 1;
} else {
persistentData.counter = updatedCounter;
}

// Return the selected element


return [
{
json: { current: persistentData.counter }

Docker N8N 3
}
];

7. Install Ollama on Ubuntu Server

curl -fsSL https://ollama.com/install.sh | sh

ollama pull llama3.2

OLLAMA_MODELS=/usr/share/ollama/.ollama/models
OLLAMA_HOST=http://103.20.97.11:5050 ollama serve

OLLAMA_MODELS=/usr/share/ollama/.ollama/models
OLLAMA_HOST=http://103.20.97.11:5050 nohup ollama serve >
ollama.log &

8. Change WF and test

9. Các cải tiến

Mount Volume trong Docker ra ngoài để không mất dữ liệu

Docker N8N 4

You might also like