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

Separate Server for Website and Uncomment #2

Open
Jieiku opened this issue Jun 16, 2022 · 6 comments
Open

Separate Server for Website and Uncomment #2

Jieiku opened this issue Jun 16, 2022 · 6 comments

Comments

@Jieiku
Copy link

Jieiku commented Jun 16, 2022

I am trying to set this up in an environment where there are two servers, one for the website and one for the uncomment server.

I see (this), and from the readme this:

<div id="comments"></div>
<script data-uncomment
    data-uncomment-target="#comments"
    src="https://uncomment.your-website.com/en-GB/embed.js"></script>

What I am wondering is how I can use the script locally on my website, and it still know how/where to connect to the uncomment server, maybe with a new host value? eg:

<div id="comments"></div>
<script data-uncomment
    data-uncomment-host="111.222.123.44:5000"
    data-uncomment-target="#comments"
    src="embed.js"></script>

I can tell that it was probably not designed to do this, but before I dig in I wanted to get your thoughts on this.

@Jieiku Jieiku closed this as completed Jun 16, 2022
@Jieiku Jieiku reopened this Jun 17, 2022
@Jieiku Jieiku changed the title Quick Question. Separate Server for Website and Uncomment Jun 17, 2022
@nielssp
Copy link
Owner

nielssp commented Jun 18, 2022

I originally intended the scripts/assets to be served by the Uncomment server, so it made sense to just use the src attribute, but since the scripts are static I can totally see the value in serving just the scripts from somewhere else, like a CDN. So I've added data-uncomment-host as a client configuration option as you suggested.

@Jieiku
Copy link
Author

Jieiku commented Jun 18, 2022

Awesome, I just pulled the changes, going to tinker with it tonight but it may be a few days before I make any real progress, have to work tomorrow and sunday is fathers day.

@Jieiku
Copy link
Author

Jieiku commented Jun 18, 2022

Got it! just had to:

cd /uncomment
sudo npm install -g typescript
npm i --save-dev @types/node
tsc

and the dist folder was created.

@Jieiku
Copy link
Author

Jieiku commented Jun 18, 2022

ok gotta get to bed, I got the scripts compiled and the server configured and running without error.

(my guess is I did not compile it correctly in the previous post, even though there were no errors.)

I have the scripts on the website (count and embed) however I am seeing an error exports is not defined

@nielssp
Copy link
Owner

nielssp commented Jun 18, 2022 via email

@Jieiku
Copy link
Author

Jieiku commented Jun 18, 2022

Well here is what I did so far, maybe it can save you some time.

(I know most people like docker, but I am already running a different virtual environment):

sudo apt-get install -y git curl gnupg2 build-essential libssl-dev pkg-config clang postgresql libpq-dev

curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
1
enter
sudo reboot
rustup update
rustc --version

git clone https://github.com/nielssp/uncomment
cd uncomment

## create and configure .env

npm install # did this from my workstation instead
npm run build # did this from my workstation instead
# copy dist folder into uncomment folder on server

cargo build
#cargo build --release

#cargo build --features postgres
#cargo build --release --features postgres

./target/debug/uncomment
#./target/release/uncomment

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

2 participants