Change the Solr Server URL on Drupal 7 from an external shell script - apache

I have recently received a task of maintaining a Drupal site, with one of the tasks being writing a backup and import script for the dev site, so it can receive a daily dump of the live data.
I have done this, however we need to revert the Solr details to the dev solr database. However I only know how to do this manually using the UI tools (e.g. "https://WEBSITE.co.uk/admin/config/search/apachesolr/settings" clicking "edit" and changing the "Solr server URL" in the UI menu and clicking "Save" e.g. "https://WEBSITE/admin/config/search/apachesolr/settings/dev_environment_search_server__0_0/edit?destination=admin/config/search/apachesolr/settings").
Would there be a way of changing this without in a script?
Also updating the database table manually doesn't work unless you also clear the cache, is there a way of only clearing the Solr Cache for to update this change (I've been asked to not clear all caches)
Could anyone help me?

If Solr is setup using Search API you can add the Search API Override and Search API Solr Override modules to allow you to control the configuration easily in your settings.local.php file.

Related

Grafana not showing query editing anymore after dashboard importation - Zabbix

I need to ask a question about a Bug that is happening with my Grafana. After I imported a Dashboard from the Grafana Labs website, to be more specific it's here >>https://grafana.com/grafana/dashboards/5363 - Full zabbix server status.
There is a problem in Grafana, it simply doesn't allow editing any query from the panels anymore. The option disappeared as shown below. Has anyone here gone through this?
I've already tried to restart the server, update the datasource and also delete the dash that I imported:
If anyone has any suggestions/solutions, I'm all ears.
Image link here:
https://i.stack.imgur.com/itnyv.png
kind of happening the same here. There is an evident bug when editing custom scripts for a panel or a check. After working a lot on a script, I saved the Check. But when I come back, the only option is the UI query editor, which obviously does not load my custom script. And there is NO "script editor" button. It's gone.
I had the same issue, which may or may not have the same cause, but I thought I would share in case it helps anyone else.
I was getting the below error in the console. I run my Grafana instance in a windows environment, but should be similar for other Operating Systems.
Plugin file not found open C:\\grafana-9.2.3\\data\\plugins\\alexanderzobnin-zabbix-app\\datasource-zabbix\\datasource-zabbix\\partials\\query.editor.html: The system cannot find the path specified."
I noticed that the directory C:\grafana-9.2.3\data\plugins\alexanderzobnin-zabbix-app\datasource-zabbix\datasource-zabbix\ did not exist, so I created the directory manually and copied the partials directory to C:\grafana-9.2.3\data\plugins\alexanderzobnin-zabbix-app\datasource-zabbix\datasource-zabbix.
Then I restarted my Grafana service and was able to see my Zabbix queries in my Grafana dashboards.

serve oracle service cloud Customer portal locally?

I am working on customizing the oracle service cloud customer portal, but since OSvC provides only WebDAV to connect to it. It is very time-consuming to edit files and then upload them to WebDAV even for a single word change.
I am looking for a solution to serve it locally make desired changes and then upload the desired code to webDEV.
But after searching the file structure I can not make which framework it uses, I tried to use websites like https://builtwith.com/ and WhatRuns but they are also not able to find anything useful.
Although after searching in the file structure, I find some files of CodeIgnitor but the structure is way more different than the CodeIgnitor folder structure.
The short answer is no, you will not be able to run Customer Portal locally. While it is a fork of CodeIgniter from many years ago, there are server-side dependencies that will prevent you from running it in a local sandbox.
That said, it is possible to automate many of the manual tasks of interacting with WebDAV for change testing. If you edit locally, then you can use scripting hooks or event RPA robots to automate some of the manual file movement. Personally I have a flow to edit remotely in my test environment with an editor (like VSCode or Nova) that can connect to a remote server via WebDAV and edit files directly in the development area of a site. Then, when finished, I have a script that pulls down the latest version of all files and then allows me to commit changes to Git for SCM.
Another option is RPA. You can develop a robot that can be run to automate the manual tasks that you face in your workflow. Personally, I think that scripting is a better solution than RPA since you can automate all of the actions via scripting or a shell. But, it's another option to consider.
Another way of "Live editing" the OSvC CP code is to connect to WebDav via a software that supports it like Mountain Duck which uploads your code to OSvC on save.
OR use the better solution Windows Explorer which supports connecting to WebDav and treating it like a network drive, by going on My Computer -> Computer -> Map Network Drive then put https://yoursite.custhelp.com/dav/cp click Next then you'll be promoted to login using your OSvC login.

OWASP ZAP share Context between environments and change base URI's addresses

I'm new to ZAP tool so sorry in advance if question is stupid, but I cannot find answer on it so far...
I have to fix all the vulnerabilities in some application, so I installed ZAP proxy tool locally, then explored application manually, collected all the requests and ran 'Active scanner' against it. So far everything is good, but the problem is that application quite big and it's very difficult and time consuming to cover everything manually. Fortunately we have dedicated automation environment where I can setup ZAP proxy and let test's go and populate context (set of url's for test) for me
So now my task is somehow share context's between different environments with ability to change base addresses
e.g. I populated context on somedomain/myapp and want run ZAP tool against same application deployed locally, or in different server (e.g. localhost/myapp)
It would be very helpful if someone could share any info how to achieve that.
Thank you in advance,
Eugene
It seems that you can create new context and then add existing links to that context.
Craete a new context
Add existing link to the selected content (right click)
Check this link.
https://chrisdecairos.ca/intercepting-traffic-with-zaproxy/
Tiago

Viewing Apache solr logs on windows

I have drupal based site with solr integration. My localhost is on windows and the live site on Linux.
How do I enable and view solr logging for both setups? I can see a log folder in my localhost but its empty.
Just to elaborate, solr search etc works great in both setups. However I built a solr view that works perfectly on local but gives less accurate results on live. So I wanted to see the final solr queries being built to see the source of the difference.
While starting the Solr instance pass the following parameter to enable Solr logging to file.
-Djava.util.logging.config.file=etc/logging.properties
Then modify your /example/etc/logging.properties inside you Solr instance to customize your logging pattern.
Using Solr Version: Apache Solr 8.9.0
You could use the Solr Administration User Interface
Go to Solr Admin UI and click the link for "Logging".
Then you will see log info.
Selecting the Level link on the left, you see the hierarchy of classpaths and classnames for your instance.

How to start an application on the server from a webpage

Example:
The user login to the webpage => Click on a button
This action starts the executable "CreatePrettyPicture"
The file "prettypicture.jpg" is created on the server
When the user reloads the page the pretty picture "PrettyPicture.jpg" is shown on the page.
If I could start the application with a parameter it would be even better.
The server is a using Debian and as web server I'm using Apache. Please let me know if you need more information about the server configuration.
The possibility of several users clicking on the button at the same time is not a part of the problem.
You need to read up on CGI Scripts.
It's also possible that PHP is already available on your server, but I wouldn't recommend using it unless you're already familiar with it and know all of the security pitfalls, which from the question appears very unlikely.
You would be better of using a server side script with your apache installation to start the executable. This is probably easier with PHP (which should be easy to install if it isnt already), here are the commands. As long as you dont actually use any input with the page it should be safe enough.