#1661: Migration of knowledge base articles to Swarmica
Отредактирована: сегодняImporting articles into Swarmica. This article describes how to import articles in .md file format into Swarmica.
Instructions
Recommendation: Name the .md file after the article's topic. For example, if the article's topic is 'How to create a ticket,' then the recommended file name is 'How to create a ticket.md'.
-
Connect to the Swarmica server via SSH as root.
-
Create the folder
/root/swarmica/old_articles:
mkdir /root/swarmica/old_articles
-
Upload the articles (
.mdfiles) to the created folder/root/swarmica/old_articles. -
Create a backup of the file
/root/swarmica/docker-compose.yml:
cp /root/swarmica/docker-compose.yml{,.backup}
- Mount the folder with the articles into the
djangocontainer. To do this, add the following line to the/root/swarmica/docker-compose.ymlfile in thedjangocontainer section:
<...>
django: &django
image: reg.gl.swd.im/swarmica/backend:{SW_BACKEND_VERSION}
depends_on:
- postgres
- redis
volumes:
- swarmica_ai_assistant:/swarmica/swarmica/ai_assistant/articles/:z
- swarmica_runtime:/swarmica/swarmica/runtime_scripts/:z
- swarmica_static:/swarmica/swarmica/static:z
- swarmica_ugc:/swarmica/swarmica/attachments:z
- swarmica_uploads:/swarmica/swarmica/uploads/:z
- /root/swarmica/old_articles/:/swarmica/swarmica/old_articles/:z # <------ This line
<...>
And restart Swarmica:
docker compose down; docker compose up -d
-
Log in to the Swarmica UI as an Administrator.
-
Create a new script in Swarmica - Settings - Scripts with the Administrator role.

- In the script settings, add this script and the following to Web Form Parameters and click Save:
[
{
"name": "author_uid",
"type": "string",
"required": false,
"displayName": "Author's UID"
},
{
"name": "category_name",
"type": "string",
"required": true,
"displayName": "Article Category Name"
}
]
It should look like this:

- In the web form of the script, specify the UID of the user who will be assigned as the author of the articles and the Name of the article category, then click Send:

- On the Swarmica server, in the
/root/swarmica/docker-compose.ymlfile, remove the line added in step 5 and restart Swarmica:
docker compose down; docker compose up -d