Skip to content

Commit

Permalink
Merge pull request #29 from silvereennetwork/main
Browse files Browse the repository at this point in the history
ergre
  • Loading branch information
silvereengames authored Aug 18, 2024
2 parents 1c3184b + 7f8030b commit beb050d
Show file tree
Hide file tree
Showing 429 changed files with 4,788 additions and 1,463 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Use the official Node.js 16 image as a base
FROM node:16

# Create and set the working directory
WORKDIR /app

# Copy package.json and package-lock.json (if available)
COPY package.json package-lock.json* ./

# Install dependencies
RUN npm install

# Copy the rest of your application's code
COPY . .

# Expose the port the app runs on
EXPOSE 8000

# Command to run your app
CMD ["npm", "start"]
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
<p align="center">The best open-source gaming website project that is taking the world by storm.</p>

## Getting started
Run the following commands:
If you have pm2 installed, then all you have to do is run:
```
pm2 start
```
Or without pm2:
```
npm install
node index.js
npm start
```
Then open your browser and go to `http://localhost:8000`
Then open your browser and go to `http://localhost:8000`
30 changes: 30 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
apps: [
{
name: 'index-app', // Name of the application for index.js
script: './index.js', // Script to run
cwd: './', // Current working directory
exec_mode: 'fork', // Fork mode
wait_ready: true, // Wait until the process sends a ready signal
},
{
name: 'update-app', // Name of the application for update.js
script: './update.js', // Script to run
cwd: './', // Current working directory
exec_mode: 'fork', // Fork mode
wait_ready: true, // Wait until the process sends a ready signal
},
],

deploy: {
production: {
user: 'node', // SSH user
host: 'your-server-address',// SSH host
ref: 'origin/main', // Git branch to deploy
repo: '[email protected]:repo.git', // Repository URL
path: '/var/www/production', // Path on the server
'post-deploy': 'npm install && pm2 start ecosystem.config.js --only index-app && pm2 start ecosystem.config.js --only update-app', // Commands to run after deploy
},
},
};

17 changes: 14 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const { createBareServer } = require("@tomphttp/bare-server-node");
const express = require("express");
const proxy = require('express-http-proxy');
const { join } = require('node:path');
const { createServer } = require("node:http");
const { uvPath } = require("@titaniumnetwork-dev/ultraviolet");
const { dynamicPath } = require("@nebula-services/dynamic");
const { hostname } = require("node:os");
const { createProxyMiddleware } = require('http-proxy-middleware');

const bare = createBareServer("/bare/");
const app = express();
Expand All @@ -19,9 +21,18 @@ app.use(
})
);

// Error for everything else
app.get("*", function (req, res) {
res.send("404");
app.use('/forum', createProxyMiddleware({
target: 'https://forum-core.silvereen.net',
changeOrigin: true,
}));

app.use(
'/api',
proxy(`https://api.silvereen.net`)
);

app.use((req, res, next) => {
res.status(404).sendFile(join(__dirname, '/public/404.html'));
});

const server = createServer();
Expand Down
19 changes: 0 additions & 19 deletions install.sh

This file was deleted.

Loading

0 comments on commit beb050d

Please sign in to comment.