Posted by: terryhowe | June 10, 2017

Ubuntu 16.04 Headphones Not Working

I get into  a state sometimes where the headphones just ill not register.  I think it is some lock file that prevents the headphones from being detected.  To fix this:

alsactl restore
Posted by: terryhowe | March 20, 2017

Is you is or is you ain’t you my metric?

This is the funniest thing I think I’ve seen in a database table schema:

CREATE TABLE `economic_metric` (
 `active` int(1) NOT NULL,
 `metricid` int(11) NOT NULL AUTO_INCREMENT,
 `is_metric` int(11) NOT NULL DEFAULT '1',
 ...

 

Posted by: terryhowe | March 16, 2017

Creating a Gem Mirror

  1. Install the rubygems-mirror:
    sudo gem install rubygems-mirror
  2. Create a ~/.gem/.mirrorrc file
    ---
    from: http://gems.rubyforge.org
    to: /var/www/mirror
  3. Run the mirror command
    gem mirror
Posted by: terryhowe | March 16, 2017

Spinning up a Stackato Server in the Cloud PaaS

I’m working today trying to use Stackato to be able to spin up a slave for Jenkins.  Hopefully, Stackato can help me make spinning up these slave servers easier, we will see.  I have a fair amount of software I need to install on the server.  The basic getting started guide can be found here: http://docs.stackato.com/server/hpcs.html

What the documentation doesn’t really talk about as far as security groups is what ports you need to open.  To create these rules with the CLI:

hpcloud securitygroups:add stackato Stackato
hpcloud securitygroups:rules:add stackato tcp -p 22..22
hpcloud securitygroups:rules:add stackato tcp -p 80..80
hpcloud securitygroups:rules:add stackato tcp -p 443..443
hpcloud securitygroups:rules:add stackato tcp -p 1..65535 -g stackato
hpcloud securitygroups:rules:add stackato icmp

When you have the ports open, they should look like this:

$ hpcloud securitygroups:rules stackato
 +-------+-----------+----------+------+-------+
 | id    | source    | protocol | from | to    |
 +-------+-----------+----------+------+-------+
 | 32415 | 0.0.0.0/0 | tcp      | 22   | 22    |
 | 32417 | 0.0.0.0/0 | tcp      | 80   | 80    |
 | 32419 | 0.0.0.0/0 | tcp      | 443  | 443   |
 | 37583 | stackato  | tcp      | 1    | 65535 |
 | 44411 | 0.0.0.0/0 | icmp     | -1   | -1    |
 +-------+-----------+----------+------+-------+
$

To create the server with the CLI, I ran:

 hpcloud servers:add stackato large -i 1000095768 -k cli_test_key1 -s stackato

Then I got the IP with the following command:

hpcloud servers stackato

I’m not going to set up DNS, so I just put some entries in my /etc/hosts file:

15.184.124.76 jslave.hpcloud.net
15.184.124.76 www.jslave.hpcloud.net
15.184.124.76 api.jslave.hpcloud.net

The first thing I did was secure shell into my new server using the CLI:

hpcloud servers:ssh stackato -l stackato

Next I set the server name and rebooted:

kato rename jslave.hpcloud.net

text

Posted by: terryhowe | March 16, 2017

Running a basic Django Application with Stackato

I’ve been experimenting with Stackato lately to create a basic Django application and I’ve found the documentation a bit scattered. There is a very basic which I took and kind of combined with the Django quick start instructions. The biggest missing thing is when I deployed the application with stackato push -n it did not connect the database to the application.

The first thing I looked at was the on the Stackato WUI application page there is a link for logs. They didn’t provide a lot of detail. There are better logs in the Files page under logs. Here, the first thing I noticed is that it claimed that DATABASES was not set. I’m not sure why this was since I could see where it was being set in the stackato/settings.py file. What I ended up doing was modifying the settings.py to set DATABASES. I’d messed up the settings.py when I was merging the getting started application with the Stackato sample application.

The next problem was the static style sheets where not pushed to the application. I was able to update the static information with:


stackato run python manage.py collectstatic --noinput

Posted by: terryhowe | March 15, 2017

Python one line web server

Instant web server:

python -m SimpleHTTPServer
Posted by: terryhowe | March 10, 2017

Rename user in Ubuntu

I recently fired up a new ubuntu 16.04 instance on some new hardware, installed a bunch of software and configured various preferences only to discover that I had a typo in my user name.  In order to fix this problem, I created a new user bob and gave bob sudo privileges. I logged in as bob and ran sudo -i and executed the following commands:

usermod -l terry terr7y
groupmod -n terry terr7y
usermod -d /home/terry -m terry

When I logged back in as terry everything was working as expected.

That all worked great, but I had to completely destroy my virtualenv and tox directories.  From my home directory I ran:

grep -rl terr7y .

This command revealed some configurations that had my user name hard coded.

 

Posted by: terryhowe | March 9, 2017

Python 3.4 on Ubuntu 16.04

When you install Python 3 on Ubuntu 16.04 you get Python 3.5.  If you need Python 3.4, it is not available from the default repository and you will need to add a PPA (Personal Package Archive).  Felix Krull’s deadsnakes PPA has a Python 3.4 package:

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt update
sudo apt install python3.4

 

 

 

 

Posted by: terryhowe | March 9, 2017

db type is dbm.gnu, but the module is not available

If you install Python 3.4 on your for testing with tox, you may receive the error:

db type is dbm.gnu, but the module is not available

The way to get around this is to install the associated gdm module

sudo apt-get install python3.4-gdbm

 

 

 

Posted by: terryhowe | March 9, 2017

tox no module named gdm or _bsddb

Depending on the order you run tests in tox you can get some problems with the test repository where it will fail the entire test with a message “no module named gdm” if you run python 3 tests before python 2 or “no module named _bsddb” if you run python 2 tests before python 3.  I posted earlier how you used to be able to remove the .testrepository directory and rerun the python 2 tests first, but that doesn’t work any more.  You can now install python-gdm on Ubuntu to get around this.

sudo apt-get install python-gdm

Older Posts »

Categories