Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Sure! Let’s set up MediaCMS from scratch on your system at /opt/wizbrand/mediacms-4.4.1. This guide will ensure you remove everything and install it cleanly.
This guide covers: β
Removing existing Docker containers
β
Reinstalling and configuring MediaCMS
β
Setting up PostgreSQL, Redis, and Python virtual environment
β
Running and accessing MediaCMS
1οΈβ£ Step 1: Remove All Existing Containers, Images, and Volumes
Since you want a fresh setup, let’s remove everything.
ποΈ Remove Old Containers and Images
docker-compose down -v --rmi all --remove-orphans
docker system prune -a --volumes -f
This will:
- Stop and remove all containers.
- Remove all Docker images.
- Clear all volumes.
2οΈβ£ Step 2: Install Required Dependencies
Before installing MediaCMS, install the required software:
π₯οΈ Install Docker & Docker Compose
Ensure Docker is installed:
sudo apt update
sudo apt install -y docker.io docker-compose
Start and enable Docker:
sudo systemctl enable --now docker
Verify installation:
docker --version
docker-compose --version
π Install Python & Virtualenv
MediaCMS requires Python, so install it:
sudo apt install -y python3 python3-venv python3-pip
Verify Python installation:
python3 --version
3οΈβ£ Step 3: Clone MediaCMS Repository (If Needed)
If you haven’t cloned MediaCMS yet, do this:
cd /opt/wizbrand
git clone https://github.com/mediacms-io/mediacms.git mediacms-4.4.1
cd mediacms-4.4.1
If you already have the project, just navigate to it:
cd /opt/wizbrand/mediacms-4.4.1
4οΈβ£ Step 4: Configure Environment Variables
Before running Docker, ensure the .env file has correct settings.
π Create/Edit the .env File
nano .env
Add the following:
DB_HOST=db
DB_NAME=mediacms
DB_USER=mediacms_user
DB_PASSWORD=yourpassword
REDIS_HOST=redis
REDIS_PORT=6379
Save and exit (CTRL + X, then Y + Enter).
5οΈβ£ Step 5: Build & Run MediaCMS Containers
π¨ Build and Start MediaCMS
Run:
docker-compose up --build -d
This will:
- Pull the required Docker images.
- Build the MediaCMS container.
- Start PostgreSQL, Redis, and Web services.
6οΈβ£ Step 6: Verify Running Containers
Check if all services are running:
docker ps
Expected output:
CONTAINER ID IMAGE COMMAND STATUS PORTS
abcd1234 mediacms/mediacms:latest "./deploy/docker/entβ¦" Up X minutes 8000/tcp
efgh5678 redis:alpine "docker-entrypoint.sβ¦" Up X minutes 6379/tcp
ijkl9101 postgres:17.2-alpine "docker-entrypoint.sβ¦" Up X minutes 5432/tcp
If any container is Restarting or Exited, check logs:
docker logs <container_id>
7οΈβ£ Step 7: Run Database Migrations Manually (If Needed)
If MediaCMS is stuck, you may need to run migrations.
π Enter the Web Container
docker exec -it mediacms-441_web_1 bash
π Set Up Python Virtual Environment
python3 -m venv /home/mediacms.io/mediacms/venv
source /home/mediacms.io/mediacms/venv/bin/activate
pip install --upgrade pip
pip install -r /home/mediacms.io/mediacms/requirements.txt
π Apply Migrations
python manage.py migrate
python manage.py collectstatic --noinput
exit
Restart the container:
docker-compose restart
8οΈβ£ Step 8: Access MediaCMS
If everything is working, open your browser and go to:
http://localhost:8000
or
http://your-server-ip:8000
π₯ Troubleshooting
If you face any issues, try the following:
π 1. Check Container Logs
docker-compose logs
For a specific container:
docker logs mediacms-441_web_1
π 2. Restart Everything
docker-compose down
docker-compose up -d --build
π 3. Verify PostgreSQL is Running
docker exec -it mediacms-441_db_1 psql -U mediacms_user -d mediacms -c "\dt"
β Final Checklist
β
Docker is installed and running
β
MediaCMS .env file is set up
β
Containers are running (docker ps)
β
Database migrations are applied
β
MediaCMS is accessible at http://localhost:8000
π Youβve successfully installed MediaCMS on WSL! Let me know if you face any issues. π