diff --git a/README.md b/README.md index d991595..c08b03c 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,95 @@ # pontus-mail -[](#) + +[](https://github.com/ihatenodejs/pontus-mail) [](http://creativecommons.org/publicdomain/zero/1.0/) Landing page for p0ntus mail -# Self hosting -## Traditional Node.js + +## Self hosting + +### Using Express + 1. Clone the repo + ```bash git clone https://github.com/ihatenodejs/pontus-mail.git cd pontus-mail ``` + 2. Copy the example `docker-compose.yml` + ```bash mv docker-compose.yml.example docker-compose.yml ``` + 3. Copy the example `donations.json` + ```bash mv donations.json.example donations.json ``` + 4. Copy the example `.env` + ```bash mv .env.example .env ``` - Make sure you edit this with your MySQL server information and other values. + Make sure you edit this with the desired internal port. We suggest keeping the internal port set to `3000`. 5. Install dependencies + ```bash npm install ``` + 6. Start the server + ```bash node app.js ``` You will now have a fully functioning Node.js Express server, which will be running on port `3000`. -## With Docker + +### Using Docker + You can also use Docker to self-host pontus-mail's frontend. Make sure you have docker-compose or docker-compose-plugin installed on your system. + 1. Clone the repo + ```bash git clone https://github.com/ihatenodejs/pontus-mail.git cd pontus-mail ``` + 2. Copy the example `docker-compose.yml` + ```bash mv docker-compose.yml.example docker-compose.yml ``` + 3. Copy the example `.env` + ```bash mv .env.example .env ``` - Make sure you edit this file with values matching in `docker-compose.xml`, and other desired values like admin username/password. + This configuration's defaults have been set to be compatible with Docker. Please do not change this file unless you know what you're doing! 4. Copy the example `donations.json` + ```bash mv donations.json.example donations.json ``` + 5. Start and build Docker containers + ```bash docker compose up -d --build ``` You will now have a fully functioning Node.js Express server, which will be running on the port specified in `docker-compose.yml`, and internally on port `3000`. -# To-Do +## To-Do + - [ ] Port to NextJS? - [ ] Hovering effects for buttons +- [ ] Reintegrate backend logic for counters on home page - [ ] Statistics animation - diff --git a/app.js b/app.js index ca5c6c9..34ece15 100644 --- a/app.js +++ b/app.js @@ -6,6 +6,21 @@ const axios = require('axios'); const NodeCache = require('node-cache'); const cache = new NodeCache({ stdTTL: 1800 }); +function checkSetup() { + if (!fs.existsSync(path.join(__dirname, '.env'))) { + console.error("Couldn't find .env file, please create one using the provided .env.example file."); + process.exit(1); + } + + const reqVar = ['INTERNAL_PORT']; + const missingVar = reqVar.filter(envVar => !process.env[envVar]); + + if (missingVar.length > 0) { + console.error(`Oops, you're missing these required variables in your .env file: ${missingVar.join(', ')}`); + process.exit(1); + } +} + require('dotenv').config(); const app = express(); @@ -15,45 +30,8 @@ app.set('views', path.join(__dirname, 'src')); app.use(bodyParser.urlencoded({ extended: false })); app.use(express.static(path.join(__dirname, 'public'))); -//async function fetchDomainData() { -// const cachedData = cache.get('domainData'); -// if (cachedData) { -// return cachedData; -// } -// -// try { -// const response = await axios.get('https://user.p0ntus.com/api/v1/get/domain/all', { -// headers: { -// 'accept': 'application/json', -// 'X-API-Key': process.env.MC_API_KEY -// } -// }); -// const domainData = response.data; -// cache.set('domainData', domainData); -// return domainData; -// } catch (error) { -// console.error('Error fetching domain data:', error); -// return []; -// } -//} - -//function getDomains() { -// const domainsPath = path.join(__dirname, 'domains.txt'); -// try { -// const domains = fs.readFileSync(domainsPath, 'utf-8').split('\n').filter(Boolean); -// return domains; -// } catch (error) { -// console.error('Error reading domains.txt:', error); -// return []; -// } -//} - +// TODO: Reintegrate backend logic for counters on home page app.get('/', async (req, res) => { - //const domainData = await fetchDomainData(); - //const domainCount = Array.isArray(domainData) ? domainData.length : 0; - //const accountCount = Array.isArray(domainData) ? domainData.reduce((acc, domain) => acc + domain.mboxes_in_domain, 0) : 0; - //const totalData = Array.isArray(domainData) ? domainData.reduce((acc, domain) => acc + parseInt(domain.bytes_total), 0) / (1024 * 1024) : 0; - res.render('index', { currentPage: 'home' }); }); @@ -122,7 +100,8 @@ app.get('/guides/vaultwarden/firefox', (req, res) => { res.render('guides/vaultwarden/firefox', { currentPage: 'guides' }); }); -// Start server on internal port defined in .env +// Verify .env and start server on internal port defined in .env +checkSetup(); app.listen(process.env.INTERNAL_PORT, () => { console.log(`Server started on port ${process.env.INTERNAL_PORT}`); }); \ No newline at end of file diff --git a/src/guides.ejs b/src/guides.ejs index 1163117..b68f868 100644 --- a/src/guides.ejs +++ b/src/guides.ejs @@ -16,7 +16,7 @@ - Email + Email
Our system collects automatically:
What I collect by choice:
What the admin has access to:
+What admins have access to:
Please Note: It may be possible for the server owner (or an administrator with shell access) to view your messages
What I do with the data collectedI don't store any of your data for monetary gain or marketing purposes. I have nothing to market to you.
@@ -31,9 +33,9 @@I will never share your data with third parties unless required by law.
SecurityProvided all of our security is functioning, only the owners of this service (p0ntus and lucmsilva) and the hosting provider (Namecheap) has access to the data and server.
I am committed to ensuring that your data is secure. However, I am no security professional.
-p0ntus mail is powered by Mailcow, running in Docker. I check for updates several times a day.
-A strong firewall is backing the server. The server is physically located in Michigan, USA.
-Your emails are stored encrypted and compressed (using LZ4). I, as the server admin, have access to the decryption keys.
+p0ntus mail is powered by Mailu, running in Docker. Updates are applied daily for security.
+The server hosting all of LibreCloud and p0ntus mail is physically located in Atlanta, Georgia and rented from Namecheap Inc.
<%- include('shards/footer') %> \ No newline at end of file diff --git a/src/services.ejs b/src/services.ejs index f46f9cc..5077a11 100644 --- a/src/services.ejs +++ b/src/services.ejs @@ -33,8 +33,8 @@p0ntus mail is personally managed and monitored for maximum uptime.
+p0ntus mail offers an ever-changing selection of additional services such as Git, available for free.
You may request for additional storage, or increased account limits by contacting adminp0ntus.com. We operate under a "fair use" policy.
You may also be limited in storage depending on your use. There is a 100% chance you will get 4000 MB if you would like to actually use the email service. Some people will not use their accounts and hold up disk quotas.
+All aforementioned services are self-hosted on our servers. All data is under control by me and the hosting provider (Namecheap).
VaultwardenVaultwarden is a password manager that is included with your services. You can access it by visiting vaultwarden.p0ntus.com and creating a account.
-You do not need a p0ntus mail account to create a Vaultwarden account.
+You will need a p0ntus mail account to create a Vaultwarden account.
<%- include('shards/footer') %> \ No newline at end of file