Keeping AI agents like OpenCode as separate environment (in Docker)
Why should you keep your AI agent in a separate environment? For security!
Recent content on Piotr Nowicki's Blog
Why should you keep your AI agent in a separate environment? For security!
Why should you keep your AI agent as a separate OS user? For security!
How to find out what takes disk on your device if ‘du’ and ‘df’ shows different values.
How to find your device in a network if you don’t know what IP it has been assigned?
How to deal with container naming issue during update of container version
How to create a systemd service that will be automatically restart whenever some configuration file changes?
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
How to be able to use your custom domain when accessing docker repository hosted in private AWS ECR.
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…
How to configure LUKS (full disk encryption) to work with your YubiKey (FIDO2) so you can unlock your disk without typing password.
How to customize the Linux loading splashscreen using Plymouth and its themes.
How to replace GRUB with rEFInd as a boot manager on your Linux machine.
You have a Quarkus-based AWS Lambda using logback and want to send logs to logz.io? Then this is something for you!
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.
How to configure a new user password in AWS Cognito using plain HTTP calls?
How to easily revert to previously deployed docker image in case new version of your app behaves abnormally?
How to authenticate in AWS Cognito using plain HTTP calls?
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).
Issues I bumped into during restoration of a PostgreSQL backup.
Root cause of a weird ’linux/arm/v7 not supported error'.
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…
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.
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.
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!
Is it possible to create local environment for Serverless application? And if it is possible - is it worth the effort?
How to effectively use stage promotions for your Serverless application. Article includes description of example CI/CD pipeline on AWS.
Example how to name per-stage DynamoDB tables
Short introduction to AWS CodeBuild runtime images
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…
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…
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…
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…
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 .
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…
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…
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…
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…
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…
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.…
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 ()…
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…
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…
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…
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 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.…
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…
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…
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…
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…
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…