If you're looking to set up a cheap, easy-to-manage hosting solution for static or MEAN stack sites, Portainer on a VPS from A2 Hosting is a great choice. Portainer is a lightweight management UI that allows you to easily manage your Docker environments. Here's a step-by-step guide to get you started.
Step 1: Choosing the Right VPS from A2 Hosting
-
Visit A2 Hosting VPS Plans: Go to A2 Hosting Unmanaged VPS.
-
Select a Plan: Choose a plan that fits your needs. For basic static or MEAN stack sites, a lower-tier plan should suffice.
Step 2: Setting Up Your VPS
Once you have your VPS, you'll need to set it up and ensure it's ready for Docker and Portainer.
-
Access Your VPS: Use SSH to log into your VPS. You can use a terminal on Linux/Mac or an SSH client like PuTTY on Windows.
ssh root@your_vps_ip
-
Update Your System:
apt update && apt upgrade -y
Step 3: Installing Docker
Docker is required for running Portainer. Follow these steps to install Docker on your VPS.
-
Install Docker:
apt install docker.io -y
-
Enable and Start Docker:
systemctl enable docker systemctl start docker
-
Verify Docker Installation:
docker --version
Step 4: Installing Portainer
Now that Docker is installed, you can proceed to install Portainer.
-
Pull the Portainer Image:
docker pull portainer/portainer-ce
-
Create the Portainer Volume:
docker volume create portainer_data
-
Run Portainer:
docker run -d -p 8000:8000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
-
Access Portainer: Open your browser and go to
https://your_vps_ip:9443
. You’ll be prompted to create an admin user.
Step 5: Deploying Static or MEAN Stack Sites
With Portainer set up, you can now deploy your static or MEAN stack sites.
-
Create a New Stack in Portainer:
- Go to the Portainer dashboard.
- Select "Stacks" and then "Add stack".
- Name your stack and define your
docker-compose.yml
for your static site or MEAN stack site.
-
Example Docker Compose for a Static Site:
version: '3' services: web: image: nginx:alpine volumes: - ./html:/usr/share/nginx/html ports: - "80:80"
-
Example Docker Compose for a MEAN Stack Site:
version: '3' services: web: image: node:14 working_dir: /app volumes: - ./:/app command: npm start ports: - "3000:3000" mongo: image: mongo:latest ports: - "27017:27017"
-
Deploy the Stack: Once you have your
docker-compose.yml
defined, deploy the stack.
Step 6: Managing Your Site with Portainer
Portainer provides a user-friendly interface to manage your Docker containers. You can:
- Start, stop, and restart containers.
- View logs and stats.
- Manage volumes and networks.
- Use the console to interact with containers.
Additional Resources
By following these steps, you'll have a powerful and cost-effective hosting solution for your static or MEAN stack sites using A2 Hosting and Portainer. Enjoy the ease of managing your Docker environments with Portainer's intuitive UI!