Question

My Infrastructure is becoming messy and expensive

I’m not very experienced with DevOps and I get frustrated very easily when things aren’t working. I wish Digital Ocean offered consulting services so I can just pay someone to set things up correctly…

Anyways, I’m hoping someone can provide guidance on what I should do with my infrastructure since I have multiple Apps running and multiple databases and multiple droplets and It’s frustrating to say the least.

  1. I have a “Production” APP that has two servers (frontend,backend) and a managed DB cluster.

  2. I have “Development” APP that is pretty much a duplicate of the production APP for my remote development team to access for testing.

  3. 2 Droplets that are running a chat engine (One for each of the Development and Production APP). Each Droplet runs it’s own Database

And now I’m in a situation where I need ElasticSearch engine for production and and development and DO only offers 1-click deployment for another APP. So that will be 2 more Apps. And none of theses can even communicate over VPS so it’s just getting bulky. Seems like I should get rid of the APPs and just manage everything myself but that’s beyond my experience and could take me weeks to get.

Does this setup sound normal enough or am I just digging myself into a hole by continuing to build more stuff onto this already bulky-looking infrastructure?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
July 26, 2024
Accepted Answer

Hey!

One option that you could consider here is to transfer over your dev environment to a single Droplet. That way you will cut your infrastructure costs for your dev environment, but still keep your production app running on the App Platform so you can take advantage of the scalability and the operational efficiency.

For your dev environment, you could use Docker to containerize your applications. Docker containers can run anywhere, making it easier to manage dependencies and reduce the number of servers you need.

So you will be able to have all of your services running on a single Droplet as Docker containers. You could even use Docker compose for easier management of all containers.

DigitalOcean offers 1-Click installation image for Docker:

https://marketplace.digitalocean.com/apps/docker

Here is a simplified Docker compose file that packages all of your services together:

version: '3.8'

services:
  frontend:
    image: node:14
    working_dir: /app
    volumes:
      - ./frontend:/app
      - /app/node_modules
    ports:
      - "3000:3000"
    command: sh -c "npm install && npm start"
    depends_on:
      - backend

  backend:
    image: python:3.9
    working_dir: /app
    volumes:
      - ./backend:/app
      - /app/venv
    ports:
      - "5000:5000"
    command: sh -c "pip install -r requirements.txt && flask run --host=0.0.0.0"
    environment:
      DATABASE_URL: "postgres://user:password@db:5432/devdb"
      ELASTICSEARCH_URL: "http://elasticsearch:9200"
    depends_on:
      - db
      - elasticsearch

  db:
    image: postgres:13
    volumes:
      - db_data:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: devdb
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
    ports:
      - "5432:5432"

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.10.0
    environment:
      - discovery.type=single-node
    ports:
      - "9200:9200"

volumes:
  db_data:

Overview:

  • frontend: This service uses a Node.js image and mounts the local frontend directory to the container’s /app directory. It also exposes port 3000 and installs dependencies before starting the application.
  • backend: This service uses a Python image, mounts the local backend directory to the container’s /app directory, and exposes port 5000. It sets environment variables for the database and ElasticSearch URLs and installs dependencies before starting the Flask application.
  • db: This service uses a PostgreSQL image, sets up a database named devdb, and mounts a Docker volume for persistent storage. It exposes port 5432.
  • elasticsearch: This service uses an ElasticSearch image, sets it to run in single-node mode, and exposes port 9200.
  • volumes: Defines a named volume for PostgreSQL data storage.

And for your production environment, you could keep things as they are as that way you can take advantage of all of the production-ready features that the App Platform offers along with the managed database.

Let me know if you have any questions!

- Bobby

alexdo
Site Moderator
Site Moderator badge
July 30, 2024

Heya,

You can consider using*Kubernetes to orchestrate and manage your applications. Kubernetes allows you to manage both your development and production environments on the same platform, providing benefits such as:

  • Automated Scaling: Scale your applications automatically based on traffic and load.
  • Simplified Deployment: Use CI/CD pipelines to automate deployments and rollbacks.
  • Resource Efficiency: Efficiently allocate resources to your applications to reduce costs.
  • High Availability: Easily achieve high availability by running multiple replicas of your services.

DigitalOcean Kubernetes (DOKS) is a managed Kubernetes service. Deploy Kubernetes clusters with a fully managed control plane, high availability, autoscaling, and native integration with DigitalOcean Load Balancers and volumes. DOKS clusters are compatible with standard Kubernetes toolchains and the DigitalOcean API and CLI. It also offers integration with their other services, like Load Balancers, Block Storage, and more. It can be a strategic move to optimize and potentially reduce your infrastructure costs.

Hope that this helps!

KFSys
Site Moderator
Site Moderator badge
July 25, 2024

Heya @happygrayangler,

Depending on how big is the App and it’s Database, it might be worth it moving your Databases to a Droplet and taking backups of the Droplet to prevent data loss.

Additionally, again depending on the Application and how heavy it is, it might be worth having one server for both frontend and backend to save cost and the time to manage all by them being in different places.

If however your App is quite big, the solution you’ve come up with is a standart one where it’s almost everywhere used liked that.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.