RSSAmplifier

Blog

Piotr Nowicki's Blog

Recent content on Piotr Nowicki's Blog

piotrnowicki.comRSS feed ↗122 posts

Latest posts

Keeping AI agents like OpenCode as separate environment (in Docker)

Why should you keep your AI agent in a separate environment? For security!

Keeping AI agents like ClaudeCode as separate OS user

Why should you keep your AI agent as a separate OS user? For security!

Finding why 'du' and 'df' shows different values?

How to find out what takes disk on your device if ‘du’ and ‘df’ shows different values.

Finding your device in a network using nmap

How to find your device in a network if you don’t know what IP it has been assigned?

Solving problem with «The container name ... is already in use by container»

How to deal with container naming issue during update of container version

Create Linux auto-restartable service on file change

How to create a systemd service that will be automatically restart whenever some configuration file changes?

Private AWS ECR with custom domain, credHelper and Cognito

Let’s make it all work: private AWS ECR repository + custom external domain + ECR Credentials Helper Login + control permissions to fetch your images via Cognito

Private AWS ECR with custom domain

How to be able to use your custom domain when accessing docker repository hosted in private AWS ECR.

About

My name is Piotr Nowicki and this page is my blog mainly about Java related technologies. If you’re interested in my experience with Oracle Certification Program, you can visit my after-exam stories published on JavaRanch Forums: AWS Certified Solutions Architect – Associate Oracle Certified Professional, Java SE 6 Programmer , Oracle Certified Master, Java SE 6 Developer , Oracle Certified…

Configuring LUKS to work with YubiKey

How to configure LUKS (full disk encryption) to work with your YubiKey (FIDO2) so you can unlock your disk without typing password.

Plymouth - customize Linux loading splashscreen

How to customize the Linux loading splashscreen using Plymouth and its themes.

Using rEFInd instead of GRUB as Boot Manager

How to replace GRUB with rEFInd as a boot manager on your Linux machine.

How to configure Logz.io log shipper for Quarkus-based Lambda using logback extension

You have a Quarkus-based AWS Lambda using logback and want to send logs to logz.io? Then this is something for you!

How to configure Logz.io log shipper for Cloudwatch (and your Lambda) using AWS CDK

You have your Lambda on AWS. Now you want to view the logs in Cloudwatch and you probably know this is not the most pleasant thing to do. But wait, there are things like Logz.io - an ELK service that makes viewing logs a breeze. Let’s see how to connect logz.io log shipper that will push your Lambda logs from cloudwatch to their ELK stack.

InitiateAuth and RespondToAuthChallenge to confirm user password and authenticate in AWS Cognito using plain HTTP calls

How to configure a new user password in AWS Cognito using plain HTTP calls?

Rollback to previous version of a docker image in AWS ECR

How to easily revert to previously deployed docker image in case new version of your app behaves abnormally?

InitiateAuth to authenticate in AWS Cognito using plain HTTP calls

How to authenticate in AWS Cognito using plain HTTP calls?

Configuring AWS Cognito as authenticator for React.js frontend -> Serverless Framework Lambda behind Api Gateway

Notes to my future-self about how to configure React.js frontend guarded by AWS Cognito to securely communicate with backend based on Serverless Framework (AWS Lambda behind Api Gateway).

Encoding issues during PostgreSQL backup restore

Issues I bumped into during restoration of a PostgreSQL backup.

Docker multi-architecture - weird 'linux/arm/v7 not supported error'

Root cause of a weird ’linux/arm/v7 not supported error'.

Serverless - Using Lambda Triggered by SQS For Job Scheduling

Imagine your code waits for some external system to respond. Easy to deal with non-serverless world where you have your application running 24/7, right? But how would you solve this in a serverless where you should pay for actual job and not for waiting. In serverless ‘wait’ equals ’loosing money’. In this post I’ll describe how you can use SQS for serverless job…

Configuring AWS Systems Manager (SSM) Variables and Using Them From CodeBuild

AWS Systems Manager (formerly SSM) allows you to define secure, encrypted variables that you can read from other processes. Here, I’ll shortly discuss how to define such encrypted varible and read it from AWS CodeBuild.

Excluding Resources When Preparing Package for Serverless Application

With Serverless Framework application it’s not enough to add proper gitignore statements. You also need to take care of properly defining what should go and what should not go into your package or you can easily end with 100 MB packages.

AWS Serverless Integration Tests With Moto - What Can go Wrong?

If you’re planning to use Python moto library (to mock AWS resources) for unit tests and at the same time use integration tests - watch out as it can bite you!

Local Development and Testing of AWS Serverless Application

Is it possible to create local environment for Serverless application? And if it is possible - is it worth the effort?

Sample CI/CD Configuration for Serverless Application on AWS

How to effectively use stage promotions for your Serverless application. Article includes description of example CI/CD pipeline on AWS.

Configuring DynamoDB tables per deployment stage using Serverless Framework

Example how to name per-stage DynamoDB tables

Defining CodeBuild runtime in buildspec.yml

Short introduction to AWS CodeBuild runtime images

MultiWAN on OpenWrt / LEDE

If you have OpenWrt installed on your home router and you’d like to have a backup internet connection or a secondary WAN connection (e.g. to do a load-balancing between multiple WANs) then you might be interested in this post. I will describe steps I needed to do in order to configure 2 WAN connections used simultaneously: one coming from cable modem and second one from USB LTE modem Huawei E3272…

Mock exam for SCWCD / OCE JEE6: JSP and Servlet Developer Exam is back alive

Years ago I was learning to pass Oracle Certified Expert, Java EE 6: JSP and Servlet Developer Exam (formerly Sun Certified Java Web Component Developer.) At that time this exam was so fresh that there were no mock exams available. Hence, I’ve decided to create one. The idea was to learn and help others learning for this exam at the same time. Mock exam was published on OpenShift ’s…

Enabling CORS in API Gateway Requires Method Response

You can enable CORS in API Gateway through AWS Console with few simple clicks: However there are some restrictions regarding when you can invoke this. You need to remember that all this function is doing is just adding some headers like Access-Control-Allow-(Headers|Methods|Origin) to your API Gateway response. To do this, it needs to modify the “Method Response” section of your…

Trailing slash in REST API DOES matter

This is like a reminder to myself but assumed others might also be interested in it. When designing REST API, remember that every character in the URI is important and constitutes unique resource. Hence: http://your-server.com/api/cars is different than http://your-server.com/api/cars/ AWS API Gateway is not different in this case, so pay extra attention as you define e.g. triggers for your…

Enabling CORS For Local AWS API Gateway

If you’d like to use CORS in your AWS API Gateway, it’s pretty easy to configure in the Console. You just select the resource (or the root if you’d like to enable it for all resources) and select Actions -> Enable CORS, like this: If you’re using SAM, it might be much more useful for you to define it within the SAM template file directly, as described in the documentation .

AWS CodeStar and Cloud Formation Parameterization

I’m in the process of getting familiar with AWS and Serverless architecture and thought I’ll share some basics with you. I have created a sample project using AWS CodeStar that utilizes Python and AWS Lambda. When analyzing the buildpsec.yml and template.yml I found that in template.yml you don’t have any CodeUri location that would point to the artifact used by Lambda. At the…

AWS Lambda Local Invocation Using SAM Local and Localstack

The biggest struggle I had in my mind when thinking about serverless and AWS itself was - how the hell to properly test it and create development environment? There is no way to hit production without properly and in easy way testing all parts of AWS services. I could identify 2 biggest players in this area: “delivered by AWS directly - SAM Local (abbreviation of Serverless Application…

Jackson JSON Processor for Payara JAX-RS serialization/deserialization

Want to use Payara / Glassfish with JAX-RS and Jackson to serialize/deserialize objects to/from JSON? Pay extra attention as it might bite you as it had bit me. I was more than sure that Payara is using Jackson as JSON processor (I’ve checked pom.xml dependencies of Payara and found that Jackson 2.5.1 is defined there). Therefore, I started using all those nice @JsonProperty or…

Prepare Your Application for Slow Network Connection

Some time ago I started to play with AngularJS to create a simple side-project app. During this work I realized that I don’t like the differences between how the application works depending on the environment where I deploy it (localhost - faster and Docker on VPS - slower). The UX was quite poor for slower network connection and I decided to do something about that. The user experience was…

Keycloak on Docker with Nginx SSL proxy

JBoss Keycloak is available as a Docker image . It’s all fun and games until you’ll try to run it behind SSL reverse proxy like I do for all my services. Despite settings all required HTTP headers on the proxy side (Nginx in my case) like: proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For…

How Obeying to TDD Saved me Time

Obeying to the TDD (Test Driven Development) saved me a lot of time so I decided to write about it. It nicely shows the real-life advantage you can get from following TDD. Now, to keep it short - few days ago I was writing some business logic that did some audit recording changes. For the sake of brevity imagine it was something between those lines: public void recordAudits (Data data) { if (data.…

Boolean methods and variables

When you have some non-trivial boolean statement used in if like: private void evict (Data data) { // ... if (data. getDate () >= MATURITY_DATE && data. type == DataType. UNDEF ) { // do the eviction } } To make it easier to read and maintain, it’s a good idea to extract it to a local variable or method: private void evict (Data data) { // ... boolean isEligibleForEviction = data. getDate ()…

New blogging platform

I’ve finished the migration process of my blog. I’ve decided to get rid of the Wordpress, as I was not using even 20% of its features and, moreover, it felt a bit too heavy for my needs. I’ve decided to give Jekyll a try and therefore moved to the static website generation. It should save a lot of bandwidth and time for each post to load. It is also more simple (not to say…

IntelliJ IDEA Working Directory

When you’re switching from one IDE to another, even if the codebase is the same, some differences might occur. This happens e.g. when using relative paths. Assume you have a multi-module Maven project with a structure somewhat like below: +—myApp | \—myApp.component | \—myApp.component.business Trying to execute in IDE the following code present in the myApp.component.business : private final…

Quick Glance at JArchitect

Few months ago Dane from JArchitect team was kind enough to provide me with a license for JArchitect 3.1.0 Professional Edition , a multiplatform (GNU/Linux, Mac, Windows) software for static code analysis. While I was really swamped with my every-day work (and personal life) I didn’t have really much time to take a closer look at it that time. Few days ago I’ve said to myself…

Asynchronous CDI Events

Few days ago, during our regular code review, one of my colleagues raised a question what would happen – and if it’s even possible – when a CDI Observer (so a method with parameter annotated @Observes ) would be invoked multiple times at the same time for different event instances. In other words, after producing few events, is it possible that the following method will be…

Java EE 7 -- JMS 2.0 With Glassfish v4

Java EE 7 has been recently accepted by the Executive Committee . This means that soon we should have Java EE 7 application servers available on the market. One of the specifications that constitutes Java EE 7 is JMS 2.0 . Some interesting improvements were introduced since version 1.1. JMS has a lot of weird stuff like: Connection#createSession(boolean transacted, int acknowledgeMode) method.…

EJB Inheritance is Different From Java Inheritance

Despite the fact that EJB inheritance sometimes uses Java inheritance – they’re not always the same. Just as you could read in my previous post , EJB doesn’t have to implement any interface to expose a business interface. The other way around is also true – just because EJB is implementing some interface or extending other EJB doesn’t mean it exposes all or any of its…

Defining EJB 3.1 Views (Local, Remote, No-Interface)

This post will talk about possible ways of defining EJB views using annotations (I’ll just mention about using EJB Deployment Descriptor at the end.) I’ll focus on the most current EJB 3.1 views omitting legacy local, remote and home interfaces. Therefore, we can choose between: remote business interface view, local business interface view, no-interface view. I won’t discuss…

Entities as Local Interface Parameters Can Harm You

Let’s start with a short quiz. TxMergeBean is a SLSB that uses CMT and EntityManager . Assume the following local and remote business interfaces: public interface TxMergeCommon { void methodA (); void methodB (MeineEntity entity); } @Local public interface TxMergeLocal {} @Remote public interface TxMergeRemote {} and the following SLSB: @Stateless public class TxMergeBean implements…

JPA and CMT -- Why Catching Persistence Exception is Not Enough?

Being in EJB and JPA world using CMT ( Container Managed Transactions ) is very comfortable. Just define few annotations to demarcate transaction boundary (or use the defaults) and that’s it – no fiddling with manual begin, commit or rollback operations. One way to rollback your transaction is to throw non-application exception (or application exception with rollback = true ) from your…

Using JGroups Directly From JBoss AS 7 Component

UPDATE (5.08.2013) – I’ve updated this post to support JBoss EAP 6.1 Final (JBoss AS 7.2). Enjoy UPDATE (2.09.2013) – Bela Ban pointed to his very interesting post about new ForkChannel feature and easy channel hijacking directly from JBoss AS / Infinispan. Read about it here JGroups is Bela Ban ’s piece of software for reliable message exchange that is highly configurable…