Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added installation instructions for public hosting to readme #715

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,45 @@ docker compose up
```
<br/>

### 🌎 Installation on public server
Subdomain is puter. Replace "domain.com" with your domain name.

#### -Create DNS entries for puter.domain.com and api.puter.domain.com, both pointing to the same IP.

#### -Create apache domain configs for puter.domain.com and api.puter.domain.com and add reverse proxy entries for both subdomains
```$ a2enmod proxy```
```$ a2enmod proxy_http```


##### /etc/apache/sites-enabled/--configfile---
```
ProxyPass / http://localhost:4100/
ProxyPassReverse / http://localhost:4100/
```
#### -Edit ./src/backend/src/config.js
Add after ```let config = {};```
```
config.api_base_url = 'https://api.puter.domain.com';
config.origin='https://puter.domain.com';
config.http_port=443;´
config.pub_port=443;
config.protocol='https';
```

#### -Edit ./node_modules/@heyputer/backend/src/services/WebServerService.js and ./src/backend/src/services/WebServerService.js
Search for
```if (allowedDomains.some(allowedDomain => hostName ===```
and change the line to
```if (allowedDomains.some(allowedDomain => hostName === "puter.domain.com" || hostName.endsWith('.' + allowedDomain))) {```

#### -Edit ./volatile/config/config.json
Change ```"domain": "puter.localhost"``` to ```"domain": "puter.domain.com"```

#### -Run sed to replace the domain in all remaining files
``` grep -rl "puter.localhost:4100" . | xargs sed -i 's/puter.localhost:4001/puter.domain.com/g' ```
<br>
<br>

### ☁️ Puter.com

Puter is available as a hosted service at [**puter.com**](https://puter.com).
Expand Down
8 changes: 6 additions & 2 deletions src/backend/src/routers/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ module.exports = eggspress(['/signup'], {
body: req.body,
});

if( config.registration_closed == true ) {
return res.status(403).send('Registration is closed.');
}

// check bot trap, if `p102xyzname` is anything but an empty string it means
// that a bot has filled the form
// doesn't apply to temp users
Expand Down Expand Up @@ -214,7 +218,7 @@ module.exports = eggspress(['/signup'], {
'UPDATE `user` SET `last_activity_ts` = now() WHERE id=? LIMIT 1',
[insert_res.insertId]
);

// TODO: cache group id
const svc_group = req.services.get('group');
await svc_group.add_users({
Expand Down Expand Up @@ -333,5 +337,5 @@ module.exports = eggspress(['/signup'], {
taskbar_items: await get_taskbar_items(user),
referral_code,
}
})
})
});