|
@@ -7,13 +7,9 @@ MusareNode now uses NodeJS, Express, SocketIO and VueJS - among other technologi
|
|
The master branch is available at [musare.com](https://musare.com)
|
|
The master branch is available at [musare.com](https://musare.com)
|
|
You can also find the staging branch at [musare.dev](https://musare.dev)
|
|
You can also find the staging branch at [musare.dev](https://musare.dev)
|
|
|
|
|
|
-## Contact
|
|
|
|
-
|
|
|
|
-Get in touch with us via email at [core@musare.com](mailto:core@musare.com) or join our [Discord Guild](https://discord.gg/Y5NxYGP).
|
|
|
|
-
|
|
|
|
-You can also find us on [Facebook](https://www.facebook.com/MusareMusic) and [Twitter](https://twitter.com/MusareApp).
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
-### Our Stack
|
|
|
|
|
|
+## Our Stack
|
|
|
|
|
|
- NodeJS
|
|
- NodeJS
|
|
- MongoDB
|
|
- MongoDB
|
|
@@ -21,33 +17,20 @@ You can also find us on [Facebook](https://www.facebook.com/MusareMusic) and [Tw
|
|
- Nginx (not required)
|
|
- Nginx (not required)
|
|
- VueJS
|
|
- VueJS
|
|
|
|
|
|
-### Frontend
|
|
|
|
|
|
+### **Frontend**
|
|
|
|
|
|
The frontend is a [vue-cli](https://github.com/vuejs/vue-cli) generated, [vue-loader](https://github.com/vuejs/vue-loader) single page app, that's served over Nginx or Express. The Nginx server not only serves the frontend, but can also serve as a load balancer for requests going to the backend.
|
|
The frontend is a [vue-cli](https://github.com/vuejs/vue-cli) generated, [vue-loader](https://github.com/vuejs/vue-loader) single page app, that's served over Nginx or Express. The Nginx server not only serves the frontend, but can also serve as a load balancer for requests going to the backend.
|
|
|
|
|
|
-### Backend
|
|
|
|
|
|
+### **Backend**
|
|
|
|
|
|
-The backend is a scalable NodeJS / Redis / MongoDB app. Each backend server handles a group of SocketIO connections. User sessions are stored in a central Redis server. All data is stored in a central MongoDB server. The Redis and MongoDB servers are replicated to several secondary nodes, which can become the primary node if the current primary node goes down.
|
|
|
|
|
|
+The backend is a scalable NodeJS / Redis / MongoDB app. User sessions are stored in a central Redis server. All data is stored in a central MongoDB server. The Redis and MongoDB servers are replicated to several secondary nodes, which can become the primary node if the current primary node goes down.
|
|
|
|
|
|
We currently only utilize 1 backend, 1 MongoDB server and 1 Redis server running for production, though it is relatively easy to expand.
|
|
We currently only utilize 1 backend, 1 MongoDB server and 1 Redis server running for production, though it is relatively easy to expand.
|
|
|
|
|
|
-## Requirements
|
|
|
|
-
|
|
|
|
-Installing with Docker: (not recommended for Windows users)
|
|
|
|
-
|
|
|
|
-- [Docker](https://www.docker.com/)
|
|
|
|
-
|
|
|
|
-Standard Installation:
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
-- [NodeJS](https://nodejs.org/en/download/)
|
|
|
|
- - [nodemon](https://nodemon.io/): `npm install -g nodemon`
|
|
|
|
- - [node-gyp](https://github.com/nodejs/node-gyp#installation): `npm install -g node-gyp`
|
|
|
|
-- [MongoDB](https://www.mongodb.com/download-center) Currently version 4.0
|
|
|
|
-- [Redis (Windows)](https://github.com/MSOpenTech/redis/releases/tag/win-3.2.100) [Redis (Unix)](https://redis.io/download)
|
|
|
|
|
|
+## Getting Started & Configuration
|
|
|
|
|
|
-## Getting Started
|
|
|
|
-
|
|
|
|
-Once you've installed the required tools:
|
|
|
|
|
|
|
|
1. `git clone https://github.com/Musare/MusareNode.git`
|
|
1. `git clone https://github.com/Musare/MusareNode.git`
|
|
|
|
|
|
@@ -55,43 +38,43 @@ Once you've installed the required tools:
|
|
|
|
|
|
3. `cp backend/config/template.json backend/config/default.json`
|
|
3. `cp backend/config/template.json backend/config/default.json`
|
|
|
|
|
|
- | Property | Description |
|
|
|
|
- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
- | `mode` | Should be either `development` or `production`. No more explanation needed. |
|
|
|
|
- | `secret` | Whatever you want - used by express's session module. |
|
|
|
|
- | `domain` | Should be the url where the site will be accessible from,usually `http://localhost` for non-Docker. |
|
|
|
|
- | `serverDomain` | Should be the url where the backend will be accessible from, usually `http://localhost:8080` for non-Docker. |
|
|
|
|
- | `serverPort` | Should be the port where the backend will listen on, should always be `8080` for Docker, and is recommended for non-Docker. |
|
|
|
|
- | `isDocker` | Self-explanatory. Are you using Docker? |
|
|
|
|
- | `serverPort` | Should be the port where the backend will listen on, should always be `8080` for Docker, and is recommended for non-Docker. |
|
|
|
|
- | `apis.youtube.key` | Can be obtained by setting up a [YouTube API Key](https://developers.google.com/youtube/v3/getting-started). You need to use the YouTube Data API v3, and create an API key. |
|
|
|
|
- | `apis.recaptcha.secret` | Can be obtained by setting up a [ReCaptcha Site (v3)](https://www.google.com/recaptcha/admin). |
|
|
|
|
- | `apis.github` | Can be obtained by setting up a [GitHub OAuth Application](https://github.com/settings/developers). You need to fill in some values to create the OAuth application. The homepage is the homepage of frontend. The authorization callback url is the backend url with `/auth/github/authorize/callback` added at the end. For example `http://localhost:8080/auth/github/authorize/callback`. |
|
|
|
|
- | `apis.discord.token` | Token for the Discord bot. |
|
|
|
|
- | `apis.discord.loggingServer` | Server ID of the Discord logging server. |
|
|
|
|
- | `apis.discord.loggingChannel` | ID of the channel to be used in the Discord logging server. |
|
|
|
|
- | `apis.mailgun` | Can be obtained by setting up a [Mailgun account](http://www.mailgun.com/), or you can disable it. |
|
|
|
|
- | `apis.spotify` | Can be obtained by setting up a [Spotify client id](https://developer.spotify.com/dashboard/applications), or you can disable it. |
|
|
|
|
- | `apis.discogs` | Can be obtained by setting up a [Discogs application](https://www.discogs.com/settings/developers), or you can disable it. |
|
|
|
|
- | `redis.url` | Should be left alone for Docker, and changed to `redis://localhost:6379/0` for non-Docker. |
|
|
|
|
- | `redis.password` | Should be the Redis password you either put in your `startRedis.cmd` file for Windows, or `.env` for docker. |
|
|
|
|
- | `mongo.url` | Needs to have the proper password for the MongoDB musare user, and for non-Docker you need to replace `@musare:27017` with `@localhost:27017`. |
|
|
|
|
- | `cookie.domain` | Should be the ip or address you use to access the site, without protocols (http/https), so for example `localhost`. |
|
|
|
|
- | `cookie.secure` | Should be `true` for SSL connections, and `false` for normal http connections. |
|
|
|
|
|
|
+ | Property | Description |
|
|
|
|
+ | - | - |
|
|
|
|
+ | `mode` | Should be either `development` or `production`. No more explanation needed. |
|
|
|
|
+ | `secret` | Whatever you want - used by express's session module. |
|
|
|
|
+ | `domain` | Should be the url where the site will be accessible from,usually `http://localhost` for non-Docker. |
|
|
|
|
+ | `serverDomain` | Should be the url where the backend will be accessible from, usually `http://localhost:8080` for non-Docker. |
|
|
|
|
+ | `serverPort` | Should be the port where the backend will listen on, should always be `8080` for Docker, and is recommended for non-Docker. |
|
|
|
|
+ | `isDocker` | Self-explanatory. Are you using Docker? |
|
|
|
|
+ | `serverPort` | Should be the port where the backend will listen on, should always be `8080` for Docker, and is recommended for non-Docker. |
|
|
|
|
+ | `apis.youtube.key` | Can be obtained by setting up a [YouTube API Key](https://developers.google.com/youtube/v3/getting-started). You need to use the YouTube Data API v3, and create an API key. |
|
|
|
|
+ | `apis.recaptcha.secret` | Can be obtained by setting up a [ReCaptcha Site (v3)](https://www.google.com/recaptcha/admin). |
|
|
|
|
+ | `apis.github` | Can be obtained by setting up a [GitHub OAuth Application](https://github.com/settings/developers). You need to fill in some values to create the OAuth application. The homepage is the homepage of frontend. The authorization callback url is the backend url with `/auth/github/authorize/callback` added at the end. For example `http://localhost:8080/auth/github/authorize/callback`. |
|
|
|
|
+ | `apis.discord.token` | Token for the Discord bot. |
|
|
|
|
+ | `apis.discord.loggingServer` | Server ID of the Discord logging server. |
|
|
|
|
+ | `apis.discord.loggingChannel` | ID of the channel to be used in the Discord logging server. |
|
|
|
|
+ | `apis.mailgun` | Can be obtained by setting up a [Mailgun account](http://www.mailgun.com/), or you can disable it. |
|
|
|
|
+ | `apis.spotify` | Can be obtained by setting up a [Spotify client id](https://developer.spotify.com/dashboard/applications), or you can disable it. |
|
|
|
|
+ | `apis.discogs` | Can be obtained by setting up a [Discogs application](https://www.discogs.com/settings/developers), or you can disable it. |
|
|
|
|
+ | `redis.url` | Should be left alone for Docker, and changed to `redis://localhost:6379/0` for non-Docker. |
|
|
|
|
+ | `redis.password` | Should be the Redis password you either put in your `startRedis.cmd` file for Windows, or `.env` for docker. |
|
|
|
|
+ | `mongo.url` | Needs to have the proper password for the MongoDB musare user, and for non-Docker you need to replace `@musare:27017` with `@localhost:27017`. |
|
|
|
|
+ | `cookie.domain` | Should be the ip or address you use to access the site, without protocols (http/https), so for example `localhost`. |
|
|
|
|
+ | `cookie.secure` | Should be `true` for SSL connections, and `false` for normal http connections. |
|
|
|
|
|
|
4. `cp frontend/build/config/template.json frontend/build/config/default.json`
|
|
4. `cp frontend/build/config/template.json frontend/build/config/default.json`
|
|
|
|
|
|
- | Property | Description |
|
|
|
|
- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
|
|
- | `serverDomain` | Should be the url where the backend will be accessible from, usually `http://localhost:8080` for non-Docker. |
|
|
|
|
- | `frontendDomain` | Should be the url where the frontend will be accessible from, usually `http://localhost` for docker or `http://localhost:80` for non-Docker. |
|
|
|
|
- | `frontendPort` | Should be the port where the frontend will be accessible from, should always be port `81` for Docker, and is recommended to be port `80` for non-Docker. |
|
|
|
|
- | `recaptcha.key` | Can be obtained by setting up a [ReCaptcha Site (v3)](https://www.google.com/recaptcha/admin). |
|
|
|
|
- | `cookie.domain` | Should be the ip or address you use to access the site, without protocols (http/https), so for example `localhost`. |
|
|
|
|
- | `cookie.secure` | Should be `true` for SSL connections, and `false` for normal http connections. |
|
|
|
|
- | `siteSettings.logo` | Path to the logo image, by default it is `/assets/wordmark.png`. |
|
|
|
|
- | `siteSettings.siteName` | Should be the name of the site. |
|
|
|
|
- | `siteSettings.socialLinks` | `github`, `twitter` and `facebook` are set to the official Musare accounts by default, but can be changed. |
|
|
|
|
|
|
+ | Property | Description |
|
|
|
|
+ | - | - |
|
|
|
|
+ | `serverDomain` | Should be the url where the backend will be accessible from, usually `http://localhost:8080` for non-Docker. |
|
|
|
|
+ | `frontendDomain` | Should be the url where the frontend will be accessible from, usually `http://localhost` for docker or `http://localhost:80` for non-Docker. |
|
|
|
|
+ | `frontendPort` | Should be the port where the frontend will be accessible from, should always be port `81` for Docker, and is recommended to be port `80` for non-Docker. |
|
|
|
|
+ | `recaptcha.key` | Can be obtained by setting up a [ReCaptcha Site (v3)](https://www.google.com/recaptcha/admin). |
|
|
|
|
+ | `cookie.domain` | Should be the ip or address you use to access the site, without protocols (http/https), so for example `localhost`. |
|
|
|
|
+ | `cookie.secure` | Should be `true` for SSL connections, and `false` for normal http connections. |
|
|
|
|
+ | `siteSettings.logo` | Path to the logo image, by default it is `/assets/wordmark.png`. |
|
|
|
|
+ | `siteSettings.siteName` | Should be the name of the site. |
|
|
|
|
+ | `siteSettings.socialLinks` | `github`, `twitter` and `facebook` are set to the official Musare accounts by default, but can be changed. |
|
|
|
|
|
|
5. Simply `cp .env.example .env` to setup your environment variables.
|
|
5. Simply `cp .env.example .env` to setup your environment variables.
|
|
|
|
|
|
@@ -100,68 +83,85 @@ Once you've installed the required tools:
|
|
- Setup an account
|
|
- Setup an account
|
|
- Go to [settings](https://app.snyk.io/account)
|
|
- Go to [settings](https://app.snyk.io/account)
|
|
- Copy the API token and set it as your `SNYK_TOKEN` environment variable.
|
|
- Copy the API token and set it as your `SNYK_TOKEN` environment variable.
|
|
|
|
+
|
|
|
|
+ We use snyk to test our dependencies / dev-dependencies for vulnerabilities.
|
|
|
|
+
|
|
|
|
+<br />
|
|
|
|
+
|
|
|
|
+## Installation
|
|
|
|
+
|
|
|
|
+After initial configuration, there are two different options to use for your local development environment.
|
|
|
|
+
|
|
|
|
+1) [**Docker**](#docker)
|
|
|
|
+2) [Standard Setup](#standard-setup)
|
|
|
|
+
|
|
|
|
+We **highly recommend using Docker** - both for stability and speed of setup. We also use Docker on our production servers.
|
|
|
|
|
|
-We use snyk to test our dependencies / dev-dependencies for vulnerabilities.
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
-### Installing with Docker
|
|
|
|
|
|
+### **Docker**
|
|
|
|
|
|
-#### Configuration
|
|
|
|
|
|
+___
|
|
|
|
|
|
-To configure docker configure the `.env` file to match your settings in `backend/config/default.json`.
|
|
|
|
-The configurable ports will be how you access the services on your machine, or what ports you will need to specify in your nginx files when using proxy_pass.
|
|
|
|
-`COMPOSE_PROJECT_NAME` should be a unique name for this installation, especially if you have multiple instances of Musare on the same machine.
|
|
|
|
-`FRONTEND_MODE` should be either `dev` or `prod` (self-explanatory).
|
|
|
|
|
|
+1. Configure the `.env` file to match your settings in `backend/config/default.json`.
|
|
|
|
|
|
-1. Build the backend and frontend Docker images (from the main folder)
|
|
|
|
|
|
+ | Property | Description |
|
|
|
|
+ | - | - |
|
|
|
|
+ | Ports | Will be how you access the services on your machine, or what ports you will need to specify in your nginx files when using proxy_pass. |
|
|
|
|
+ | `COMPOSE_PROJECT_NAME` | Should be a unique name for this installation, especially if you have multiple instances of Musare on the same machine. |
|
|
|
|
+ | `FRONTEND_MODE` | Should be either `dev` or `prod` (self-explanatory). |
|
|
|
|
+ | `MONGO_ROOT_PASSWORD` | Password of the root/admin user of MongoDB |
|
|
|
|
+ | `MONGO_USER_USERNAME` | Password for the "musare" user (what the backend uses) of MongoDB |
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+2. Install [Docker for Desktop](https://www.docker.com/products/docker-desktop)
|
|
|
|
+
|
|
|
|
+3. Build the backend and frontend Docker images (from the root folder)
|
|
|
|
|
|
`docker-compose build`
|
|
`docker-compose build`
|
|
|
|
|
|
-2. Set up the MongoDB database
|
|
|
|
|
|
+4. Start the MongoDB database (in detached mode), which will generate the correct MongoDB users based on the `.env` file.
|
|
|
|
|
|
- 1. Set the password for the admin/root user.
|
|
|
|
|
|
+ `docker-compose up -d mongo`
|
|
|
|
|
|
- In `.env` set the environment variable of `MONGO_ROOT_PASSWORD`.
|
|
|
|
|
|
+5. If you want to use linting extensions in IDEs, then you must attach the IDE to the docker containers. This is entirely [possible with VS Code](https://code.visualstudio.com/docs/remote/containers).
|
|
|
|
|
|
- 2. Set the password for the musare user (the one the backend will use).
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
- In `.env` set the environment variable of `MONGO_USER_USERNAME` and `MONGO_USER_PASSWORD`.
|
|
|
|
|
|
+### **Standard Setup**
|
|
|
|
|
|
- 3. Start the database (in detached mode), which will generate the correct MongoDB users.
|
|
|
|
|
|
+___
|
|
|
|
|
|
- `docker-compose up -d mongo`
|
|
|
|
|
|
+#### Installation
|
|
|
|
|
|
-3. Start redis and the mongo client in the background, as we usually don't need to monitor these for errors
|
|
|
|
|
|
+1. Install [Redis](http://redis.io/download) and [MongoDB](https://www.mongodb.com/download-center#community)
|
|
|
|
|
|
- `docker-compose up -d mongoclient redis`
|
|
|
|
|
|
+2. Install [NodeJS](https://nodejs.org/en/download/)
|
|
|
|
|
|
-4. Start the backend and frontend in the foreground, so we can watch for errors during development
|
|
|
|
|
|
+ 1. Install nodemon globally
|
|
|
|
|
|
- `docker-compose up backend frontend`
|
|
|
|
|
|
+ `npm install -g nodemon`
|
|
|
|
|
|
-5. You should now be able to begin development! The backend is auto reloaded when
|
|
|
|
- you make changes and the frontend is auto compiled and live reloaded by webpack
|
|
|
|
- when you make changes. You should be able to access Musare in your local browser
|
|
|
|
- at `http://<docker-machine-ip>:8080/` where `<docker-machine-ip>` can be found below:
|
|
|
|
|
|
+ 2. Install node-gyp globally (first check out <https://github.com/nodejs/node-gyp#installation)>
|
|
|
|
|
|
- - Docker for Windows / Mac: This is just `localhost`
|
|
|
|
|
|
+ `npm install -g node-gyp`.
|
|
|
|
|
|
- - Docker ToolBox: The output of `docker-machine ip default`
|
|
|
|
|
|
+3. Install webpack globally
|
|
|
|
|
|
-If you want to use linting extensions in IDEs, then you must attach the IDE to the docker containers. This is entirely [possible with VS Code](https://code.visualstudio.com/docs/remote/containers).
|
|
|
|
|
|
+ `npm install -g webpack`
|
|
|
|
|
|
-### Standard Installation
|
|
|
|
|
|
|
|
-Steps 1-4 are things you only have to do once. The steps to start servers follow.
|
|
|
|
|
|
+#### Setting up MongoDB
|
|
|
|
|
|
-1. In the main folder, create a folder called `.database`
|
|
|
|
|
|
+1. In the root directory, create a folder called `.database`
|
|
|
|
|
|
-2. Create a file called `startMongo.cmd` in the main folder with the contents:
|
|
|
|
|
|
+2. Create a file called `startMongo.cmd` in the root directory with the contents:
|
|
|
|
|
|
- "C:\Program Files\MongoDB\Server\3.2\bin\mongod.exe" --dbpath "D:\Programming\HTML\MusareNode\.database"
|
|
|
|
|
|
+ `"C:\Program Files\MongoDB\Server\3.2\bin\mongod.exe" --dbpath "D:\Programming\HTML\MusareNode\.database"`
|
|
|
|
|
|
Make sure to adjust your paths accordingly.
|
|
Make sure to adjust your paths accordingly.
|
|
|
|
|
|
-3. Set up the MongoDB database
|
|
|
|
|
|
+3. Set up the MongoDB database itself
|
|
|
|
|
|
1. Start the database by executing the script `startMongo.cmd` you just made
|
|
1. Start the database by executing the script `startMongo.cmd` you just made
|
|
|
|
|
|
@@ -177,7 +177,7 @@ Steps 1-4 are things you only have to do once. The steps to start servers follow
|
|
|
|
|
|
`use musare`
|
|
`use musare`
|
|
|
|
|
|
- 5. Create the musare user
|
|
|
|
|
|
+ 5. Create the "musare" user
|
|
|
|
|
|
`db.createUser({user: 'musare', pwd: 'OTHER_PASSWORD_HERE', roles: [{role: 'readWrite', db: 'musare'}]})`
|
|
`db.createUser({user: 'musare', pwd: 'OTHER_PASSWORD_HERE', roles: [{role: 'readWrite', db: 'musare'}]})`
|
|
|
|
|
|
@@ -189,66 +189,70 @@ Steps 1-4 are things you only have to do once. The steps to start servers follow
|
|
|
|
|
|
In `startMongo.cmd` add `--auth` at the end of the first line
|
|
In `startMongo.cmd` add `--auth` at the end of the first line
|
|
|
|
|
|
-4. In the folder where you installed Redis, edit the `redis.windows.conf` file. In there, look for the property `notify-keyspace-events`. Make sure that property is uncommented and has the value `Ex`. It should look like `notify-keyspace-events Ex` when done.
|
|
|
|
|
|
+#### Setting up Redis
|
|
|
|
+
|
|
|
|
+1. In the folder where you installed Redis, edit the `redis.windows.conf` file
|
|
|
|
+
|
|
|
|
+ 1) In there, look for the property `notify-keyspace-events`.
|
|
|
|
+ 2) Make sure that property is uncommented and has the value `Ex`.
|
|
|
|
+
|
|
|
|
+ It should look like `notify-keyspace-events Ex` when done.
|
|
|
|
|
|
-5. Create a file called `startRedis.cmd` in the main folder with the contents:
|
|
|
|
|
|
+2. Create a file called `startRedis.cmd` in the main folder with the contents:
|
|
|
|
|
|
- "D:\Redis\redis-server.exe" "D:\Redis\redis.windows.conf" "--requirepass" "PASSWORD"
|
|
|
|
|
|
+ `"D:\Redis\redis-server.exe" "D:\Redis\redis.windows.conf" "--requirepass" "PASSWORD"`
|
|
|
|
|
|
And again, make sure that the paths lead to the proper config and executable. Replace `PASSWORD` with your Redis password.
|
|
And again, make sure that the paths lead to the proper config and executable. Replace `PASSWORD` with your Redis password.
|
|
|
|
|
|
-### Non-docker start servers
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
-#### Automatic
|
|
|
|
|
|
+## Everyday usage
|
|
|
|
|
|
-1. If you are on Windows you can run `windows-start.cmd` or just double click the `windows-start.cmd` file and all servers will automatically start up.
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
-#### Manual
|
|
|
|
|
|
+### **Docker**
|
|
|
|
|
|
-1. Run `startRedis.cmd` and `startMongo.cmd` to start Redis and Mongo.
|
|
|
|
|
|
+___
|
|
|
|
|
|
-2. In a command prompt with the pwd of frontend, run `npm run dev`
|
|
|
|
|
|
+1. Start the MongoDB database in the background.
|
|
|
|
|
|
-3. In a command prompt with the pwd of backend, run `nodemon`
|
|
|
|
|
|
+ `docker-compose up -d mongo`
|
|
|
|
|
|
-## Extra
|
|
|
|
|
|
+2. Start redis and the mongo client in the background, as we usually don't need to monitor these for errors.
|
|
|
|
|
|
-Below is a list of helpful tips / solutions we've collected while developing MusareNode.
|
|
|
|
|
|
+ `docker-compose up -d mongoclient redis`
|
|
|
|
|
|
-### Mounting a non-standard directory in Docker Toolbox on Windows
|
|
|
|
|
|
+3. Start the backend and frontend in the foreground, so we can watch for errors during development.
|
|
|
|
|
|
-Docker Toolbox usually only gives VirtualBox access to `C:/Users` of your
|
|
|
|
-local machine. So if your code is located elsewere on your machine,
|
|
|
|
-you'll need to tell Docker Toolbox how to find it. You can use variations
|
|
|
|
-of the following commands to give Docker Toolbox access to those files.
|
|
|
|
|
|
+ `docker-compose up backend frontend`
|
|
|
|
|
|
-1. First lets ensure the machine isn't running
|
|
|
|
|
|
+4. You should now be able to begin development!
|
|
|
|
|
|
- `docker-machine stop default`
|
|
|
|
|
|
+ The backend is auto reloaded when you make changes and the frontend is auto compiled and live reloaded by webpack when you make changes.
|
|
|
|
+
|
|
|
|
+ You should be able to access Musare in your local browser at `http://localhost:8080/`.
|
|
|
|
|
|
-1. Next we'll want to tell the machine about the folder we want to share.
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
- `"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" sharedfolder add default --name "d/Projects/MusareNode" --hostpath "D:\Projects\MusareNode" --automount`
|
|
|
|
|
|
+### **Standard Setup**
|
|
|
|
|
|
-1. Now start the machine back up and ssh into it
|
|
|
|
|
|
+___
|
|
|
|
|
|
- `docker-machine start default && docker-machine ssh default`
|
|
|
|
|
|
+##### Automatic
|
|
|
|
|
|
-1. Tell boot2docker to mount our volume at startup, by appending to its startup script
|
|
|
|
|
|
+1. If you are on Windows you can run `windows-start.cmd` or just double click the `windows-start.cmd` file and all servers will automatically start up.
|
|
|
|
|
|
- ```bash
|
|
|
|
- sudo tee -a /mnt/sda1/var/lib/boot2docker/profile >/dev/null <<EOF
|
|
|
|
|
|
+##### Manual
|
|
|
|
|
|
- mkdir -p /d/Projects/MusareNode
|
|
|
|
- mount -t vboxsf -o uid=1000,gid=50 d/Projects/MusareNode /d/Projects/MusareNode
|
|
|
|
- EOF
|
|
|
|
- ```
|
|
|
|
|
|
+1. Run `startRedis.cmd` and `startMongo.cmd` to start Redis and Mongo.
|
|
|
|
|
|
-1. Restart the docker machine so that it uses the new shared folder
|
|
|
|
|
|
+2. Execute `cd frontend && npm dev` and `cd backend && npm dev` separately.
|
|
|
|
|
|
- `docker-machine restart default`
|
|
|
|
|
|
+<br />
|
|
|
|
|
|
-1. You now should be good to go!
|
|
|
|
|
|
+## Extra
|
|
|
|
+
|
|
|
|
+Below is a list of helpful tips / solutions we've collected while developing MusareNode.
|
|
|
|
|
|
### Fixing the "couldn't connect to docker daemon" error
|
|
### Fixing the "couldn't connect to docker daemon" error
|
|
|
|
|
|
@@ -258,31 +262,13 @@ This command will print various variables.
|
|
At the bottom, it will say something similar to `@FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i`.
|
|
At the bottom, it will say something similar to `@FOR /f "tokens=*" %i IN ('docker-machine env default') DO @%i`.
|
|
Run this command in your shell. You will have to do this command for every shell you want to run `docker-compose` in (every session).
|
|
Run this command in your shell. You will have to do this command for every shell you want to run `docker-compose` in (every session).
|
|
|
|
|
|
-### Running Musare locally without using Docker
|
|
|
|
-
|
|
|
|
-1. Install [Redis](http://redis.io/download) and [MongoDB](https://www.mongodb.com/download-center#community)
|
|
|
|
-
|
|
|
|
-2. Install nodemon globally
|
|
|
|
-
|
|
|
|
- `npm install -g nodemon`
|
|
|
|
-
|
|
|
|
-3. Install webpack globally
|
|
|
|
-
|
|
|
|
- `npm install -g webpack`
|
|
|
|
-
|
|
|
|
-4. Install node-gyp globally (first check out <https://github.com/nodejs/node-gyp#installation)>
|
|
|
|
-
|
|
|
|
- `npm install -g node-gyp`.
|
|
|
|
-
|
|
|
|
-5. Execute `cd frontend && npm dev` and `cd backend && npm dev` separately.
|
|
|
|
-
|
|
|
|
### Calling Toasts
|
|
### Calling Toasts
|
|
|
|
|
|
You can call Toasts using our custom package, [`vue-roaster`](https://github.com/atjonathan/vue-roaster), using the following code:
|
|
You can call Toasts using our custom package, [`vue-roaster`](https://github.com/atjonathan/vue-roaster), using the following code:
|
|
|
|
|
|
```js
|
|
```js
|
|
import Toast from "vue-roaster";
|
|
import Toast from "vue-roaster";
|
|
-new Toast({ content: "", persistant: true });
|
|
|
|
|
|
+new Toast({ content: "Hi!", persistant: true });
|
|
```
|
|
```
|
|
|
|
|
|
### Set user role
|
|
### Set user role
|
|
@@ -296,3 +282,11 @@ use musare
|
|
db.auth("MUSAREDBUSER","MUSAREDBPASSWORD")
|
|
db.auth("MUSAREDBUSER","MUSAREDBPASSWORD")
|
|
db.users.update({username: "USERNAME"}, {$set: {role: "admin"}})
|
|
db.users.update({username: "USERNAME"}, {$set: {role: "admin"}})
|
|
```
|
|
```
|
|
|
|
+
|
|
|
|
+<br />
|
|
|
|
+
|
|
|
|
+## Contact
|
|
|
|
+
|
|
|
|
+Get in touch with us via email at [core@musare.com](mailto:core@musare.com) or join our [Discord Guild](https://discord.gg/Y5NxYGP).
|
|
|
|
+
|
|
|
|
+You can also find us on [Facebook](https://www.facebook.com/MusareMusic) and [Twitter](https://twitter.com/MusareApp).
|