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

Server hosting #293

Closed
rosstc opened this issue May 17, 2023 · 5 comments
Closed

Server hosting #293

rosstc opened this issue May 17, 2023 · 5 comments

Comments

@rosstc
Copy link

rosstc commented May 17, 2023

Hey, wondering if I could get some advice from anyone who is hosting their own version of townsquare as to how exactly they are hosting and running the server component of the site. If from my local machine I run the dev server using npm run serve then everything is fine. Splitting out the project and running separate site and server components though doesn't seem to work for me.

I'm able to setup the static hosting of the site built using npm run build in AWS using S3 and CloudFront etc, but am having some trouble running the server part. I created a basic EC2 and ran the server part but no combination of settings seems to work. The static site just keeps failing to connect via sockets, even in development mode with no cert or host validation etc.

Anyone got a working instance setup on AWS or Github (not fussed what the platform is) that they could share some information about?

@bra1n
Copy link
Owner

bra1n commented May 23, 2023

Hey there,
did you read the README here? https://github.com/bra1n/townsquare/tree/develop/server#readme
What kind of error messages are you seeing when trying to connect to the socket? It sounds like the configuration might be wrong or the code not adjusted for your self-hosted backend.

@RobhJoh
Copy link

RobhJoh commented Sep 28, 2023

@rosstc Have you gotten it to work? If so, would you like to share how? As I have made a retheming of BotC I need to host this myself.

@rosstc
Copy link
Author

rosstc commented Oct 2, 2023

Hey @RobhJoh, I did manage to get it working yes. Go check out my groups fork for the front end hosting stuff. The backend part I haven't done as infra as code yet, but how I got it working in AWS was using an Amazon Linux 2 EC2 instance (t2.micro) running in a public subnet with a public IP.

I created a Route53 zone linked to a custom DNS I purchased and created an A record that points to the public IP of the EC2. The EC2 allows 8080, 80, 443 and 8081 from anywhere inbound and anything out. From there I just copied the source code to the machine and have a service that run the /server stuff (node index.js) in the background, which serves the app on port 8080.

To get it to work properly though I had to go through the certificate stuff as referenced in the README. To do this I get free SSL certs through Let's Encrypt installed via certbot. To get the cert I use certbot certonly --standalone which spins up a temporary webserver to validate the domain etc. I copy those certs and rename them as appropriate in the /server directory and it works

@RobhJoh
Copy link

RobhJoh commented Oct 2, 2023

Super big thank you @rosstc for that extensive answer!

@rosstc
Copy link
Author

rosstc commented Oct 2, 2023

Given the answer above and the fact I got it working, I might close this. If anyone needs further info in future you can contact me. Thanks

@rosstc rosstc closed this as completed Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants