plausible / community-edition

Example Docker Compose setup for hosting Plausible Community Edition
1.2k stars 282 forks source link

ARM64 Support #44

Closed navanchauhan closed 1 year ago

navanchauhan commented 2 years ago

Leaving this here in case anyone stumbles across this issue. I was able to successfully self-host plausible on an arm64 based Oracle Compute Instance by modifying the docker-compose.

More information on the Discussion https://github.com/plausible/analytics/discussions/903#discussioncomment-2619074

In the docker-compose just replace:

I did not open a PR because it will be only useful after plausible starts publishing official multi-arch images. https://github.com/plausible/analytics/pull/1287 A simple edit in the GitHub Actions workflow will allow for that

sebdanielsson commented 2 years ago

I would love arm64/aarch64 support as well. Then I could host Plausible on my odroid-n2.

sebdanielsson commented 2 years ago

Upgrading to clickhouse-server:22.4.2.1 broke my container setup.

Processing configuration file '/etc/clickhouse-server/config.xml'.
Merging configuration file '/etc/clickhouse-server/config.d/docker_related_config.xml'.
Merging configuration file '/etc/clickhouse-server/config.d/logging.xml'.
Logging warning to /var/log/clickhouse-server/clickhouse-server.log
Logging errors to /var/log/clickhouse-server/clickhouse-server.err.log
2022.04.23 16:49:27.078238 [ 1 ] {} <Warning> Context: Linux is not using fast TSC clock source. Performance can be degraded.
2022.04.23 16:49:27.133140 [ 1 ] {} <Warning> Context: Linux threads max count is too low.
2022.04.23 16:49:27.133514 [ 1 ] {} <Warning> Context: Available memory at server startup is too low (2GiB).
2022.04.23 16:49:27.808304 [ 1 ] {} <Warning> Application: Calculated checksum of the binary: F2D14FA394CECCE5AED0925B54461551. There is no information about the reference checksum.
2022.04.23 16:49:27.850562 [ 1 ] {} <Error> CertificateReloader: Cannot obtain modification time for certificate file /etc/clickhouse-server/server.crt, skipping update. errno: 2, strerror: No such file or directory
2022.04.23 16:49:27.851501 [ 1 ] {} <Error> CertificateReloader: Cannot obtain modification time for key file /etc/clickhouse-server/server.key, skipping update. errno: 2, strerror: No such file or directory
2022.04.23 16:49:27.868059 [ 1 ] {} <Error> CertificateReloader: Poco::Exception. Code: 1000, e.code() = 0, SSL context exception: Error loading private key from file /etc/clickhouse-server/server.key: error:02000002:system library:OPENSSL_internal:No such file or directory (version 22.4.2.1 (official build))
2022.04.23 16:49:28.176159 [ 1 ] {} <Warning> Application: Listen [::]:8123 failed: Poco::Exception. Code: 1000, e.code() = 0, DNS error: EAI: Address family for hostname not supported (version 22.4.2.1 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
2022.04.23 16:49:28.177112 [ 1 ] {} <Warning> Application: Listen [::]:9000 failed: Poco::Exception. Code: 1000, e.code() = 0, DNS error: EAI: Address family for hostname not supported (version 22.4.2.1 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
2022.04.23 16:49:28.177829 [ 1 ] {} <Warning> Application: Listen [::]:9009 failed: Poco::Exception. Code: 1000, e.code() = 0, DNS error: EAI: Address family for hostname not supported (version 22.4.2.1 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
2022.04.23 16:49:28.178566 [ 1 ] {} <Warning> Application: Listen [::]:9004 failed: Poco::Exception. Code: 1000, e.code() = 0, DNS error: EAI: Address family for hostname not supported (version 22.4.2.1 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
2022.04.23 16:49:28.179170 [ 1 ] {} <Warning> Application: Listen [::]:9005 failed: Poco::Exception. Code: 1000, e.code() = 0, DNS error: EAI: Address family for hostname not supported (version 22.4.2.1 (official build)). If it is an IPv6 or IPv4 address and your host has disabled IPv6 or IPv4, then consider to specify not disabled IPv4 or IPv6 address to listen in <listen_host> element of configuration file. Example for disabled IPv6: <listen_host>0.0.0.0</listen_host> . Example for disabled IPv4: <listen_host>::</listen_host>
2022.04.23 16:49:28.408196 [ 1 ] {} <Error> CertificateReloader: Cannot obtain modification time for certificate file /etc/clickhouse-server/server.crt, skipping update. errno: 2, strerror: No such file or directory
2022.04.23 16:49:28.408615 [ 1 ] {} <Error> CertificateReloader: Cannot obtain modification time for key file /etc/clickhouse-server/server.key, skipping update. errno: 2, strerror: No such file or directory
2022.04.23 16:49:28.419647 [ 1 ] {} <Error> CertificateReloader: Poco::Exception. Code: 1000, e.code() = 0, SSL context exception: Error loading private key from file /etc/clickhouse-server/server.key: error:02000002:system library:OPENSSL_internal:No such file or directory (version 22.4.2.1 (official build))
2022.04.23 16:52:49.808878 [ 47 ] {} <Error> ServerErrorHandler: Poco::Exception. Code: 1000, e.code() = 107, Net Exception: Socket is not connected, Stack trace (when copying this message, always include the lines below):

0. Poco::Net::NetException::NetException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x1b3c934c in /usr/bin/clickhouse
1. Poco::Net::SocketImpl::error(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x1b3dcdc4 in /usr/bin/clickhouse
2. Poco::Net::SocketImpl::peerAddress() @ 0x1b3df4b6 in /usr/bin/clickhouse
3. DB::HTTPServerRequest::HTTPServerRequest(std::__1::shared_ptr<DB::Context const>, DB::HTTPServerResponse&, Poco::Net::HTTPServerSession&) @ 0x16ffd398 in /usr/bin/clickhouse
4. DB::HTTPServerConnection::run() @ 0x16ffbec2 in /usr/bin/clickhouse
5. Poco::Net::TCPServerConnection::start() @ 0x1b3e444f in /usr/bin/clickhouse
6. Poco::Net::TCPServerDispatcher::run() @ 0x1b3e68a1 in /usr/bin/clickhouse
7. Poco::PooledThread::run() @ 0x1b5ad2e9 in /usr/bin/clickhouse
8. Poco::ThreadImpl::runnableEntry(void*) @ 0x1b5aa640 in /usr/bin/clickhouse
9. ? @ 0x7fc391a30609 in ?
10. __clone @ 0x7fc391955163 in ?
 (version 22.4.2.1 (official build))
2022.04.23 16:52:49.820075 [ 46 ] {} <Error> ServerErrorHandler: Poco::Exception. Code: 1000, e.code() = 107, Net Exception: Socket is not connected, Stack trace (when copying this message, always include the lines below):

0. Poco::Net::NetException::NetException(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) @ 0x1b3c934c in /usr/bin/clickhouse
1. Poco::Net::SocketImpl::error(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x1b3dcdc4 in /usr/bin/clickhouse
2. Poco::Net::SocketImpl::peerAddress() @ 0x1b3df4b6 in /usr/bin/clickhouse
3. DB::HTTPServerRequest::HTTPServerRequest(std::__1::shared_ptr<DB::Context const>, DB::HTTPServerResponse&, Poco::Net::HTTPServerSession&) @ 0x16ffd398 in /usr/bin/clickhouse
4. DB::HTTPServerConnection::run() @ 0x16ffbec2 in /usr/bin/clickhouse
5. Poco::Net::TCPServerConnection::start() @ 0x1b3e444f in /usr/bin/clickhouse
6. Poco::Net::TCPServerDispatcher::run() @ 0x1b3e68a1 in /usr/bin/clickhouse
7. Poco::PooledThread::run() @ 0x1b5ad2e9 in /usr/bin/clickhouse
8. Poco::ThreadImpl::runnableEntry(void*) @ 0x1b5aa640 in /usr/bin/clickhouse
9. ? @ 0x7fc391a30609 in ?
10. __clone @ 0x7fc391955163 in ?
 (version 22.4.2.1 (official build))
navanchauhan commented 2 years ago

Are you unable to use it? Or, are these just logged errors and warnings

sebdanielsson commented 2 years ago

I was unable to use Plausible. The main container restarted every couple of minutes.

navanchauhan commented 2 years ago

I’ll try to recreate this by using the original clickhouse version and then upgrading on an x86_64 machine

On 24-Apr-2022, at 11:11 PM, Sebastian @.***> wrote:

I was unable to use Plausible. The main container restarted every couple of minutes.

— Reply to this email directly, view it on GitHub https://github.com/plausible/hosting/issues/44#issuecomment-1108085007, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7BHQAXBMD2MVLAZLRKZYLVGYSQZANCNFSM5UELSUAQ. You are receiving this because you authored the thread.

sebdanielsson commented 2 years ago

When uppgrading you'll need to update the following config files: https://github.com/plausible/hosting/blob/master/clickhouse/clickhouse-config.xml https://github.com/plausible/hosting/blob/master/clickhouse/clickhouse-user-config.xml

And change the tags to .

Other than that I don't know that could cause the issues I'm having upgrading to the latest version.

openscript commented 2 years ago

With justsky/analytics I get a [warning] OTLP exporter failed to initialize with exception :throw:{:application_either_not_started_or_not_ready, :tls_certificate_check} when running it. Any ideas?

ruslandoga commented 2 years ago

@openscript 👋

That's a rather harmless warning and can be ignored. More info: https://github.com/open-telemetry/opentelemetry-erlang/issues/419

abishekrsrikaanth commented 1 year ago

@SebDanielsson Just started using on my Mac M1 and I have the same issue of Plausible restarting every few minutes. Is there a solution to get this working on a Mac M1?

ruslandoga commented 1 year ago

@abishekrsrikaanth 👋

Are the any errors in the logs? docker compose logs plausible?

You might want to try using one of arm64 container images.

abishekrsrikaanth commented 1 year ago

@ruslandoga can you please elaborate what you mean my using arm64 container images. I just followed the docs to download the repo and run docker compose up

And here are the logs

plausible_1  | Loading plausible..
plausible_1  | Starting dependencies..
plausible_1  | Starting repos..
plausible_1  | create Plausible.Repo database if it doesn't exist
plausible_1  | create Plausible.ClickhouseRepo database if it doesn't exist
plausible_1  | Creation of Db successful!
plausible_1  | qemu: uncaught target signal 11 (Segmentation fault) - core dumped
plausible_1  | Segmentation fault
plausible_1  | qemu: uncaught target signal 11 (Segmentation fault) - core dumped
plausible_1  | Segmentation fault
plausible_1  | Loading plausible..
plausible_1  | Starting dependencies..
plausible_1  | Starting repos..
plausible_1  | create Plausible.Repo database if it doesn't exist
plausible_1  | create Plausible.ClickhouseRepo database if it doesn't exist
plausible_1  | Creation of Db successful!
plausible_1  | qemu: uncaught target signal 11 (Segmentation fault) - core dumped
plausible_1  | Segmentation fault
plausible_1  | qemu: uncaught target signal 11 (Segmentation fault) - core dumped
plausible_1  | Segmentation fault
plausible_1  | qemu: uncaught target signal 11 (Segmentation fault) - core dumped
plausible_1  | Segmentation fault
ruslandoga commented 1 year ago

@abishekrsrikaanth ah, right :)

So until https://github.com/plausible/analytics/pull/2103 is merged and v1.5.0 is released, there aren't any official arm64 images for plausible/analytics. But some community members have built their own arm64 images, like OP here. You might be able to do the same.

You can also try using --platform linux/amd64 flag to make Docker run the current plausible container in emulator mode. More info: https://forums.docker.com/t/run-x86-intel-and-arm-based-images-on-apple-silicon-m1-macs/117123

abishekrsrikaanth commented 1 year ago

Thanks, let me look into this. Appreciate the help. Looking forward to the release

navanchauhan commented 1 year ago

You can definitely run it right now by applying the changes mentioned above. I am going to be moving from hosted Plausible to my self hosted version over the weekend

On Sat, Apr 23, 2022 at 2:18 AM Sebastian @.***> wrote:

I would love arm64/aarch64 support as well. Then I could host Plausible on my odroid-n2.

— Reply to this email directly, view it on GitHub https://github.com/plausible/hosting/issues/44#issuecomment-1107427813, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7BHQGJEJRBFZ6NC6XCKVDVGOW5RANCNFSM5UELSUAQ . You are receiving this because you authored the thread.Message ID: @.***>

ruslandoga commented 1 year ago

v1.5.1 is out and it has arm64 support :)