Przeglądaj źródła

Updated and organized the README

howdoyoucode 8 lat temu
rodzic
commit
771650f237
2 zmienionych plików z 46 dodań i 171 usunięć
  1. 43 166
      README.md
  2. 3 5
      backend/config/template.json

+ 43 - 166
README.md

@@ -1,6 +1,6 @@
 # MusareNode
 # MusareNode
 This is a rewrite of the original [Musare](https://github.com/Musare/MusareMeteor)
 This is a rewrite of the original [Musare](https://github.com/Musare/MusareMeteor)
-in NodeJS, Express, SocketIO and React. Everything is ran in it's own docker container, but you can also run it without Docker.
+in NodeJS, Express, SocketIO and React.
 
 
 The site is available at [https://musare.com](https://musare.com).
 The site is available at [https://musare.com](https://musare.com).
 
 
@@ -28,15 +28,11 @@ which can become the primary node if the current primary node goes down.
 We currently only have 1 backend, 1 MongoDB server and 1 Redis server running for production, though it is relatively easy to expand.
 We currently only have 1 backend, 1 MongoDB server and 1 Redis server running for production, though it is relatively easy to expand.
 
 
 ## Requirements
 ## Requirements
-Option 1: (not recommended for Windows users)
- * [Docker](https://www.docker.com/)
-
-Option 2:
- * [NodeJS](https://nodejs.org/en/download/)
+ * [NodeJS](https://nodejs.org/en/download/) (we recommend using [Node Version Manager](https://github.com/coreybutler/nvm-windows) for managing your Node.js installation instead)
  	* nodemon: `npm install -g nodemon`
  	* nodemon: `npm install -g nodemon`
  	* [node-gyp](https://github.com/nodejs/node-gyp#installation)
  	* [node-gyp](https://github.com/nodejs/node-gyp#installation)
  * [MongoDB](https://www.mongodb.com/download-center)
  * [MongoDB](https://www.mongodb.com/download-center)
- * [Redis (Windows)](https://github.com/MSOpenTech/redis/releases/tag/win-3.2.100) [Redis (Unix)](https://redis.io/download)
+ * [Redis (Windows)](https://github.com/MSOpenTech/redis/releases/tag/win-3.2.100) or [Redis (Unix)](https://redis.io/download)
 
 
 ## Getting Started
 ## Getting Started
 Once you've installed the required tools:
 Once you've installed the required tools:
@@ -48,26 +44,30 @@ 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`
 
 
 	Values:  
 	Values:  
-   	The `secret` key can be whatever. It's used by express's session module.  
-   	The `domain` should be the url where the site will be accessible from, usually `http://localhost` for non-Docker.  
-   	The `serverDomain` should be the url where the backend will be accessible from, usually `http://localhost:8080` for non-Docker.  
-   	The `serverPort` should be the port where the backend will listen on, usually `8080` for non-Docker.  
-   	`isDocker` if you are using Docker or not.  
-   	The `apis.youtube.key` value can be obtained by setting up a [YouTube API Key](https://developers.google.com/youtube/v3/getting-started).  
+   	`secret`: Can be anything. It's used by express's session module.  
+   	`domain`: Should be the url where the site will be accessible from, usually `http://localhost` locally.  
+   	`serverDomain`: Should be the url where the backend will be accessible from, usually `http://localhost:8080` locally.  
+   	`serverPort`: Should be the port where the backend will listen on, usually `8080` locally.  
+   	`isDocker`: If you are using Docker or not.  
+   	`apis.youtube.key`: Can be obtained by setting up a [YouTube API Key](https://developers.google.com/youtube/v3/getting-started).  
+   	`apis.recaptcha.secret`: Value can be obtained by setting up a [ReCaptcha Site](https://www.google.com/recaptcha/admin).  
+   	`apis.github`: Values can be obtained by setting up a [GitHub OAuth Application](https://github.com/settings/developers).  
+   	`apis.discord.token`: The token for the Discord bot.  
+   	`apis.discord.loggingServer`: The Discord logging server id.  
+   	`apis.discord.loggingChannel`: The Discord logging channel id.  
+   	`apis.mailgun`: Values can be obtained by setting up a [Mailgun account](http://www.mailgun.com/).  
+   	`redis.url`: Should be `redis://localhost:6379/0` for local use.
+   	`redis.password`: Should be the Redis password you put in your `startRedis.cmd` file for Windows.
+   	`mongo.url`: Needs to have the proper password for the MongoDB musare user. 
+   	`cookie.domain`: Value should be the uri you use to access the site, without protocols (http/https), so for example `localhost`.   
+   	`cookie.secure`: Value should be `true` for SSL connections, and `false` for normal http connections.  
+
+4. Setting up GitHub:  
 	To set up a GitHub OAuth Application, you need to fill in some value's. 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`.
 	To set up a GitHub OAuth Application, you need to fill in some value's. 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`.
-   	The `apis.recaptcha.secret` value can be obtained by setting up a [ReCaptcha Site](https://www.google.com/recaptcha/admin).  
-   	The `apis.github` values can be obtained by setting up a [GitHub OAuth Application](https://github.com/settings/developers).  
-   	The `apis.discord.token` is the token for the Discord bot.  
-   	The `apis.discord.loggingServer` is the Discord logging server id.  
-   	The `apis.discord.loggingChannel` is the Discord logging channel id.  
-   	The `apis.mailgun` values can be obtained by setting up a [Mailgun account](http://www.mailgun.com/).  
-   	The `redis.url` url should be left alone for Docker, and changed to `redis://localhost:6379/0` for non-Docker.
-   	The `redis.password` should be the Redis password you either put in your `startRedis.cmd` file for Windows, or `docker-compose.yml` for docker.
-   	The `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`.  
-   	The `cookie.domain` value should be the ip or address you use to access the site, without protocols (http/https), so for example `localhost`.   
-   	The `cookie.secure` value should be `true` for SSL connections, and `false` for normal http connections.  
 
 
-4. `cp frontend/build/config/template.json frontend/build/config/default.json`
+	These values should be put in the `apis.github.client`, `apis.github.secret` and `apis.github.redirect_uri`.
+
+5. `cp frontend/build/config/template.json frontend/build/config/default.json`
 
 
 	Values:  
 	Values:  
    	The `serverDomain` should be the url where the backend will be accessible from, usually `http://localhost:8080` for non-Docker.   
    	The `serverDomain` should be the url where the backend will be accessible from, usually `http://localhost:8080` for non-Docker.   
@@ -75,71 +75,9 @@ Once you've installed the required tools:
    	The `cookie.domain` value should be the ip or address you use to access the site, without protocols (http/https), so for example `localhost`.   
    	The `cookie.domain` value should be the ip or address you use to access the site, without protocols (http/https), so for example `localhost`.   
    	The `cookie.secure` value should be `true` for SSL connections, and `false` for normal http connections.  
    	The `cookie.secure` value should be `true` for SSL connections, and `false` for normal http connections.  
 
 
-Now you have different paths here.
-
-#### Docker
-
-1. Build the backend and frontend Docker images (from the main folder)
-
-   `docker-compose build`
-
-2. Set up the MongoDB database
-
-	1. Disable auth
-	
-		In `docker-compose.yml` remove `--auth` from the line `command: "--auth"` for mongo.
-	
-	2. Start the database
-	
-		`docker-compose up mongo`
-		
-	3. Connect to Mongo
-	
-		`docker-compose exec mongo mongo admin`
-	
-	4. Create an admin user
-	
-		`db.createUser({user: 'admin', pwd: 'PASSWORD_HERE', roles: [{role: 'root', db: 'admin'}]})`
-		
-	5. Connect to the Musare database
-	
-		`use musare`
-		
-	6. Create the musare user
-	
-		`db.createUser({user: 'musare', pwd: 'OTHER_PASSWORD_HERE', roles: [{role: 'readWrite', db: 'musare'}]})`
-	
-	7. Exit
-	
-		`exit`
-	
-	8. Add back authentication
-	
-		In `docker-compose.yml` add back `--auth` on the line `command: ""` for mongo.
-	
-
-3. Start the databases and tools in the background, as we usually don't need to monitor these for errors
-
-   `docker-compose up -d mongo mongoclient redis`
-
-4. Start the backend and frontend in the foreground, so we can watch for errors during development
-
-   `docker-compose up backend frontend`
-
-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:
-
-   * Docker for Windows / Mac: This is just `localhost`
-
-   * Docker ToolBox: The output of `docker-machine ip default`
-
-#### Non-docker
+### Setting up locally
 
 
-Steps 1-4 are things you only have to do once. The steps to start servers follow.
-
-1. In the root folder, create a folder called `.database`
+1. In the root folder, create a folder called `database`
 
 
 2. Create a file called `startMongo.cmd` in the root folder with the contents:
 2. Create a file called `startMongo.cmd` in the root folder with the contents:
 
 
@@ -183,97 +121,36 @@ Steps 1-4 are things you only have to do once. The steps to start servers follow
 
 
 	And again, make sure that the paths lead to the proper config and executable.
 	And again, make sure that the paths lead to the proper config and executable.
 
 
-##### Starting Servers
-
-**Automatic**
-
-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.
-
-**Manual**
-
-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`
-
-3. In a command prompt with the pwd of backend, run `nodemon`
-
-## Extra
-
-Below is a list of helpful tips / solutions we've collected while developing MusareNode.
-
-### Mounting a non-standard directory in Docker Toolbox on Windows
-
-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.
-
-1. First lets ensure the machine isn't running
-
-   `docker-machine stop default`
-
-1. Next we'll want to tell the machine about the folder we want to share.
-
-   `"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" sharedfolder add default --name "d/Projects/MusareNode" --hostpath "D:\Projects\MusareNode" --automount`
-
-2. Now start the machine back up and ssh into it
-
-   `docker-machine start default && docker-machine ssh default`
-
-3. Tell boot2docker to mount our volume at startup, by appending to its startup script
-	```bash
-	sudo tee -a /mnt/sda1/var/lib/boot2docker/profile >/dev/null <<EOF
-
-	mkdir -p /d/Projects/MusareNode
-	mount -t vboxsf -o uid=1000,gid=50 d/Projects/MusareNode /d/Projects/MusareNode
-	EOF
-	```
-
-4. Restart the docker machine so that it uses the new shared folder
-
-   `docker-machine restart default`
-
-5. You now should be good to go!
-
-### Fixing the "couldn't connect to docker daemon" error
-
-Some people have had issues while trying to execute the `docker-compose` command.
-To fix this, you will have to run `docker-machine env default`.
-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`.
-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
+6. Install nodemon globally
 
 
    `npm install nodemon -g`
    `npm install nodemon -g`
 
 
-3. Install webpack globally
+7. Install webpack globally
 
 
    `npm install webpack -g`
    `npm install webpack -g`
 
 
-4. Install node-gyp globally (first check out https://github.com/nodejs/node-gyp#installation)
+8. Install node-gyp globally (first check out https://github.com/nodejs/node-gyp#installation)
 
 
    `npm install node-gyp -g`.
    `npm install node-gyp -g`.
 
 
-5. In both `frontend` and `backend` folders, do `npm install`.
+9. In both `frontend` and `backend` folders, do `npm install`.
 
 
-6. `nodemon backend/index.js`
+### Starting Servers
+
+**Automatic**
 
 
-<!--### Calling Toasts
+1.  If you are on Windows you can run `windows-start.cmd` and all servers will automatically start up.
+
+**Manual**
+
+1. Run `startRedis.cmd` and `startMongo.cmd` to start Redis and Mongo.
 
 
-You can call Toasts using our custom package, [`vue-roaster`](https://github.com/atjonathan/vue-roaster), using the following code:
+2. In the frontend folder, run `npm run dev`.
 
 
-```js
-import { Toast } from 'vue-roaster';
-Toast.methods.addToast('', 0);
-```-->
+3. In the backend folder, run `nodemon`.
 
 
 ## Contact
 ## Contact
 
 
-There are multiple ways to contact us. You can send an email to [musaremusic@gmail.com](musaremusic@gmail.com).
+There are multiple ways to contact us. You can send an email to [core@musare.com](core@musare.com).
 
 
-You can also message us on [Facebook](https://www.facebook.com/MusareMusic), [Twitter](https://twitter.com/MusareApp) or on our [Discord](https://discord.gg/Y5NxYGP).
+You can also message us on [Facebook](https://www.facebook.com/MusareMusic), [Twitter](https://twitter.com/MusareApp) or on our [Discord Guild](https://discord.gg/Y5NxYGP).

+ 3 - 5
backend/config/template.json

@@ -30,17 +30,15 @@
 	},
 	},
 	"cors": {
 	"cors": {
 		"origin": [
 		"origin": [
-			"http://localhost",
-			"http://192.168.99.100",
-			"http://dev.musare.com"
+			"http://localhost"
 		]
 		]
 	},
 	},
   	"redis": {
   	"redis": {
-	  	"url": "redis://redis:6379/0",
+	  	"url": "redis://localhost:6379/0",
 	    "password": "PASSWORD"
 	    "password": "PASSWORD"
 	},
 	},
   	"mongo": {
   	"mongo": {
-	  	"url": "mongodb://musare:PASSWORD@mongo:27017/musare"
+	  	"url": "mongodb://musare:PASSWORD@localhost:27017/musare"
 	},
 	},
   	"cookie": {
   	"cookie": {
 	  	"domain": "",
 	  	"domain": "",