When working with serverless actions, often we'll still need to access some sort of service, whether it's object storage, a database, or whatever. Here's a quick overview of how this works for IBM Cloud Functions (plus some gotchas ....) Continue reading
One of the best features of CouchDB is its change feed which allows us to get a feed of the changes happening on our database. It's also possible to have a serverless function (examples are for IBM Cloud Functions but should also work for Apache OpenWhisk) that fires in response to activity on that change feed. I have a database of events that I want to react to when they happen, but the change feed doesn't include the actual document that was added - but you can add one of the built-in functions to a sequence to make that happen. This post will show how to achieve this by wiring up a built-in action to fetch the document with another action of our own that then handles the data. Continue reading
Did you know you can serverless with PHP? OK, so serverless is clearly not a verb, but since I love serverless tech and have also loved PHP for longer than I'm going to admit (the dates of the earliest posts on this blog might serve as a clue), using these technologies together is definitely my idea of a good time.
I included an example of a serverless endpoint to receive incoming webhooks in my talk at PHPUK last week and I got a few questions about it so I thought I'd share that example in written form. Continue reading
I'm a Developer Advocate (you might also hear job titles like Developer Relations, Developer Evangelist) and I'm constantly asked what that means. What do I do? The answer is different for every one of these jobs but there are some common themes. After 18 months of practice at answering this question, I think I'm ready to give it a go. Continue reading
I couldn't find the script I needed to migrate my existing related-post data to a new plugin so I fiddled about and wrote a rather hacky one. I thought I'd share it in case someone else needed it! Continue reading
I'm a regular and happy user of Apache CouchDB, so much so in fact that I'm writing a library to talk to it from PHP. While working on tweaking a feature, I realised that the laptop I use for development didn't have the right/enough data on it to test this particular thing - but that I had a suitable database on my other laptop. Copying data between CouchDB installations is very easy because it has an HTTP API, but usually when I do this at least one endpoint is web-accessible. Enter one of my favourite tools: ngrok.
Ngrok allows me to make the CouchDB on one machine visible to the world (with all the security caveats that this entails! It's a random URL, never leave the tunnel open longer than you need it, etc) with a command like this:
ngrok http 5984
This opens a tunnel to my local machine on port 5984 which is CouchDB's default port. I'm running a local dev instance that doesn't need a username or password which makes this simpler if not exactly secure. I get a gobbledeegook ngrok URL that will allow anyone, anywhere to talk to my CouchDB.
Then I went ahead and on the other laptop, used the web interface to start replication from the sample products database on the local machine over to the one on the ngrok URL.
As soon as it starts, the first laptop shows that there's traffic coming over the ngrok link - and a few minutes later I had the database I wanted and can go ahead and work on this feature.
I have the pleasure of using Slack Enterprise Grid on a daily basis as IBM has adopted it internally, I work there, and there are far too many of us to use a single slack instance. The main downside of Slack Enterprise Grid (apart from having about 15 slack organisations running in your client all the time) is that it returns different data when integrating with the Slack Web API and RTM (Real Time Messaging) systems. We had some bot integration that stopped working as a result, and I ended up moving to BotKit and then using a mixture of the RTM and Web API from Slack to get things to work. I won't remember how I did it so I thought I'd better write it down. Continue reading
I'm working on a CouchDB library for PHP, and so I needed to write some tests for it. CouchDB has an HTTP API so I'm basically making web requests and while I could certainly set up a test database and run full-on integration tests, there are a few limitations with that approach. Firstly: it means I'm testing the database as well, which isn't what I want and brings extra dependencies that make the tests harder to run. Also: I want to be able to test error cases, rate limiting and so on, that would be difficult to recreate reliably. Continue reading