By Xxxdev
I have no experience on hosting, Could you help me to use DigitalOcean services in an effective way.
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!
Heya,
Well, it might be a bit too much for everything but using some docker images it should be doable.
Here are some steps how to do that.
Go to DigitalOcean dashboard
Click “Create” → “Droplet”
Choose Ubuntu 24.04 (good choice, latest and stable)
Choose a cheap plan (like $4 or $6/month) to start
Add your SSH key if you have one (or use password login for now)
From your local machine:
ssh root@your_droplet_ip
Once inside the droplet, install Docker:
sudo apt update
sudo apt install docker.io -y
sudo systemctl enable docker
sudo systemctl start docker
Also install Docker Compose (helpful for multi-container apps):
sudo apt install docker-compose -y
docker-compose.yml
In your project folder (/home/youruser/app
or wherever):
version: '3.8'
services:
postgres:
image: postgres:14
restart: always
environment:
POSTGRES_USER: youruser
POSTGRES_PASSWORD: yourpassword
POSTGRES_DB: yourdb
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5432:5432"
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.1
environment:
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms512m -Xmx512m
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- elastic-data:/usr/share/elasticsearch/data
ports:
- "9200:9200"
backend:
build: ./backend
restart: always
env_file:
- ./backend/.env
depends_on:
- postgres
- elasticsearch
ports:
- "4000:4000"
frontend:
build: ./frontend
restart: always
env_file:
- ./frontend/.env
depends_on:
- backend
ports:
- "3000:3000"
volumes:
postgres-data:
elastic-data:
Folder structure:
project/
├── backend/
│ ├── Dockerfile
│ └── (Node.js backend files)
├── frontend/
│ ├── Dockerfile
│ └── (Next.js frontend files)
├── docker-compose.yml
Dockerfile
for backend (backend/Dockerfile
)FROM node:20
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
Same idea for frontend (you may want npm run build
then npm run start
for production).
From the project folder:
docker-compose up -d
Now:
Frontend is on http://your_droplet_ip:3000
Backend is on http://your_droplet_ip:4000
PostgreSQL at localhost:5432
Elasticsearch at localhost:9200
Install Nginx and set up reverse proxy to serve frontend and backend on ports 80/443.
Use Certbot to get HTTPS certificates.
Consider volumes for data persistence (already in the compose).
Monitor RAM and CPU — especially Elasticsearch memory.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
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
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.