How to use a launch template in AWS Batch compute environment with custom user_data file

AWS Batch is a service from AWS to run batch processes on custom compute environments.

Among all the services I’ve used on AWS, Batch is, in my opinion, the most rough and less integrated with Terraform. One example of how Batch isn’t the most shining service in the AWS world is the integration between the Batch compute environment and the EC2 launch template.

Read More »

Complete backup of a SmugMug account

I’m a happy customer of the SmugMug service where I store all my photos (~50GB divided in ~120 galleries).

I really love their interface, the mobile app, the website, etc. but they miss a very important feature IMHO: it’s not possible to make a complete download of all the photos.

That’s why I wrote a program that does it.

Read More »

How to add a JS frontend to an API-only Phoenix app

If you generated a Phoenix app with the --no-brunch option you probably needed an API backend app.

What if, with your app growing, you realize you’d like to add also some frontend code? This short how-to will show you how integrate a Webpack based app with support to Typescript, React and Sass.

Read More »

API Authentication with Phoenix and React - part 2

In the first part of this post I’ve shown how to configure the API server to let the user authenticate, return an authentication token, and request it to access protected routes. Now I’m going to configure a React app to consume that API and manage authentication. The app uses React Router to manage routes and Redux for the state of the app. Protect private routes I’m going to define a PrivateRoute component as a wrapper around Route.

Read More »

API Authentication with Phoenix and React - part 1

Scenario: you just wrote a cool web app using React for the frontend part and Phoenix as the API server. Then you realize everybody can poke around your stuff and you decide it’s time to restrict the access to known users, how to do it? I’ll configure a Phoenix server to manage access tokens, used by a React app to make authenticated calls. This blog post only deals with the backend part and consists of these steps:

Read More »

React+Sass+Typescript with Phoenix framework using Webpack

If you’re playing with Elixir and Phoenix you’ll probably already know that Phoenix uses Brunch.io to build the assets pipeline. I initially started building my app with React / Redux + SASS and I was quite happy, but when I decided to add Typescript to the recipe, I found Brunch.io wasn’t very helpful! I’ve already used these tools using Webpack as building tool, so I decided to switch to it. I had a working Webpack configuration I was using in other projects, so I only had to find out how to apply it to Phoenix.

Read More »

How to logrotate rails logs

If you deploy a rails app forgetting to configure logs automatic rotation, few weeks later won’t be difficult to find something like this: $ ls -lh log/production.log -rw-rw-r-- 1 www-data www-data 93,2M apr 10 17:49 production.log Think if you have to find some error log inside a 100MB file, not easy… :) Setting log rotation isn’t difficult at all. I know two main ways. Use syslog This is a really easy solution.

Read More »

Generate the sitemap of a Ghost blog during deploy

Waiting for a sitemap generator inside the core of Ghost (planned as “future implementation”) I decided to implement a way to generate an up-to-date sitemap.xml during deployment. As you can read in the previous post I’m deploying this blog with Capistrano and capistrano-node-deploy. So I added a deploy:generate_sitemap task which is executed at the end of the deployment process. This is the Capfile extract: namespace :deploy do task :generate_sitemap do run "cd #{latest_release}&& .

Read More »

Git: Content-addressable filesystem and Version Control System

GIT: Content-addressable filesystem and Version Control System from Tommaso Visconti

Read More »

Paypal Express Checkout with Ruby on Rails and paypal-sdk-merchant

In my last work, Agrimè.it, an ecommerce built using Ruby on rails, I had to implement the cart payment using Paypal Express Checkout. Sadly, I found that was the worst time to do it, because Paypal was migrating the classic API to the new REST API and the documentation was a real mess! Walking through the doc links, I jumped (without a particular logic) from the new to the old API reference and vice versa.

Read More »