Docker: apt-get cleanup

Standard
Reading Time: < 1 minute

If you install things with apt-get remember to clean it up afterwards

RUN apt-get clean && rm -f /var/lib/apt/lists/*_*

This would be a better way:

RUN apt-get update -y \
&& apt-get install -y -q package1 \
package2 \
package3 \
&& apt-get clean && rm -f /var/lib/apt/lists/*_*

Docker Push an Image to a Remote Server

Standard
Reading Time: < 1 minute

I needed to be able to push an image from my CI/CD server. Before I was using docker-hub to host my images and wanted to streamline the process. I would build my code >> build my image >> push to docker-hub >> have my server download the new image from docker-hub >> than update / restart container.

Now:

  1. CI/CD Build
  2. Push image to Remote Server
  3. Stop container / Restart

Things needed:

Docker
Python / PIP
SSH Key
docker-push-ssh (https://github.com/brthor/docker-push-ssh)

Assuming you have docker and python installed, and you have have setup ssh for key access.

Setup docker-push-ssh

I followed the guide to add an insecure registry to docker for linux.

Continue reading

Going Serverless: AWS Lambda, and S3

Standard
Reading Time: < 1 minute

Setting up a local development environment for a serverless AWS system. I will be setting up a local development environment.

Things needed:
NVM
Node
AWS CLI tool Version 1
Serverless Framework

Install AWS CLI Version 1:

The guide to install can be found here.

Install NVM:

Install Node:

Install Serverless Framework:

Create Project:

Initialize NPM:

Node packages we’ll be using:

AWS Profile (~/.aws/credentials):

Using the profile:

Testing and Using S3

Configure: (serverless.yml)

Edit handler.js:

Start Serverless Offline: (try to use separate terminals)

Pushing up file to Local S3:

Retrieving a file from Local S3:

Results:

On your second terminal, the one you ran sls offline start you should have log outputs stating you have successful PUT and GET responses.

For the GET request, you should have a file in your tmp/ directory.

Upgrading Rails 5.2.2.1 to 6.0

Standard
Reading Time: < 1 minute

Update Gemfile

Grab updates & install webpack

Run your test and fix any issues. I mostly got issues revolving around update_attributes and expanding where.not() queries.

I had to update a bunch of
@resource.update_attributes(resource_params)
to
@resource.update(resource_params).

I also had scopes that looked like:

They had to be updated to:

Also, I had an issue with one of my render partials.

Had to update it to:

Updating application.rb

If using rubocop: add this to your .rubocop.yml

Fin.

docker-credential-pass Ubuntu setup for Bamboo CI/CD

Standard
Reading Time: < 1 minute

Ubuntu: 18.04
Docker: 18.09.5
docker-credential-pass: 0.6.2
pass: 1.7.1
gpg2: 2.2.4

Since my setup is for CI/CD I have a bamboo user to deploy my docker containers to Docker Hub and deploy to my production servers. Your use case may vary, but if you want your credentials to persist longer than a couple of hours before your system starts asking you to re-enter your passphrase this might work for you.

My gpg-agent.conf file looks like this:

This worked for me. Also note the default-cache-ttl value is in seconds, the values I used is 10 years in seconds.

Installing Jira Software Server

Standard

Reading Time: < 1 minuteAssuming you have downloaded from Atlassian. If not read how to prepare for installs.

Follow prompts and make sure you enable the service option if you want Jira Software to autostart on bootup.

If you installed using sudo it’ll place the app in dir: /opt/atlassian/jira, which is good.

Note these files in case you don’t want it to be installed as a service or if something happens.

Preparing a Server for Atlassian Software

Standard

Reading Time: 2 minutes

I’ve been a user of Jira before the kanban “agile” interface and it was still one suite with an agile plugin. I use both Jira Core (“task”) and Jira Software (“agile”). I use Core for task based projects and Software for well software based projects.

I actually use Core for home projects like: my daughters 3rd birthday, remodeling the garage, gardening task like cloning my chili plant or gardenias. I have a project with multiple task and sub-task.

Given: I have an over powered media server running Ubuntu 18.04 and I have a need to track my personal task and projects. And I thought it would be a fun weekend project.

When: I install Atlassian’s Jira Software Server, Jira Core Server, and Confluence Server (I will be also installing Bamboo Server and BitBucket Server at a later time)

Then: I will have access to Jira for any task or project and I can track progress. I will have also learned how to manage and use Jira from another point of view. Not just moving features across and completing them.

Continue reading

Updating Ubuntu 17.10 to 18.04

Standard
Reading Time: < 1 minute

If you need to upgrade your Ubuntu to a new release.

Wait a few minutes/hours, you should have upgraded your server.

Creating an image with A Dockerfile

Standard
Reading Time: < 1 minute

The Dockerfile

Simply a file or manifest that has all the commands needed to be run to create an image when you run ‘docker build’. You can find more information here: Dockerfile docs

Simple Dockerfile

Just to keep it simple a Dockerfile can be as simple as installing packages after setting up a server and creating some directories. Here’s an example:

Here is a Dockerfile I used for a virtual host apache image:
https://github.com/mfung/alpine_apache2_php7

Commands

Some commands when dealing with building an image: