scripting / Scripting-News

I'm starting to use GitHub for work on my blog. Why not? It's got good communication and collaboration tools. Why not hook it up to a blog?
120 stars 10 forks source link

Setting up PagePark on node.js using Digital Ocean #217

Closed brandon-toner closed 3 years ago

brandon-toner commented 3 years ago

Background/Context: https://github.com/scripting/Scripting-News/issues/210#

After failing to get PagePark running on the Glitch server, I'm now trying to get it running on Digital Ocean. I'm using this as an opportunity to learn some command line, and continue learning about the fundamentals of how the web works — ultimately with the goal of setting up a running web server.

Documenting progress and questions below.

brandon-toner commented 3 years ago

Steps completed so far:

  1. Setup droplet
  2. Created and used SSH key
  3. Accessed the server via my Mac command line
  4. Installed node.js
  5. Installed npm

References:

brandon-toner commented 3 years ago

So now the next step I need to figure out is how to install PagePark onto this server.

Observations:

Questions: (more rhetorical than anything at this point, just thinking out loud here to organize my thoughts)

  1. On pagepark.io, the steps seem to outline the process for deploying the PagePark server on a local machine. How does the process differ for deploying in the Digital Ocean Ubuntu environment?
  2. Is there a guide published anywhere for installing PagePark in this sort of environment?

References:

brandon-toner commented 3 years ago

Of course, trying to proceed to npm install without having the PagePark file package on the server returns an error.

So, how do I download the PagePark file package to the server so that it can be opened, facilitating the install of the PagePark server?

image

brandon-toner commented 3 years ago

"So, how do I download the PagePark file package to the server so that it can be opened, facilitating the install of the PagePark server?"

I think this is the wrong question. As commented in #210, I think I need to figure out how to "point [Digital Ocean] at the repo for PagePark".

scripting commented 3 years ago

Good morning Brandon. Glad to see you're back at it. Eventually you will get there. I put a pointer to this on scripting.com so hopefully others will come to help.

First, you need to be sure a git client is installed on your server.

sudo apt-get install git

If that doesn't work, here's the Digital Ocean doc on installing git.

Then cd to the directory you want to install PagePark in and enter this command:

git clone https://github.com/scripting/pagePark.git

If that goes well, next thing to do is to

npm install

Then edit your config.json file, as needed, I use the nano editor:

nano config.json

And then...

node pagepark.js

One thing to consider is, if you use Dropbox on your desktop computer, to install it on the server, then copying things to the server is just a matter of downloading stuff on your desktop and copying it into the server's folder.

brandon-toner commented 3 years ago

First, you need to be sure a git client is installed on your server.

Done.

Then cd to the directory you want to install PagePark in and enter this command:

Done. (~/pagePark)

npm install

Done.

Then edit your config.json file, as needed, I use the nano editor:

No edits made yet.

node pagepark.js

Server is running.

brandon-toner commented 3 years ago

In following the instructions in the README.md file:

  1. Create a sub-folder of the domains folder called localhost.

Done.

  1. Using a text editor add a file to the localhost folder called index.md. Put whatever you like in the file. Save it.

I'm stuck here. Not sure how to create and add the file to the localhost directory.

if you use Dropbox on your desktop computer, to install it on the server, then copying things to the server is just a matter of downloading stuff on your desktop and copying it into the server's folder.

I use Google Drive, I suspect that is able to be used as well. This is likely my answer for getting files onto the server.

brandon-toner commented 3 years ago

I use Google Drive, I suspect that is able to be used as well.

Dropbox seemed more straightforward. So I've installed Dropbox and have it connected to my account.

scripting commented 3 years ago

As far as I know there is no Ubuntu client for Google Drive. That's what you'll have to find.

Next, you're following the instructions for getting PP running on your desktop system. That won't work on the server.

localhost is a special name. You should look it up on the web. I'm sure you'll find plenty of explanations. ;-)

Anyway, I'm rushing out the door, so don't have the time to write a tutorial here, but maybe someone else can help.

The goal is to figure out what the name of your computer is. Same thing as before. You have to map one of your domains to this machine. Then instead of "localhost" put the name of the domain. To edit text, use nano, as I described in the earlier message. I'm sure they have a tutorial on nano on Google.

brandon-toner commented 3 years ago

Ok I've successfully setup Dropbox, and copied an "index.md" file into ~/pagePark/domains/brandontoner.ca

I think now I need to make sure the DNS settings are correct such that brandontoner.ca is pointing to the server.

brandon-toner commented 3 years ago

As for the DNS settings:

Result: No connection, yet. (when calling www.brandontoner.ca/index.md, or www.brandontoner.ca)

References:

image image

scripting commented 3 years ago

Don't forget this --

https://github.com/scripting/pagePark#mapping-port-80-to-1339

On Tue, Jul 13, 2021 at 10:14 AM brandon-toner @.***> wrote:

As for the DNS settings:

  • On Digital Ocean's Control Panel I have an A Record (hostname: domain; Value: directs to droplet IP).
  • On Namecheap (domain registrar) I have: custom DNS setup as per Digital Oceans docs.

References:

[image: image] https://user-images.githubusercontent.com/67168828/125467519-2788911b-6d5e-4168-b23a-af19fc153293.png [image: image] https://user-images.githubusercontent.com/67168828/125467556-7853ed94-2e77-40b7-8497-11d0931558d2.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/scripting/Scripting-News/issues/217#issuecomment-879126126, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAM32O7GUSG3H7TM5PZJ54LTXRC5ZANCNFSM5AH6AWNQ .

brandon-toner commented 3 years ago

Woah progress!!

I think I'm connected to the server correctly now. My file didn't render, but I did get the PagePark error message for file not found.

https://github.com/scripting/pagePark#mapping-port-80-to-1339

Did this, then tried = failed. Then I changed to the pagepark directory, ran node pagepark.js to start the server, in case it wasn't activated. = This screen.

image

brandon-toner commented 3 years ago

Re: "File not found".

The index.md file is located in the brandontoner.ca domain folder... not sure why it wouldn't render.

Unless something needs to be adjusted in the config.json?

image

brandon-toner commented 3 years ago

I think I'm connected to the server correctly now.

Confirmed. I'm seeing traffic from my local network when I call the page! CleanShot 2021-07-13 at 19 01 00@2x

scripting commented 3 years ago

I just went to http://brandontoner.ca/ and saw "hello world" -- so i guess you got all the glitches ironed out. ;-)

brandon-toner commented 3 years ago

Woohoo! That's good news.

So now I suppose I could try to setup those mirrors to get the live publishing from Little Outliner 2.

What are the steps for getting that configured?

brandon-toner commented 3 years ago

What are the steps for getting that configured?

Figured it out! Modelled after your pagepark.glitch.me project you shared in #210.

Now I just need to re-write the content and mirrors so they display as intended. But the nuts and bolts are in place.

Next goal: Setup a blogging template similar to scripting.com

scripting commented 3 years ago

Keep on truckin! ;-)

I'm so swamped, I wish I could help.

I wish some others would come play with you.

scripting commented 3 years ago

I just checked how pagepark.glitch.me works, and it's good -- it uses the "mirrors" feature, the one I fixed so it would work for what you're doing. I'm glad that that helped. Here's a screen shot of what's in the config.json file of that domain on Glitch.

image

brandon-toner commented 3 years ago

Success.

I wrote a simple index.html, added the mirrors and the links work on testing!

brandontoner.ca

image

mistersugar commented 3 years ago

@brandon-toner Well done and kudos to you!

What are you mirroring for the blog.opml page? Is it a public link to a LittleOutliner outline?

brandon-toner commented 2 years ago

Ok I'm returning back to this after a while — and feeling a little rusty on how to operate PagePark.

Goal: I have a domain name for our pharmacy business and I'd like to upload some basic pages to display on that url.

After some mucking around today, I figured out how to log into my Digital Ocean Droplet via Terminal on my MacOS.

Next, re-figure out how to point my domains to PagePark.

Going to explore the directory now to see what jogs my memory.

brandon-toner commented 2 years ago

The domain I'm trying to activate is www.medicineshoppesydney.ca.

image image

Next question: How did I get that index.md page loaded?

Next question: How do I use Dropbox on Terminal? ....

brandon-toner commented 2 years ago

I really wish I could see a full history of the commands run on this server. A little trip back through that log would be HELPFUL right now.

brandon-toner commented 2 years ago

Ok, I can see the contents of the index.md file reflect the content displaying live when calling the URL.

image

So that's promising. I'm re-learning how to navigate the server using command line. That's good.

scripting commented 2 years ago

Brandon, you're misusing this resource. It's a place to report issues with this specific product, PagePark.

brandon-toner commented 2 years ago

Ok, noted.