Deploying docker image to AWS Fargate in GitHub

Let’s deploy a docker image to AWS ECR and further to AWS Fargate. If you don’t have docker installed, now is the time to do it. GitHub Action YML: Create a workflow named main-aws.yml, for example as: name: Deploy to Amazon ECS on: workflow_dispatch: env: AWS_REGION: eu-central-1 # set this to your preferred AWS region, e.g. us-west-1 ECS_SERVICE: test-svc # set this to your Amazon ECS service name ECS_CLUSTER: test-fargate-dev # set this to your Amazon ECS cluster name ECS_TASK_DEFINITION: ....

December 9, 2024 · 5 min · Alex Popescu

PostgreSQL Web UIs in docker

Let’s install and configure PgHero and PgAdmin4 in docker to connect to the databases deloyed in the previous post. If you don’t have docker installed, now is the time to do it. PgHero: Create the config for PgHero pghero.yml : databases: database1: url: postgres://dummy:123456@10.0.0.3:5432/postgres database2: url: postgres://dummy:123456@10.0.0.4:5432/postgres And run the docker command to start it: docker run -it -d -v $(pwd)/pghero.yml:/app/config/pghero.yml -p 8080:8080 ankane/pghero If everything is ok, you should see:...

November 25, 2024 · 1 min · Alex Popescu

PostgreSQL Replication and Loadbalancing

Create 3 servers on the cloud of choice. This is a diagram of the servers: Node 1 On Node 1 we install postgres, start the postgresql service and add the port to firewall: sudo apt install -y postgresql sudo systemctl enable postgresql sudo systemctl start postgresql sudo systemctl status postgresql sudo ufw allow from 10.0.0.0/16 to any port 5432 Next, we open psql to create the replication user: sudo -u postgres psql CREATE USER ruser REPLICATION LOGIN CONNECTION LIMIT 3 ENCRYPTED PASSWORD 'rpassword'; CREATE USER dummy WITH SUPERUSER PASSWORD '123456'; We should open /etc/postgresql/14/main/pg_hba....

November 17, 2024 · 10 min · Alex Popescu

Developing a Sample TODO API with Couchbase in Docker

Have you ever wanted to run Couchbase on Docker to freely build and test your app? Here’s a simple guide to help you set up Couchbase in Docker and build a sample TODO app using Python and FastAPI. Developer Cluster Setup First, let’s create a minimal docker-compose.yml file to spin up Couchbase: services: couchbase: image: couchbase:latest container_name: couchbase ports: - "8091:8091" # Couchbase Web Console - "8092:8092" # Query Service - "8093:8093" # Full Text Search - "11210:11210" # Data Service environment: COUCHBASE_ADMINISTRATOR_USERNAME: admin COUCHBASE_ADMINISTRATOR_PASSWORD: password volumes: - couchbase_data:/opt/couchbase/var - ....

October 27, 2024 · 5 min · Alex Popescu

Almost Wrong Way To Send Docker Containers logs To ELK

In this article, we’ll walk through setting up a Docker-based ELK (Elasticsearch, Logstash, and Kibana) stack to collect, view, and send Docker logs. services: elasticsearch: image: elasticsearch:7.17.24 environment: - discovery.type=single-node volumes: - ./elasticsearch_data/:/usr/share/elasticsearch/data mem_limit: "1g" redis-cache: image: redis:7.4.0 logstash-agent: image: logstash:7.17.24 volumes: - ./logstash-agent:/etc/logstash command: logstash -f /etc/logstash/logstash.conf depends_on: - elasticsearch ports: - 12201:12201/udp logstash-central: image: logstash:7.17.24 volumes: - ./logstash-central:/etc/logstash command: logstash -f /etc/logstash/logstash.conf depends_on: - elasticsearch kibana: image: kibana:7.17.24 ports: - 5601:5601 environment: - ELASTICSEARCH_HOSTS=http://elasticsearch:9200 depends_on: - elasticsearch ElasticSearch Just create a folder named elasticsearch_data for storing data....

October 16, 2024 · 3 min · Alex Popescu