You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Updated mongodb container in docker-compose.yml to include db env vars.
Added backup volume to mongodb container in docker-compose.yml.
Updated env variable names.
Copy file name to clipboardExpand all lines: README.md
+60-5Lines changed: 60 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Running the API image alone requires that you have a MongoDB instance and (ideal
30
30
3. Run the following command to start an API container, providing the actual path to the `settings.json` file created in step 1. The service will be exposed via port 8080. If you did not create the environment variables in step 2, you will need to provide the actual username and password values in line, i.e. `-e XBROWSERSYNC_DB_USER=YourDatabaseUsername -e XBROWSERSYNC_DB_PWD=YourDatabasePassword`:
2. Open the [`.env`](https://github.com/xbrowsersync/api-docker/blob/master/.env) file in a text editor and update the `XBS_API_HOSTNAME` value to correspond to the host name that the API service will be exposed over (ensure you have configured your DNS provider to point the desired host name to your host's IP address). Also, change the `XBS_DB_USERNAME` and `XBS_DB_PASSWORD` values to any of your choosing.
48
+
2. Open the [`.env`](https://github.com/xbrowsersync/api-docker/blob/master/.env) file in a text editor and update the `API_HOSTNAME` value to correspond to the host name that the API service will be exposed over (ensure you have configured your DNS provider to point the desired host name to your host's IP address). Also, change the `DB_USERNAME` and `DB_PASSWORD` values to any of your choosing.
49
49
50
50
3. (Optionally) open the [`settings.json`](https://github.com/xbrowsersync/api-docker/blob/master/settings.json) file and include any custom [settings](https://github.com/xbrowsersync/api#3-modify-configuration-settings) values you wish to run on your service. Important: do not change the `db.host` value.
51
51
52
52
4. Run the following command to start the containers:
53
53
54
54
```
55
-
$ docker-compose up -d
55
+
docker-compose up -d
56
56
```
57
57
58
-
You can now access your xBrowserSync API service over HTTPS at the value of `XBS_API_HOSTNAME` defined in the [`.env`](https://github.com/xbrowsersync/api-docker/blob/master/.env) file.
58
+
You can now access your xBrowserSync API service over HTTPS at the value of `API_HOSTNAME` defined in the [`.env`](https://github.com/xbrowsersync/api-docker/blob/master/.env) file.
59
+
60
+
## Upgrade process
61
+
62
+
If you wish to upgrade your existing production-ready service created using the [`docker-compose.yml`](https://github.com/xbrowsersync/api-docker/blob/master/docker-compose.yml) file, you may encounter database errors when upgrading the MongoDB version. To avoid these issues, it is recommended that you export the db data from the old version and restore to the new version once up and running.
63
+
64
+
The following steps detail the process in full:
65
+
66
+
67
+
1. Connect to the MongoDB container:
68
+
69
+
```
70
+
docker exec -it xbs-db bash
71
+
```
72
+
73
+
2. Export db data to the `xbs-db-backups` Docker volume using [mongodump](https://docs.mongodb.com/database-tools/mongodump/):
3. Exit the MongoDB container and navigate to the api-docker GitHub repo folder. Stop and remove all containers:
80
+
81
+
```
82
+
docker-compose down
83
+
```
84
+
85
+
4. Delete the `xbs-db-data` Docker volume before upgrading MongoDB. You need to find the volume name first using:
86
+
87
+
```
88
+
docker volume ls
89
+
```
90
+
91
+
It will be something like `api-docker_xbs-db-data`. Once located, delete it with:
92
+
93
+
```
94
+
docker volume rm api-docker_xbs-db-data
95
+
```
96
+
97
+
5. Get latest changes and start the containers:
98
+
99
+
```
100
+
git pull
101
+
docker-compose up -d
102
+
```
103
+
6. Connect to the MongoDB container:
104
+
105
+
```
106
+
docker exec -it xbs-db bash
107
+
```
108
+
109
+
7. Restore db data from the `xbs-db-backups` Docker volume using [mongorestore](https://docs.mongodb.com/database-tools/mongorestore/) (replace `{BackupFileName}` with the actual backup file name):
0 commit comments