Getting the AWS X-Ray deamon to run on Alpine Linux

X-Ray is a managed distributed tracing service by Amazon Web Services. Your application (whether it’s a single API or made up of multiple distributed microservices) collects data (such as timing and metrics for business logic, SQL queries and calls to AWS services) whilst processing incoming requests and then sends this data to a local deamon over UDP which in turn forwards the data onto the X-Ray service.

I’ve been experimenting with bundling the X-Ray deamon into an Alpine Linux container alongside some other binaries however out of the box it didn’t work. Attempting to execute the xray binary would result in a confusing error message like this:

sh: /xray: not found

After some Googling I discovered the ldd command which is used to find the shared libraries that a binary calls.

Executing ldd xray I get the following output:

/ # ldd xray
/lib64/ld-linux-x86-64.so.2 (0x55a247c9b000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x55a247c9b000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x55a247c9b000)

This first library that the X-Ray binary attempts to call is /lib64/ld-linux-x86-64.so.2.

If I list the contents of / I can see that the /lib64 directory isn’t present out of the box with Alpine:

/ # ls
bin    dev    etc    home   lib    media  mnt    proc   root   run    sbin   srv    sys    tmp    usr    var

My understanding is that this is because Alpine Linux uses musl libc instead of GNU libc and the xray binary is linked against GNU libc libraries.

Alpine provides a package called libc6-compat which provides compatibility libraries for glibc as well as symlinks /lib64 to /lib. This can be installed with the command apk add libc6-compat.

After installing libc6-compat the X-Ray deamon now runs successfully.

Coding Solo episode 4

In episode four of Coding Solo, David and I have a nice ol’ chat about our feelings when it comes to working on side projects. We also discuss taking time off from work and answer some more listener emails.

Please do send us any feedback you have especially if there any topics you feel we should cover or any questions you’d like us to answer about freelancing. You can email us at feedback@codingsolo.works.

Looking for a new maintainer of league/oauth2-server

A little over five years ago I pushed the first commit for the project that eventually became league/oauth2-server.

The project has been downloaded over 2.5 million times, has more than 3000 Github stars and has been contributed to by 77 awesome people across some 2000 commits.

Last year when I became self-employed I had intentions that I’d have more time to dedicate towards open source projects but reality worked out slightly differently and I’ve had one of the busiest (and best) years of my life.

The other principal factor is truth be told I don’t actively use the project any more. This past year I’ve become more of a programming language polyglot and I’ve written more lines of JavaScript, Swift and Go than I have PHP.

That the project has stagnated somewhat has started to bother me greatly. Therefore I believe it is now time to hand over the reigns to someone who can devote more time and energy to the project than I’ve been able to.

I’ve no deadline for finding someone - I want to find the right person (or group of people) who is/are really impassioned by the project, want to advance the project (for example implement OpenID support) and are willing to devote time to answering support requests and review pull requests.

If you reading this are that person, or you know someone who might be please email me - hello@alexbilbie.com - I’d love to have a chat with you.

Coding Solo episode 3

In episode 3 of Coding Solo David and I talk about finding work, doing the work, invoicing for the work and hopefully getting paid on time for the work.

Please do send us any feedback you have especially if there any topics you feel we should cover or any questions you’d like us to answer about freelancing. You can email us at feedback@codingsolo.works.

Coding Solo episode 2

David and I are back with a new episode of our podcast about freelancing in the UK, Coding Solo.

In this episode we talk about setting up to go solo including setting up a limited company, find a bank that doesn’t suck, discussing how expenses and dividends work, how much accountants generally cost and how to run your company from an expenditure perspective.

Please do send us any feedback you have especially if there any topics you feel we should cover or any questions you’d like us to answer about freelancing. You can email us at feedback@codingsolo.works.