The DSPA application consists of a frontend built with React.js, a backend powered by Node.js, and a MySQL database. This setup is containerized using Docker and hosted on a Linux virtual machine (VM).
This guide walks you through pulling the Docker image, setting up the database, running the application, and managing updates.
- Ensure Docker and Docker Compose are installed on your Linux VM.
- Access to the Linux VM with appropriate permissions.
- A local dump of the dsaa-database is available for importing.
To update and push a new version of the Docker image:
docker login
docker buildx build --platform linux/amd64 -t dynaprot/dspa-main-app:latest --push .This builds the image for the correct architecture and pushes it to Docker Hub.
The website is running in a Dockecontainer on our Linux VM. Pulling the docker image from dockerhub and having a local dsaa-database dumb.
- Pull the Latest Docker Image
First, pull the latest Docker image for the DSPA application from Docker Hub. The --platform linux/amd64 flag ensures compatibility with the target architecture.
sudo docker pull --platform linux/amd64 dynaprot/dspa-main-app:latest- Start the Application with Docker Compose Use Docker Compose to build and run the application. This will spin up the containers for both the frontend, backend, and the MySQL database.
sudo docker compose up --build -dThis command will start the containers in detached mode (-d).
Creating a database dump to upload it on the VM
mysqldump -u root -p dynaprotdb > dynaprotdb.sql
To back up the local MySQL database before transferring or reloading:
mysqldump -u root -p dynaprotdb > dynaprotdb.sql
Although docker-compose.yml can automatically load the SQL dump via:
volumes:
- ./dynaprotdb.sql:/docker-entrypoint-initdb.d/dynaprotdb.sql... you may occasionally need to load it manually:
Manual Import Steps Access the running MySQL container:
sudo docker exec -it ekrismer-db-1 bashEnter the MySQL CLI:
mysql -u root -pLoad the SQL dump:
USE dynaprotdb;
SOURCE /docker-entrypoint-initdb.d/dynaprotdb.sql;| Task | Command or Step |
|---|---|
| Pull Docker image | docker pull --platform linux/amd64 dynaprot/dspa-main-app:latest |
| Start containers | docker compose up --build -d |
| Build & push new image | docker buildx build --platform linux/amd64 -t ... --push . |
| Stop website/containers | docker compose down |