#Matomo on Railway

45 messages · Page 1 of 1 (latest)

tender arrow
#

Anyone know a good way I can setup Matomo on Railway?

I know how to do it on a normal VPS or local, but since I cant interact with console I am unsure how to do this. Any help is appreciated!

ocean ospreyBOT
#

Project ID: N/A

tender arrow
#

N/A

harsh pollen
#

do they provide a docker image?

tender arrow
#

yes

#

I actually was looking into the run local feature in railway

#

I assume I copy the github on my computer and set it up there?

harsh pollen
#

run local feature?

tender arrow
#

What I mean is I see that I can run a project locally, which I believe can be used to set up the software. Am I on to something here?

harsh pollen
#

yes you can but I'd just run the docker image on Railway

#

I'll see what I can do later tonight

tender arrow
#
 

[Region: us-west1]

==============

Using Nixpacks

==============


context: 7ce89026dc8f940e1f11c4c4ec0fa330

Nixpacks build failed

 

 

Nixpacks was unable to generate a build plan for this app.

Please check the documentation for supported languages: https://nixpacks.com

 

The contents of the app directory are:

 

docker-entrypoint.sh

generate-stackbrew-library.sh

fpm/

license.md

php.ini

README.md

Dockerfile-alpine.template

fpm-alpine/

.github/

update.sh

apache/

Dockerfile-debian.template

.examples/

#

ALl I did was add create a space with MYSQL and this git, added the required env variables, and thats it

harsh pollen
tender arrow
#

So how else? Sorry as u can see I am new to Railway

harsh pollen
#

I'll see what I can do

#

(I'll try to make the template)

tender arrow
#

Oh I really appreciate it, doing some of my own research now as well

harsh pollen
#

I'll be honest, it would be quite the task for someone new to railway to undertake

tender arrow
#

Appreciate the warning, gonna try for 10 min and see what happens

tender arrow
#

Yeah I got it to build but now just stuck on deployment error

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.2.210. Set the 'ServerName' directive globally to suppress this message

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.2.210. Set the 'ServerName' directive globally to suppress this message

[Thu Oct 05 20:43:11.436995 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.57 (Debian) PHP/8.1.24 configured -- resuming normal operations

[Thu Oct 05 20:43:11.437057 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
harsh pollen
#

are you using a docker image?

tender arrow
#

In case it helps you here is my docker file

FROM php:8.1-apache

ENV PHP_MEMORY_LIMIT=256M
ENV MATOMO_VERSION 4.15.1

RUN set -ex; \
    \
    savedAptMark="$(apt-mark showmanual)"; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        libfreetype-dev \
        libjpeg-dev \
        libldap2-dev \
        libpng-dev \
        libzip-dev \
        procps \
    ; \
    \
    debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
    docker-php-ext-configure gd --with-freetype --with-jpeg; \
    docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
    docker-php-ext-install -j "$(nproc)" \
        gd \
        bcmath \
        ldap \
        mysqli \
        opcache \
        pdo_mysql \
        zip \
    ; \
    \
# pecl will claim success even if one install fails, so we need to perform each install separately
    pecl install APCu-5.1.21; \
    pecl install redis-5.3.6; \
    \
    docker-php-ext-enable \
        apcu \
        redis \
    ; \
    rm -r /tmp/pear; \
    \
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
    apt-mark auto '.*' > /dev/null; \
    apt-mark manual $savedAptMark; \
    ldd "$(php -r 'echo ini_get("extension_dir");')"/*.so \
        | awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
        | sort -u \
        | xargs -r dpkg-query --search \
        | cut -d: -f1 \
        | sort -u \
        | xargs -rt apt-mark manual; \
    \
    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
    rm -rf /var/lib/apt/lists/*

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
        echo 'opcache.memory_consumption=128'; \
        echo 'opcache.interned_strings_buffer=8'; \
        echo 'opcache.max_accelerated_files=4000'; \
        echo 'opcache.revalidate_freq=2'; \
        echo 'opcache.fast_shutdown=1'; \
    } > /usr/local/etc/php/conf.d/opcache-recommended.ini

RUN set -ex; \
    fetchDeps=" \
        dirmngr \
        gnupg \
    "; \
    apt-get update; \
    apt-get install -y --no-install-recommends \
        $fetchDeps \
    ; \
    \
    curl -fsSL -o matomo.tar.gz \
        "https://builds.matomo.org/matomo-${MATOMO_VERSION}.tar.gz"; \
    curl -fsSL -o matomo.tar.gz.asc \
        "https://builds.matomo.org/matomo-${MATOMO_VERSION}.tar.gz.asc"; \
    export GNUPGHOME="$(mktemp -d)"; \
    gpg --batch --keyserver keyserver.ubuntu.com --recv-keys F529A27008477483777FC23D63BB30D0E5D2C749; \
    gpg --batch --verify matomo.tar.gz.asc matomo.tar.gz; \
    gpgconf --kill all; \
    rm -rf "$GNUPGHOME" matomo.tar.gz.asc; \
    tar -xzf matomo.tar.gz -C /usr/src/; \
    rm matomo.tar.gz; \
    apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps; \
    rm -rf /var/lib/apt/lists/*

COPY php.ini /usr/local/etc/php/conf.d/php-matomo.ini

COPY docker-entrypoint.sh /entrypoint.sh

# WORKDIR is /var/www/html (inherited via "FROM php")
# "/entrypoint.sh" will populate it at container startup from /usr/src/matomo
# VOLUME /var/www/html

ENTRYPOINT ["/entrypoint.sh"]
CMD ["apache2-foreground"]

tender arrow
harsh pollen
#

a dockerfile and a docker image are two different things btw

#

matomo does provide a docker image, and it is highly preferable to use a docker image over a github repo with a dockerfile in it

tender arrow
#

Hmm I see. I should learn more about docker tbh...

harsh pollen
#

it would be beneficial

tender arrow
#

Yeah...

#

Wow I hate myself

#

U were right, SO much easier

#

Weirdly enough, it is still roughly same error

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.2.142. Set the 'ServerName' directive globally to suppress this message

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.2.142. Set the 'ServerName' directive globally to suppress this message

[Thu Oct 05 21:16:19.232320 2023] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.57 (Debian) PHP/8.1.24 configured -- resuming normal operations

[Thu Oct 05 21:16:19.232392 2023] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
harsh pollen
#

yeah I'll have to look Into it later

tender arrow
#

Ok appreciate your time and help 🙂

tender arrow
#

Side note:

I got the error to leave by adding start command "sh -c "echo 'ServerName s.xxxx.com' >> /etc/apache2/apache2.conf && apache2-foreground""

But service is still unreachable on my custom domain, I am guessing its a port issue

tender arrow
#

Got it working more

sh -c "echo 'ServerName s.xxx.com' >> /etc/apache2/apache2.conf && apache2-foreground && echo 'Listen $PORT' >> /etc/apache2/ports.conf"

now I get

You don't have permission to access this resource.``` on website, looking how I can fix this on railway
harsh pollen
round goblet
#

@tender arrow ^

tender arrow
#

This worked perfectly thanks!

#

Gonna test it more, your a legend!

harsh pollen
#

yeah let me know if you run into issues, otherwise i will go ahead and publish this template to the templates marketplace

harsh pollen
#

oh and I'm like to note that the template will still log stuff about the server name, but that's just a warning and there's nothing wrong with the server name it decides to use automatically

#

another note, communication to the mariadb is done exclusively over the private network and mariadb is not exposed externally in any way by default, if you wanted to enable access outside of the private network you can go to the databases settings to enable tcp proxying and enter the internal port mariadb listens on (3306) and use the username, password, host, and port to connect to the database externally, then once you no longer need external access you can remove the tcp proxy and all external access to the database will be severed without ever effecting the internal connection

#

I'd add these as notes to the template overview once I publish, but just thought I'd jot them down for you here