Search

Sunday, 24 February 2019

Using Docker to run multiple instances of TinyProxy

  • install ubuntu 14.04 - 64 bit or later
  • Ideally set a static IP, gateway and Google DNS (8.8.8.8) before continuing
  • Go through Docker installation procedure https://docs.docker.com/engine/installation/linux/ubuntulinux/
  • Update package information, ensure that APT works with the https method, and that CA certificates are installed.
$ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates
  • Add the new GPG key.
$ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
$ sudo nano /etc/apt/sources.list.d/docker.list
$ sudo apt-get update
  • Purge the old repo if it exists.
$ sudo apt-get purge lxc-docker
  • Verify that APT is pulling from the right repository.
$ apt-cache policy docker-engine
  • Prerequisites by Ubuntu Version¶ Ubuntu Xenial 16.04 (LTS) Ubuntu Wily 15.10 Ubuntu Trusty 14.04 (LTS) For Ubuntu Trusty, Wily, and Xenial, it’s recommended to install the linux-image-extra-* kernel packages. The linux-image-extra-* packages allows you use the aufs storage driver.
  • To install the linux-image-extra-* packages: Open a terminal on your Ubuntu host. Update your package manager.
$ sudo apt-get update Install the recommended packages. $ sudo apt-get install linux-image-extra-$(uname -r) linux-image-extra-virtual
  • Install Make sure you have installed the prerequisites for your Ubuntu version.
  • Then, install Docker using the following:
  • Log into your Ubuntu installation as a user with sudo privileges. Update your APT package index.
$ sudo apt-get update
  • Install Docker
$ sudo apt-get install docker-engine
  • Start the docker daemon.
$ sudo service docker start
  • Verify docker is installed correctly.
$ sudo docker run hello-world
  • This command downloads a test image and runs it in a container. When the container runs, it prints an informational message. Then, it exits.
  • Find out what is running
$ sudo docker ps
  • Choose a container to download and from DockerHub - https://hub.docker.com/explore/
  • In our use case we require 'TinyProxy'
  • We can download and run the container with one command. At the same time we can specify the NIC and port we wish to bind our container to. You can run multiple containers on different IP's and ports.
  • In the example below we spawn a new tinyproxy instance with the unique name 'tinyproxy1' on the IP 10.0.2.200 and we map the internal docker port of 8080 to the published port of 9090.
$ sudo dcker run -d --name='tinyproxy1' -p 10.0.1.200:9090:8080 dannydirect/tinyproxy:latest ANY
  • You can spawn as many of these as your hardware permits, as long as they have a unique name, IP and port mapping

Install Docker Community Edition on CentOS7

# Install Docker Community Edition on CentOS7
# Install docker dependencies and daemon
sudo yum install -y yum-utils \
device-mapper-persistent-data \
lvm2

sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install docker-ce
# Set Docker to start on boot
sudo systemctl enable docker
# Add a non-root user to the Docker group
sudo usermod -aG docker guser # guser is my user in this case
# UPGRADE DOCKER CE
# To upgrade Docker CE, download the newer package file and repeat the installation procedure, using yum -y upgrade instead of yum -y install, and pointing to the new file.
# Test Docker is working
sudo docker run hello-world
# Install Docker compose
sudo yum install epel-release
sudo yum install -y python-pip
sudo pip install docker-compose
sudo yum upgrade python*
docker-compose -v

# Disable the firewall
systemctl disable firewalld

Wednesday, 1 July 2015

SSD fan control on imac

Took the plunge and upgraded my 2011 imac with a 1TB SSD. Obvious downside is the lack of Apple temperature sensors on replacement drives. Brilliant solution comes in the form of Exirion fan control:
http://exirion.net/ssdfanctrl/
Free software to enable granular or SMART control of the fan.

Tuesday, 17 September 2013

Quick Ubuntu server install


Run Ubuntu updates
sudo apt-get update
sudo apt-get upgrade

sudo apt-get  install lamp-server^ phpmyadmin (if required)


Set static IP
ifconfig
sudo nano /etc/network/interfaces

The default entries will be:
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

change auto eth0 entry to:

auto eth0
iface eth0 inet static
address 10.0.6.x
netmask 255.255.248.0
gateway 10.0.7.254
network 10.0.0.0
broadcast 10.0.7.255
dns-nameservers 8.8.8.8

then save and run:
sudo /etc/init.d/networking restart


Enable SSH for file transfer
sudo apt-get install openssh-client openssh-server


sudo shutdown -r now - restart
sudo shutdown -h now - shut down

Thursday, 9 May 2013

Ubuntu 12.04 and SOLR 3.6.2 install

Solr installation

Hi, I thought I would revisit my solr install to try and clarify a few points where people were having problems loading the solr-cell class and getting binary files to index, with errors such as these:


Error loading class    
    'org.apache.solr.handler.dataimport.DataImportHandler'

So, hopefully by following this tutorial you should get a working solr install:


Install base OS, 64 bit variant, in this case Ubuntu 12.04 64 bit

create a solr user and log in with that user

Go to 'Software centre' and install Synaptic Package Manager
install tomcat6 + tomcat6-common + tomcat6-admin

sudo apt-get install tomcat6
sudo apt-get install tomcat6-admin


Modify the Tomcat admin configuration to allow a new manager login.

sudo gedit /etc/tomcat6/tomcat-users.xml

Add the following to the file, commenting out other similar lines

Restart tomcat

sudo service tomcat6 restart


Check the root of Tomcat works by visiting: http://localhost:8080
Then log into the Tomcat manager page by visiting http://localhost:8080/manager/html and entering your Tomcat username and password that you setup previously

Prepare the solr environment


Create a temp folder for the solr binary

cd /home/solr/
mkdir tmp/solr/


Navigate to that folder

cd tmp/solr/

download the relevant  Apache Lucene solr binary using WGET (you will need to get the  URL for the version you wish to install)

wget http://apache.mirrors.timporter.net/lucene/solr/3.6.2/apache-solr-3.6.2.tgz

Decompress the binary file, copy files into their relevant locations and give the tomcat user rights to the working folder

tar xzvf apache-solr-3.6.2.tgz
cd apache-solr-3.6.2
sudo cp dist/apache-solr-3.6.2.war /var/lib/tomcat6/webapps/solr.war
sudo cp -fr example/solr /var/lib/tomcat6/
sudo chown -R tomcat6:tomcat6 /var/lib/tomcat6/solr


Restart tomcat6

sudo service tomcat6 restart

Set the solr home directory

sudo gedit /var/lib/tomcat6/webapps/solr/WEB-INF/web.xml

Modify the file accordingly, by uncommenting the solrhome env entry and adding the line below:

/var/lib/tomcat6/solr/

Restart tomcat6

sudo service tomcat6 restart

Check you can start solr

http://localhost:8080/solr

Setup solr-cell for binary file (word, pdf etc) indexing

First we need to load the solr-cell module in solrconf.xml

sudo gedit /var/lib/tomcat6/solr/conf/solrconfig.xml

Find and change the solr-cell line to match the following:

lib dir="/var/lib/tomcat6/webapps/solr/WEB-INF/lib/" regex="apache-solr-cell-\d.*\.jar"

Save the file

Now we must copy all the relevant .jar files into the classpath library

cd /home/solr/tmp/solr/apache-solr-3.6.2/

sudo cp contrib/extraction/lib/*.jar /var/lib/tomcat6/webapps/solr/WEB-INF/lib/
sudo cp contrib/dataimporthandler/lib/*.jar /var/lib/tomcat6/webapps/solr/WEB-INF/lib/
sudo cp dist/*.jar /var/lib/tomcat6/webapps/solr/WEB-INF/lib/


Restart tomcat6

sudo service tomcat6 restart

Test our solr installation

First we must install the curl command to send binary files via http to the request handler

sudo apt-get install curl

Create a text (non image) PDF file by creating a text file in Gedit with a keyword, such as 'otter' and printing the result to the file test.pdf (save this in your /home/documents/ folder)
Now we will take the test file and 'curl' it into solr

cd /home//Documents/

curl "http://localhost:8080/solr/update/extract?literal.id=smoketest&commit=true" -F "myfile=@test.pdf"

Now test to see if you can search the index for the id

From a remote PC enter the following URL:
http://:8080/solr/admin
In the query string box enter the following:

id:smoketest

Press search and the results should show a match for the 'numFound' variable. This shows 1 matching hit for 'smoketest' so we can confirm the system is working correctly.

Once the basic system is running it is time to apply the custom solr schema (if you have/need one). The schema resides in the following location:
/var/lib/tomcat6/solr/conf/schema.xml

Tuesday, 30 April 2013

Amazing technology from Microsoft

If this makes it into production form I'll have to do some saving!

If you love COD...

Check out my friends channel - plenty of BOPS action.
http://www.youtube.com/user/druidhwang

Hyper-V 2012 - Best freebie in a while

If you are looking for a free hypervisor platform then I strongly suggest you take a look at Microsoft's Hyper-V 2012. I've been using VmWare Esxi for the last few years and although it has served me fine, the speed improvements and management of Hyper-V are so much better now. I'm no MS fanboy, as previous versions of Hyper-V have been horrible but now they seemed to have cracked it.
The killer features for me are free, out of the box, failover and replication between Hyper-V servers. Basic management is OK but in order to handle the replication and failover functions you need to run the Hyper-V manager from either a Windows 8 PC or Windows Server 2012 desktop.
http://www.microsoft.com/en-us/server-cloud/hyper-v-server/default.aspx

Ubuntu tweaks and themes from Noobslab

Grab some excellent tweaks, themes and wallpapers (I'm talking about you, Black Wallpapers) from Noobslab - http://www.noobslab.com/

SOLR 4

Think it may soon be time to revisit a SOLR build. Probably will concentrate on SOLR 4 http://lucene.apache.org/solr/features.html with Ubuntu LTS, 12.04 64 bit http://www.ubuntu.com/download/desktop

More on IIS 8 and Windows server 2012

Further to my previous posts, it is also possible to setup app pools and change identities, using the syntax below:
appcmd set config /section:applicationPools /[name='purpleotter'].processModel.identityType:SpecificUser /[name='purpleotter'].processModel.userName: purpleone /[name='purpleotter'].processModel.password: APa55word