This project consists of implementing a service similar to Dropbox, enabling automatic file
sharing and synchronization between different devices of the same user
To achieve this, this project makes use of:
- Threads;
- Processes;
- Communication using sockets;
- Process synchronization using mutexes and semaphores.
To build and run this project, you can choose one of the following options:
- Navigate to the project root directory;
- Make the script executable by running 'chmod +x build.sh';
- Execute the script './build.sh'.
- Navigate to the project root directory;
- Create the build directory if it doesn't exist with 'mkdir -p build';
- Navigate to the build directory and build the project with 'cd build ; cmake ..; make'
- Ensure the
docksync-networkDocker network exists. Create it if necessary:docker network create docksync-network
- Replace placeholders (
<...>) with appropriate values for your setup.
Follow the instructions in the Docker Engine Installation Guide for Ubuntu to set up Docker on your machine.
Navigate to the project root directory and build the Docker image:
docker build -t docsync-image .This image will be used for all application agents (server, backup server, and clients).
To run a container for an agent, use the following command:
docker run -it --name <container-name> --network docksync-network --rm docsync-imageReplace <container-name> with a name that represents the agent (e.g., server, backup server, or client).
After entering the container, execute the following commands based on the agent type:
-
Client:
./myClient <client-username> <primary-server-container-name> <primary-server-port>
-
Primary Server:
./myServer
Or, to specify a custom port:
./myServer <port-for-server-to-run>
-
Backup Server:
./myServer <primary-server-container-name> <primary-server-port>
=======
This method allows you to copy a file or directory from a container to your host machine.
- Identify the running container's ID or name:
docker ps- Use the docker cp command to copy the file:
docker cp <container_name_or_id>:<path_in_container> <path_on_host>To copy a file from the container my_container to your host machine:
docker cp my_container:/path/to/file /host/path docker cp backup_server:/app/project/src/server/userDirectories/sync_dir_kenji/test.png /home/kenji/Desktop/teste.png docker cp backup_server:/app/project/src/server/userDirectories/sync_dir_kenji/test.png ~/teste.png