pablouser1 / ProxiTok

Open source alternative frontend for TikTok made using PHP
https://github.com/pablouser1/ProxiTok/wiki/Public-instances
GNU Affero General Public License v3.0
1.81k stars 133 forks source link

Docker installation #13

Closed Jenni32222 closed 2 years ago

Jenni32222 commented 2 years ago

Would it be possible to create this project in a Docker container?

EsmailELBoBDev2 commented 2 years ago

I want docker compose

TheFrenchGhosty commented 2 years ago

I'm working on it: https://github.com/PussTheCat-org/docker-proxitok-quay

(it currently doesn't work)

EsmailELBoBDev2 commented 2 years ago

Cool, Will you push it here in official repo or will just stay as a fork?

MoriTanosuke commented 2 years ago

Here is a Dockerfile that works at least for displaying Discover and watching content from users:

FROM php:8

RUN apt-get update && apt-get install -y \
    libzip-dev \
    unzip
RUN docker-php-ext-install -j$(nproc) zip
RUN pecl install -o -f redis \
    && rm -rf /tmp/pear \
    && docker-php-ext-enable redis

RUN curl -o composer.phar https://getcomposer.org/download/latest-stable/composer.phar \
    && chmod +x composer.phar \
    && ./composer.phar -V

RUN curl -Lo proxytok.zip "https://codeload.github.com/pablouser1/ProxiTok/zip/refs/heads/master" \
    && unzip proxytok.zip \
    && rm proxytok.zip
RUN cd ProxiTok-master \
    && ../composer.phar install \
    && rm ../composer.phar

WORKDIR ProxiTok-master
CMD php -S 0.0.0.0:8080

I do keep getting a lot of API errors, but I'm not sure that it is because of the installation or a general issue with TikToks API requests.

EsmailELBoBDev2 commented 2 years ago

done. https://proxitok.esmailelbob.xyz/

but I keep getting errors like:


There was an error processing your request!

HTTP Code: 500

API error code 20 (SIGNATURE_CONNECTION_ERROR)

So yeah it's weird maybe because of installation? I would assume tiktok can block some IP because lots of requests but I just installed this so I think it's installation

pablouser1 commented 2 years ago

done. https://proxitok.esmailelbob.xyz/

but I keep getting errors like:


There was an error processing your request!

HTTP Code: 500

API error code 20 (SIGNATURE_CONNECTION_ERROR)

So yeah it's weird maybe because of installation? I would assume tiktok can block some IP because lots of requests but I just installed this so I think it's installation

Hi, that is because you are trying to run Proxitok in standard mode without a remote or local signer. Quick explanation: Now Proxitok can use the new api from TikTok to fetch data, which requires signing URLs. This at the moment can only be done with a remote signer or a local chromedriver instance. A quick workaround would be setting the API_FORCE_LEGACY enviromental variable to 1. This will force Proxitok to use the legacy endpoints, which do not require signing. You can get more info on the available modes here and more info on the available config here

About the Docker installation, this is one of my top priorities. Having a Proxitok Docker image working would increse the amount of public instances which would be helpful for everyone. I'm currently working on an image that runs on standard mode.

EsmailELBoBDev2 commented 2 years ago

Oh! Well good news that https://github.com/pablouser1/ProxiTok/issues/13#issuecomment-1067748033 works as intended

Bad news on other hand I noticed legacy already ticked on by default but I think I need to re-apply it in settings which is kinda a bug? (I left my instance running for testing) and where is the config file? I'm inside my docker container but I'm a big confused...Which one of these are my config file so I can apply API_FORCE_LEGACY

root@b9c581beb9f2:/ProxiTok-master# ls
LICENSE   README.md  cache       composer.json  index.php  routes.php  scss   styles  views
Procfile  app        components  composer.lock  layouts    scripts     setup  vendor

Oh environment variable right...I'm still dumb with docker sorry. It works (so far) good!

TheFrenchGhosty commented 2 years ago

Thanks to @MoriTanosuke

My image now works: https://quay.io/repository/pussthecatorg/proxitok / https://github.com/PussTheCat-org/docker-proxitok-quay

It's not perfect since it's still using the php development server, but I couldn't make it work with a proper apache (403 eror), right now, I'd say it's "good enough", but it's FAR from perfect (maybe not suitable for big public instances).

Also, API_FORCE_LEGACY is used, which isn't ideal

PS: PHP is such a pain.

pablouser1 commented 2 years ago

Docker is now working with this commit: f0765e266c4e4328652570f8e4390f43f79bf5e6 It works both in standard and legacy mode using PHP8 and Apache (maybe I'll change it to Nginx in the future) To use it just clone the repo and run

docker-compose up

Now you can visit the website on http://localhost:8080

TheFrenchGhosty commented 2 years ago

@pablouser1 I mean...not that I'm against it... but you know, if you reuse my files (you literally have the same style, and whole blocks that are copied from them)... you have to respect the license...

I mean, I would have been okay in giving you permission to re-license them... but you should have asked first.

Jenni32222 commented 2 years ago

@TheFrenchGhosty Thanks for your work, I'll use your image if you plan on updating it.

TheFrenchGhosty commented 2 years ago

@Jenni32222 I'm currently doing it, should be ready in ~5 minutes if everything goes right.

pablouser1 commented 2 years ago

@pablouser1 I mean...not that I'm against it... but you know, if you reuse my files (you literally have the same style, and whole blocks that are copied from them)... you have to respect the license...

I mean, I would have been okay in giving you permission to re-license them... but you should have asked first.

Sorry about that. I didn't even noticed that you were using a license. Should I credit you on the beginning of the file, the README.md or something?

TheFrenchGhosty commented 2 years ago

@Jenni32222 Done. Image is production ready now. (it took longer than I thought because the PHP docker-specific functions aren't good enough to install redis (but good enough for zip) and because I did a stupid mistake

@pablouser1 End of the README please, feel free to pull my changes by the way, your Dockerfile is REALLY flawed (I fixed it), also feel free to recommend my Docker image.