Архив автора: admin

Административная панель Wolf CMS. Часть 1

Административная панель  Wolf CMS довольно проста и понятна с первого раза. Однако за внешней простотой скрываются широкие возможности для разработчика. Давайте для начала пройдемся внимательно по основным вкладкам панели и посмотрим что и за что отвечает.

Достаточно в установленной системе Wolf CMS ввести адрес типа https://ваш-сайт/admin и вы попадете на страницу входа в административную панель. Тут нужно заполнить простую форму: ввести свой логин и пароль, который вам сгенерировала система по умолчанию и вы попадете уже в саму панель.

Я сталкивался с глюком, когда меня выкидывало через каждые 10-15 минут не активности в панели, однако все «починилось» при сбросе кеша браузера. Я подозреваю, что ошибка была связанна с установкой сессии. Так что в случае если у вас будет такая ошибка, то стоит очистить кеш браузера и перелогиниться.

Административная панель WolfCMS

Административная панель WolfCMS

Именно здесь создается структура сайта. Первый вход будет сделан на языке по умолчанию — английском. Позже, можно настроить вывод админки на другие языки, русский в том числе (как на скриншоте). Этим мы займемся немножко позже.

Если рассмотреть внимательно, то можно увидеть, что админка состоит как бы из 4 частей: названии сайта с маленьким меню пользователя, основным меню с табами (на самом деле это переходы на другие страницы), основной частью страницы и подвалом, где копирайт системы.

Нас же пока интересует, то что Pages позволяет управлять структурой. Икона лупы напротив страницы позволяет открыть в другом окне нужную страницу, чтобы посмотреть  как она выглядит, в колонке Modify мусорный бачок означает удаление, плюсик в зеленом кружке создает дочернюю страницу, а пустой лист с зеленой стрелкой внизу копирует страницу.

Здесь есть подводные камни:

  • если вы копируете страницу, то копируются и ВСЕ ДОЧЕРНИЕ СТРАНИЦЫ. Причем не всегда корректно меняются поле slug, так что будут появляться ошибки — нужно будет подправлять эти поля.
  • в системе происходит при выводе меню, хлебных крошек поиск по slug, так что дублей быть не должно (но почему-то система не совсем корректно проверят на дубли это поле)
  • при создании дочерней страницы, страница создается дочерней, поменять можно перетаскиванием (об этом ниже). Вот только часто меняется неправильно порядок страниц. Ты ожидаешь что будет добавляться внизу, вроде так и происходит. Но когда правишь страницу, она вдруг прыгает куда-то вверх. Тут на лицо неправильное задание цифры порядка. Для себя я вывел, что лучше сразу создать все страницы и задать им имена. А потом уже через «изменить порядок» поставить в том порядке, в котором мне нужно.

Если кликнуть на названии странице, то страница перезагрузится и мы сможем редактировать страницу.

Редактирование страницы в WolfCMS

Редактирование страницы в WolfCMS

Я специально сделал полный скриншот страницы, чтобы все было видно. Тут тоже вроде все понятно. Заголовок страницы — это именно заголовок страницы, до которого можно добраться через специальную функцию и вставить в шаблон.

А вот что требует особого внимание, так это понятие «фильтр». Фильтр в терминологии Wolf CMS — это редактор, который подключается для редактирования в обычном текстовом поле. На скриншоте подключен планиг фильтра Ace. Ace позволяет комфортно редактировать исходные тексты на разных языках программирования. Впрочем, о фильтрах и о Ace я расскажу подробнее в отдельных статьях.

Еще стоит обратить внимание на кладки «body» и «slider». По умолчанию к любой странице создается вкладка body, где можно ввести код/текст и который обычно и выводится. Но к любой странице можно сделать несколько таких вкладок и потом по условию в шаблоне выводить что-то и из них. В документации к Wolf CMS я встречал howto подключения с помощью вкладок формы обратной связи, чтобы не плодить сниппеты (фрагменты).

Таб (вкладка) «метаданные» позволяет задать метаданные страницы. Вот сриншот:

Редактирование метаданных страницы в WolfCMS

Редактирование метаданных страницы в WolfCMS

Как видите, основное для SEO-оптимизации есть уже сразу в системе. Хлебные крошки нужны для вывода в хлебных крошках как короткое название страницы. Не смотря на то, что во всех инструкциях для вывода меню используется заголовок страницы, я рекомендую использовать именно хлебные крошки. Когда дойду до меню, я покажу как это сделать. Таким образом можно в шаблоне вывода страницы задать вывод заголовке с теми тегами, которые нужно, а не судорожно вспоминать через полгода, когда добавляешь страницу: » А как же я выводил заголовок на других страницах?».

Кроме того, описание можно использовать и как короткое описание в выводе ленты новостей, и как description страницы. Тут тоже зависит все от вашей фантазии. Можно описание оставить как SEO-описание, а создать для ленты новую вкладку для тизера.  А можно использовать одно и тоже описание для того и другого.

Метки как бы не используются в базе Wolf CMS. Однако можно сделать самостоятельно фильтрацию и реализовать систему тегов как на блогах. Тут нужно искать плагины или писать саомостоятеньно на php.

Ну и в настройках можно задать другие важные настройки страницы:

Настройки страницы в WolfCMS

Макет — это название вашего шаблона вывода страниц. Дата создания и дата публикации тоже понятны. Тут можно делать отложенную публикацию и снимать автоматически с публикации страницы.

А вот «тип страницы» нужен для расширения стандартного функционала. Именно через плагины можно создавать страницы с особыми свойствами и как раз здесь эти свойства присваиваются. Пример таких страниц: архив, лента, поиск по сайту. Пока не буду заострять на этом внимание, поговорим об этом позже.

Последняя строка уже относится к правам пользователей. В Wolf CMS могут быть 3 вида пользователей: администратор, разработчик, редактор. Здесь вы задаете возможность просматривать ее зарегистрированным пользователям (одной из 3 видов пользователей) или для всех, а от изменения защищаете галочкой — можно ли ее редактировать или нужны права администратора. По умолчанию, работа с пользователями в Wolf CMS построена плохо. Однако есть плагин, который позволяет существенно расширить возможности системы.

Осталось только рассмотреть статусы страницы. В Wolf CMS есть 5 основных статусов: опубликована, черновик, скрыта, предосмотр, архивировано. В настройках можно задать как по умолчанию будет создаваться: черновик или опубликована. Пройдемся по всем подробнее

  • Опубликован — такая страница сразу видна на сайте если все правильно настроил разработчик. 
  • Черновик — такая страница не видна на сайте, но в базе она есть. Вывести ее не удастся покак не изменится статус страницы. Используется для черновиков или если надо срочно снять с публикации материал.
  • Скрыта — страница находится в базе, её можно посмотреть на сайте, но она скрыта в меню. Используется для скрытых системных страниц, таких как карта сайта для Google в формате xml, вывод результатов поиска по сайту, вывод архива страниц, rss новостей сайта и других
  • Предопросмотр — выбор этого пункта позволяет иметь доступ к странице редактору контента, но не на «боевом» сайте. То есть вы можете посмотреть из структуры сайта страницу как она будет выглядеть, но просто получить доступ по ссылке нельзя. Получается этакая разновидность скрытой страницы, но с заточкой под редактора.
  • Архивировано — этот тип новый и нужен для архива новостей.

Итак, мы полностью разобрали главный раздел административной панели Wolf CMS — управление страницами. Теперь вы можете самостоятельно создать любую структуру сайта согласно вашей задумки и наполнить его своим контентом.

В следующих статьях я расскажу о других пунктах административной панели Wolf CMS



2019-03-31T20:19:29
CMS

MikroTik Load Balancing and Link Redundancy with PBR

In computer networking, the Load Balancing technique is used to send network traffic over multiple gateways. If you have multiple ISP connections available, you can use load balancing technique to establish a stable network. You may now ask, why will I use multiple ISP connections? What are the benefits to use multiple ISP connections in my network? For your satisfaction, the following points are some reasons to use load balancing technique in your network.




  1. No ISP can give you 100% uptime guarantee. So, it will be better to use more than one ISP connection to ensure 100% uptime network.
  2. Sometimes you may have dependency (such as Mail, IPPBX etc.) on your uplink ISP but their service is not so good. In this case, you can use another ISP which provides better service.
  3. Your current ISP is better but high paid bandwidth. In this case, you can purchase another ISP bandwidth which is cheap but their connection is good, not better.




If these are your current status, it is suggested to configure a load balancing and link redundancy network with multiple gateways. MikroTik Router has various load balancing and link redundancy methods (such as ECMP method, PCC method and PBR method) to establish a stable network. Among these, PBR (Policy Based Routing) is simple but efficient method to make a stable load balancing and link redundancy network. In this article, I will discuss how to create a load balancing and link redundancy network over two WAN connections using Policy Based Routing in MikroTik Router.




Network Diagram




To configure a load balancing and link redundancy network with Policy Based Routing (PBR), I am following a network diagram like the below image.




PBR Load Balancing and Link Redundancy
PBR Load Balancing and Link Redundancy




In this network, MikroTik Router’s ether1 port is connected to ISP1having IP network 192.168.30.0/30 and ether2 port is connected to ISP2 having IP network 172.30.30./30. On the other hand, ether3 port is connected to LAN network and its IP networks are 10.10.10.0/24 and 10.10.20.0/24 (categorized by GroupA and GroupB respectively). PC-1 and PC-2 are two LAN workstations. PC-1 is under GroupA network and PC-2 is under GroupB network.




After PBR load balancing and link redundancy configuration, GroupA traffics will pass through WAN1 connection and GroupB traffic will pass through WAN2 connection. If WAN1 is disconnected for any unwanted reason, all traffics (from GrpupA and GroupB) will pass through WAN2 connection until the WAN1connection comes back again. Similarly, if WAN2 is disconnected, all traffics (from GrpupA and GroupB) will pass through WAN1 connection and ensure a link redundancy network.




Load Balancing and Link Redundancy Configuration in MikroTik Router




 We will now start load balancing and link redundancy configuration in MikroTik Router according to the above network diagram. Complete configuration can be divided into the following five steps.




  • Renaming interface name
  • Assigning WAN and LAN IP
  • Assigning DNS IP
  • Firewall configuration and
  • Routing configuration




Step 1: Renaming Interface Name




We will first rename interface name to understand and remember the configuration easily. The following steps will show how to rename MikroTik interface name.




  • Login to MikroTik Router using Winbox with the full permission user privilege.
  • Click on Interfaces menu item. Interface List window will appear.
  • Double click on ether1 interface. The properties window of the ether1 interface will appear.
  • Put WAN1 in Name input field under General tab and then click Apply and OK button.
  • Similarly, rename ether2 to WAN2 and ether3 to LAN.
  • Your Interface List window will look like the below image.




Interface List Window
Interface List Window




Step 2: Assigning WAN and LAN IP




 We will now assign WAN and LAN IP addresses on our respected interface. The following steps will show how to assign IP address on MikroTik Router’s interfaces.




  • Go to IP > Addresses menu item. Address List window will appear.
  • Click on PLUS SIGN (+) and put ISP1 provided IP address (192.168.30.2/30) in Address input field.
  • Choose WAN1 from Interface dropdown menu and click Apply and OK button.
  • Similarly, Click on PLUS SIGN (+) again and put ISP2 provided IP address (172.30.30.2/30) in Address input field and choose WAN2 from interface dropdown menu and then click Apply and OK button.
  • Click on PLUS SIGN (+) again and put the gateway IP (10.10.10.1/24) for the GroupA workstations in Address input field and choose LAN from Interface drop down menu and then click Apply and OK button.
  • Similarly, click on PLUS SIGN (+) again and put the gateway IP (10.10.20.1/24) for the GroupB workstations in Address input field and choose LAN from Interface drop down menu and then click Apply and OK button.
  • Your Address List window will look like the below image.




Address List Window
Address List Window




Step 3: Assigning DNS IP




DNS is required to resolve domain name to IP address. Without DNS server MikroTik Router cannot resolve domain name to IP address and fail to communicate with the public domain server. The following steps will show how to assign DNS IP in MikroTik Router.




  • Go to IP > DNS menu item. DNS Settings window will appear.
  • Put your DNS server IP provided by your ISP or put Google public DNS Server IP 8.8.8in Servers input field.
  • Click Apply and OK button.






Step 4: Firewall Configuration




Firewall is the place where we will create Policy for load balancing and link redundancy. In Firewall, we will do the following three types of configurations.




NATing Configuration




The local user cannot communicate with the public servers without masquerade NATing configuration. So, do the following steps to configure masquerade NAT in MikroTik Router.




  • Go to IP > Firewall menu item. Firewall window will appear.
  • Click on NAT tab and then click on PLUS SIGN (+). New NAT Rule window will appear.
  • Choose srcnat from Chain dropdown menu under General tab.
  • Click on Action tab and choose masquerade from Action dropdown menu.
  • Click Apply and OK button.




Address Lists Configuration




We will now create our desired network groups in Firewall Address List. The following steps will show how to create network groups using Firewall Address List features.




  • Click on Address Lists tab from Firewall window and click on PLUS SIGN (+). New Firewall Address List window will appear.
  • Put your first group name (GroupA_Block) in Name input field.
  • Put your first group network block (10.10.10.0/24) in Address input field.
  • Click Apply and OK button.
  • Similarly, create second group (GroupB_Block) for second network block (10.10.20.0/24).
  • At last, create another group (Local_Block) and put whole network block (10.0.0.0/8) to select both the above network blocks.
  • Your Firewall Address Lists window will look like the below image.




Address Lists in Firewall
Address Lists in Firewall




Mangle Rule Configuration




Mangle Rule creates policy for Policy Based Routing. As we have two groups, we will create two Mangle Rules to mark two different routing. The following steps will show how to create Mangle Rule to mark routing for incoming packets from LAN interface.




  • Click on Mangle tab and then click on PLUS SIGN (+). New Mangle Rule window will appear.
  • Choose prerouting from Chain dropdown menu under General tab.
  • Click on Advanced tab and choose your first group (GroupA_Block) from Src Address List dropdown menu
  • Choose whole network block (Local_Block) from Dst. Address List and click on invert or not box.
  • Click on Action tab and choose mark routing option from Action dropdown menu and put a name (to_WAN1) for this routing mark and uncheck the Passthrough checkbox.
  • Click Apply and OK button.
  • Similarly, click on PLUS SIGN (+) again and choose prerouting from Chain dropdown menu under General tab. From Advanced tab, choose your second group (GroupB_Block) from Src Address List dropdown menu and choose whole network block (Local_Block) from Dst Address List dropdown menu. Don’t forget to click on invert or not box in Dst. Address List option. Click Apply and OK button.
  • Your Mangle List window will look like the below image.




Mangle Rules in Firewall
Mangle Rules in Firewall




Step 5: Routing Configuration




After creating policy using Mangle rule, we will now configure routing based on created policy and pass different groups to different WAN connections. The following steps will show how to create policy based routing in MikroTik Router.




  • Go to IP > Routes menu item. Route List window will appear.
  • Click on PLUS SIGN (+). New Route window will appear.
  • Click on Gateway input field and put WAN1 gateway IP (192.168.30.1) in this field.
  • Click on Check Gateway input field and choose ping from dropdown menu.
  • Click on Distance input field and put value 1 in this field.
  • Click on Routing Mark input field and choose to_WAN1 from dropdown menu.
  • Click Apply and OK button.
  • Similarly, click on PLUS SIGN (+) again and put WAN2 gateway IP (172.30.30.1) in Gateway input field and choose ping from Check Gateway dropdown menu and put value 1 in Distance input field and choose to_WAN2 from Routing Mark dropdown menu and then Click Apply and OK button.
  • Now click on PLUS SIGN (+) again and put WAN1 gateway IP (192.168.30.1) in Gateway input field and choose ping from Check Gateway dropdown menu and put value 1 in Distance input field and then click Apply and OK button .
  • Similarly, click on PLUS SIGN (+) again and put WAN2 gateway IP (172.30.30.1) in Gateway input field and choose ping from Check Gateway dropdown menu and put value 2 in Distance input field and then click Apply and OK button .
  • Your Route List window will look like the below image.




Route List Window
Route List Window




Load Balancing and Link Redundancy configuration in MikroTik Router with Policy Based Routing has been completed. Now assign GroupA_Block IP to those users whose you want to pass through WAN1 connection and assign GroupB_Block IP to those users whose you want to pass through WAN2 connection. Being a link redundancy network, if the WAN1 connection goes down, all the network traffics (both GroupA snd GroupB) will pass through the WAN2 connection and if the WAN2 connection goes down, traffic will pass through the WAN1connection.




If you face any confusion to follow the above steps properly, watch the following video about MikroTik Load Balancing with Failover using Policy Based Routing. I hope it will reduce your any confusion.