Feat: resolve dependencies & support Render free tier #68
35
README.md
35
README.md
@ -283,6 +283,41 @@ LOG_LEVEL=debug
|
|||||||
# GA_ID=G-XXXX
|
# GA_ID=G-XXXX
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Deploy to Render & MongoDB Atlas
|
||||||
|
|
||||||
|
Note 1: Visa/Mastercard credit card needed to use two free tier services.
|
||||||
|
Note 2: Render free tier has a timeout of 15 min. Please use some monitoring program to keep it alive.
|
||||||
|
|
||||||
|
1. Register and create a MongoDB Atlas M0 (Free tier) Database
|
||||||
|
|
||||||
|
Choose these zones to minimize latency (the left column):
|
||||||
|
|
||||||
|
| MongoDB Atlas Location | Render Location |
|
||||||
|
| :----: | :----: |
|
||||||
|
| AWS: us-east-1 / Azure: eastus2 | Virginia, USA |
|
||||||
|
| AWS: us-west-2 | Oregon, USA |
|
||||||
|
| AWS: ap-southeast-1 / GCP: asia-southeast1 | Singapore |
|
||||||
|
| AWS: eu-central-1 | Frankfurt, Germany |
|
||||||
|
|
||||||
|
After creating the database, you will be redirected to security instruction page.
|
||||||
|
Please choose to allow all ips. And take a note of created user/pass.
|
||||||
|
After instruction process, go to Connect--Drivers, copy the connection string and replace pass with yours.
|
||||||
|
|
||||||
|
2. Register and create the Render Service
|
||||||
|
|
||||||
|
Choose New--"Web service"
|
||||||
|
Source code: Choose "Public Git Repository", and paste this repo's url `https://github.com/journey-ad/Moe-Counter`, then click Connect
|
||||||
|
Choose your own name
|
||||||
|
Language: Choose Node
|
||||||
|
Branch: default (Master)
|
||||||
|
Region: Choose the according location on the right column of the table above
|
||||||
|
Instance type: Choose Free
|
||||||
|
Environments: Just copy your configuration set before, and just paste into it. It will automatically parse the values.
|
||||||
|
Finally click Deploy.
|
||||||
|
|
||||||
|
(Optional) set your own custom domain. (Don't forget to change environment value as well)
|
||||||
|
(Optional) set free monitoring using any monitor system. (Most services offer free monitoring per 5 minutes, which is enough.)
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
* [Glitch](https://glitch.com/)
|
* [Glitch](https://glitch.com/)
|
||||||
|
@ -13,11 +13,7 @@ const schema = new mongoose.Schema(
|
|||||||
// the default mongodb url (local server)
|
// the default mongodb url (local server)
|
||||||
const mongodbURL = process.env.DB_URL || "mongodb://127.0.0.1:27017";
|
const mongodbURL = process.env.DB_URL || "mongodb://127.0.0.1:27017";
|
||||||
|
|
||||||
mongoose.connect(mongodbURL, {
|
mongoose.connect(mongodbURL);
|
||||||
useNewUrlParser: true,
|
|
||||||
useUnifiedTopology: true,
|
|
||||||
useFindAndModify: false,
|
|
||||||
});
|
|
||||||
|
|
||||||
const Count = mongoose.connection.model("Count", schema);
|
const Count = mongoose.connection.model("Count", schema);
|
||||||
|
|
||||||
|
17
package.json
17
package.json
@ -11,17 +11,14 @@
|
|||||||
"author": "journey-ad",
|
"author": "journey-ad",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^8.2.0",
|
"better-sqlite3": "^11.5.0",
|
||||||
"compression": "^1.7.4",
|
"compression": "^1.7.5",
|
||||||
"dotenv": "^16.4.5",
|
"dotenv": "^16.4.5",
|
||||||
"express": "^4.18.2",
|
"express": "^4.21.1",
|
||||||
"image-size": "^0.8.3",
|
"image-size": "^1.1.1",
|
||||||
"mime-types": "^2.1.27",
|
"mime-types": "^2.1.35",
|
||||||
"mongoose": "^5.9.28",
|
"mongoose": "^8.8.2",
|
||||||
"pug": "^3.0.0",
|
"pug": "^3.0.3",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "16.x"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1644
pnpm-lock.yaml
generated
1644
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user