In case IDs of an entity needs to be exposer via Spring RestRepository the following configuration class can be used:
@Configuration
public class RestConfig implements RepositoryRestConfigurer {
/*
* (non-Javadoc)
*
* @see org.springframework.data.rest.webmvc.config.RepositoryRestConfigurer#
* configureRepositoryRestConfiguration(org.springframework.data.rest.core.
* config.RepositoryRestConfiguration)
*/
@Override
public void configureRepositoryRestConfiguration(final RepositoryRestConfiguration config) {
config.exposeIdsFor(MyEntity.class);
}
}
Here you can find tips and solutions about different technnologies such as Java, Spring, Kubernetes, Databases... based on my experience working on several software projects.
Monday, September 23, 2019
Friday, August 30, 2019
Deployment of MySQL in Kubernetes
Here is a simple example of deployment for a MySQL database instance in Kubernetes.
https://github.com/rafareyeslopez/mysql-kubernetes
https://github.com/rafareyeslopez/mysql-kubernetes
Deployment of PostgreSQL in Kubernetes
Here is a simple example of deployment for a PostgreSQL database instance in Kubernetes.
As said this is a simple example, some things can be improved like using "secrets" for the credentials.
https://github.com/rafareyeslopez/postgresql-kubernetes
As said this is a simple example, some things can be improved like using "secrets" for the credentials.
https://github.com/rafareyeslopez/postgresql-kubernetes
Thursday, March 7, 2019
Using PostgreSQL instead of MySQL , low memory required (Docker images)
In case for testing purposes a relational database is needed and do not have a lot of memory free I have done a test using Mysql docker image and PostgreSQL image. PostgreSQL has an alpine image wich MySQL at the moment does not.
The memory consumption is much less for PostgreSQL as can be seen below:
For MySQL one:

For PostgreSQL:
To run postgres with docker command execute:
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_USER=user -e POSTGRES_DB=database -d postgres:alpine
The memory consumption is much less for PostgreSQL as can be seen below:
For MySQL one:
For PostgreSQL:
To run postgres with docker command execute:
docker run --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=password -e POSTGRES_USER=user -e POSTGRES_DB=database -d postgres:alpine
Etiquetas:
docker,
memory,
MySQL,
PostgreSQL
Tuesday, January 15, 2019
Docker Machine hosts as alternative to regular Virtual Machines
From some time ago was used to utilize VirtualBox for creating virtual machines in order to play around with some environments. For example, as using Windows and need to do something in a Linux distribution.
From the arrival of docker and the containers now we can have a "vistual machine" running and being managed kind of as a docker image.
From docker documentation : "Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with
From the arrival of docker and the containers now we can have a "vistual machine" running and being managed kind of as a docker image.
From docker documentation : "Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with
docker-machine commands. "
NOTE: this example is under Windows 10 OS
First of all we need to have Docker for Windows installed.
Something else we need is to have a Hyper-V enabled and correctly configured, for this docker documentation can be followed for Microsoft Hyper-V
Once we have all that the only thing left would be to execute in the command line something like this:
docker-machine create --driver hyperv devops-vm
There are much more options that can be added so feel free to check the documentation.
Now we have the docker machine up and running in order to use it we have to make docker execute the commands against it, this can be achieved by using the docker-machine env command
docker-machine env devops-vm
When executed will tell you what command you have to run next to use your docker machine
Now if command docker-machine active is executed the docker machine we wanted is the one which is active and docker commands will be executed against it, for example a docker-compose file.
Subscribe to:
Posts (Atom)