Comprehensive Guide to Online Environment Deployment and Operations Practices
This article provides a thorough overview of planning, provisioning, and managing online production environments—including user sizing, bandwidth estimation, database design, OS versus container deployment, middleware selection, security, monitoring, SSH shortcuts, file transfer tools, automation scripts, Docker setup, and log viewing techniques—aimed at giving developers a complete operational perspective.
When developers rarely interact with production environments, they often only see a small part of the whole system. This guide aims to give a holistic view of online environment deployment, covering theoretical planning and practical tips.
1. Planning the user base and scale : For a small admin backend, a single server may suffice; for front‑end users, consider multi‑machine, front‑back separation, load balancing, and horizontal scalability.
2. Bandwidth estimation : Start with a shared 10 Mbps link for early stages, then adjust based on observed traffic. Public IP and DNS considerations follow naturally.
3. Database considerations : Prioritize high bandwidth, fast CPU, ample memory, and sufficient concurrent connections; avoid cutting costs on storage and choose the right type of database for the workload.
4. OS‑based vs container‑based deployment : Traditional OS deployment is simple but suffers from portability issues; container deployment (Docker) offers lightweight, repeatable environments, though it introduces new monitoring challenges.
5. Essential middleware : Typical stacks include Nginx (HTTP), Tomcat (Java), Redis (cache), Zookeeper (coordination), RabbitMQ (messaging), etc., which must be prepared before code runs.
6. Security basics : Apply firewalls, proper authorizations, and antivirus; cloud providers often simplify these steps.
7. Monitoring : System‑level monitoring (e.g., Zabbix, Grafana) and application‑level monitoring (e.g., ELK) are both essential; without monitoring, production becomes a blind spot.
8. Linux shortcuts :
• Password‑less SSH login using key pairs:
# 1. Generate a key
ssh-keygen -t rsa # skip if already exists
# 2. Copy the public key to the target host
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]• File transfer with scp and synchronization with rsync:
# scp example
scp /home/ol-web.war [email protected]:/www/tomcat/webapps/
# rsync example
rsync -av --delete /www/nginx/html/ [email protected]:/www/nginx/html/• Bash auto‑completion for SSH hosts by adding entries to /root/.ssh/config and using complete -W "$(grep -v '^$|#' .ssh/config | sort -u)" ssh.
9. SaltStack quick start :
# Install master and minion
yum install salt-master salt-minion
# Configure /etc/salt/minion with master IP
master: 172.1.2.22
id: server-api-01
user: root
# Start services
systemctl start salt-master
systemctl start salt-minion
# Accept keys
salt-key -A
# Run a command on a minion
salt server-api-02 cmd.run 'lsof -i:80'10. Cluster deployment script (bash) :
#!/bin/bash
MY_MACHINE_IP=$(ifconfig eth0 | awk -F "[: ]+" '/inet addr/{print $4}')
MACHINE_IP_LIST="172.1.2.7 172.1.3.4"
for m_ip in $MACHINE_IP_LIST; do
if [[ $m_ip != $MY_MACHINE_IP ]]; then
echo "- Installing apps to machine@$m_ip ..."
scp /www/test/hello-1.0.0-SNAPSHOT.jar root@$m_ip:/www/test/
rsync -av --delete /www/html/ root@$m_ip:/www/html/
echo "- Install apps to machine@$m_ip done."
fi
done11. Docker quick guide :
# Install Docker
yum install docker
service docker start
# Pull CentOS 6 image
docker pull centos:6
# Build a custom image
cat > Dockerfile <<'EOF'
FROM centos:6
MAINTAINER oom <[email protected]>
# RUN yum install -y lsof
# EXPOSE 80
# CMD ["sh","-c","service httpd start;bash"]
EOF
docker build -t tmp_image:1.0 .
# Run container
docker run -h tmp_container -itd --name tmp_container -v /opt/docker/webapps:/www/webapp tmp_image:1.0
# Enter container
docker exec -it tmp_container bash
# Commit changes
docker commit -m 'web final.' 49d79fc19eaa tmp_image:1.2
# Save and load image
docker save > /opt/images/images_final/tmp_image.final.tar tmp_image:1.2
docker load -i /opt/images/images_final/tmp_image.final.tar12. Custom login banner :
# Edit /etc/motd
*****************************************************************
!!! WARNING: Welcome to production machine: service-api-01, operate with caution !!!
*****************************************************************13. Convenient Nginx log viewing :
# Create a helper script /usr/bin/log_nginx_host
tail -f /var/log/nginx/access.log /var/log/nginx/error.logThese practical steps collectively provide a full‑stack operational roadmap for deploying, securing, monitoring, and maintaining online services.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java Captain
Focused on Java technologies: SSM, the Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading; occasionally covers DevOps tools like Jenkins, Nexus, Docker, ELK; shares practical tech insights and is dedicated to full‑stack Java development.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
