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

Advertisements
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
Posted by: terryhowe | September 29, 2016

Bash Environment Variable Search and Replace

I was trying to modify a bash environment variable today and traditionally how you did that was with command substitution and sed or awk.  Something like:

OS_TENANT_NAME=`echo $OS_TENANT_NAME | sed -e s/mesos/admin/g`

 

I had to throw in the accent grave there to make it super old school.

Anyway, I’m doing this and thinking that by now there has to be a better way to do this and bash does support search and replace in variables now:

$ echo ${OS_TENANT_NAME}
dev-mesos
$ OS_TENANT_NAME=${OS_TENANT_NAME/mesos/admin}
$ echo ${OS_TENANT_NAME}
dev-admin


Posted by: terryhowe | September 28, 2016

Why Working with Mesos is Like Embedded Programming

The other day I was using Mesosphere and it reminded me of when I was doing embedded programming a long time ago.

  • You have all these docker containers running the minimalistic operating systems.  You connect to one and you have no command history, lots of commands are missing and even command line options that you like are missing.  This all reminds of be working on projects where I was using Hard Hat or Busy Box on IPTV set top boxes and various modems and gateways.
  • There is an arcane procedure for uploading images into mesos just as there is  for uploading an image in an embedded environment.  You are never sure if your image is going to work or just brick the whole system.
  • Connecting to a docker container isn’t much different than tethering to some embedded device.  Instead connecting to the terminal through the serial port, you run docker exect -it and get a similar user experience.

The only problem is when you are running in the mesos world, you have to figure out where your docker container is running.

Posted by: terryhowe | September 24, 2016

Jenkins Groovy Set User Password

When you want to automate Jenkins deploys, groovy is a great way to go because you don’t have to parse xml files.  I was having trouble finding out how to set a user password in Jenkins without parsing xml.  This works:

import hudson.security.HudsonPrivateSecurityRealm.Details;
def user = hudson.model.User.current();
user.addProperty(Details.fromPlainPassword('s3cRe7'))

« Newer Posts - Older Posts »

Categories