# Unpub > ๐Ÿงช This is a small adaption of [unpub](https://pub.dev/packages/unpub) to docker. --- ## ๐Ÿ“ฆ About Unpub is a self-hosted private Dart Pub server, designed for enterprise use. It includes a simple web interface for browsing and searching package information. --- ## โš ๏ธ MongoDB Compatibility > The latest version of Unpub is **v2.1.0**, which was released over 2 years ago. > Using MongoDB version 4.4 in conjunction provides the most stable experience. --- ## ๐Ÿš€ Publishing a Package Make sure your `pubspec.yaml` contains the following: ```yaml name: description: version: repository: /packages/ publish_to: ``` ### 1. Publish using Dart: ```bash dart pub publish ``` --- ### 2. Authentication issues? If you encounter problems during publishing, set a fake auth token: Install and use [`unpub_auth`](https://pub.dev/documentation/unpub_auth/latest/): ```bash dart pub global activate unpub_auth # install the auth tool unpub_auth login # log in via provided URL unpub_auth get | dart pub token add # add token to pub client dart pub publish # then try again ``` > The email address used for login will be displayed on the packageโ€™s webpage under the uploader section. --- ## ๐Ÿ“ฅ Retrieving Packages To use a package hosted on Unpub server, add the following to your `pubspec.yaml`: ```yaml dependencies: : hosted: name: url: version: ``` --- ## ๐Ÿณ Docker Setup This project includes a Docker-based deployment setup. 1. **Adjust** Unpub settings (especially the version) in `res/unpub/pubspec.yaml` 2. **Build the image:** ```bash docker image build -t unpub . ``` 3. **Start containers:** ```bash docker-compose up -d ``` > ๐Ÿ”ง Make sure to adjust the `docker-compose.yaml` file according to your needs before running the containers. --- ## ๐ŸŽจ Customizing the Web UI To modify the web interface (e.g. logo, colors, layout): - Edit the files in the `res/web` directory - **Do this _before_ building the Docker image**, so your changes are included --- ## ๐Ÿ’ฝ Backup & Restore Data Packages are stored in the volume `volumes/packages-data`, the corresponding metadata in MongoDB (volume `volumes/db-data`). Make sure the volumes (see `docker-compose.yaml`) are **not deleted**. In terms of prevent data lost, the volume `volumes/packages-data` has only be copied, but just copying the volume `volumes/db-data` is not the best choice, additionally, you have the following options: ### ๐Ÿ“ฆ Download a Package Archive On the Unpub web interface, you can download an archive of any package version directly under the **Versions** section of the package page. --- ### ๐Ÿ”„ Create a MongoDB Backup #### 1. Create a backup inside the container (e.g., under `/data/backup`) ```bash docker exec mongo-unpub mongodump --out=/data/backup ``` #### 2. Copy the backup to the host machine ```bash docker cp mongo-unpub:/data/backup ./mongo-backup ``` --- ### โ™ป๏ธ Restore a MongoDB Backup #### 1. Copy the backup back into the container ```bash docker cp ./mongo-backup mongo-unpub:/data/restore ``` #### 2. Start the restore process ```bash docker exec mongo-unpub mongorestore /data/restore ``` ๐Ÿ” Optional: Drop existing data before restoring: ```bash docker exec mongo-unpub mongorestore --drop /data/restore ``` --- ### ๐Ÿ—„๏ธ Using the Provided Backup Service A dedicated backup service is included to simplify data preservation. It performs a full backup by copying all unpub packages and dumping the MongoDB database in one step. To run the backup, use the following command: ```bash docker-compose run --rm backup ``` The resulting archive file will be saved in the `volumes/backups` directory. --- ## ๐ŸŒ Access Once deployed, you can access the web interface via the unpub server address: ``` scheme:/// ``` Depending on the settings in `docker-compose.yaml` the uri can differ. Without reverse proxy and other settings the server can be reached under the adress: ``` http://localhost:8080 ``` --- ## ๐Ÿ‘ค Author Dennis Skupin Based on the [unpub](https://pub.dev/packages/unpub) package by [Bytedance](https://pub.dev/packages/unpub) Licensed under the [MIT License](LICENSE) ---