Croissant
Croissant
Explore posts from servers
RRailway
Created by Croissant on 10/16/2024 in #✋|help
Cannot change Postgres TImezone
Is it possible to change the database timezone?
7 replies
RRailway
Created by Croissant on 10/16/2024 in #✋|help
Cannot change Postgres TImezone
We are building an internal software and doesn't need to store it in UTC format
7 replies
RRailway
Created by Croissant on 10/16/2024 in #✋|help
Cannot change Postgres TImezone
b01880bc-a5fa-4f41-b977-800d4b3367ef
7 replies
RRailway
Created by Croissant on 8/22/2024 in #✋|help
How to combine project together?
thanks!
10 replies
RRailway
Created by Croissant on 8/22/2024 in #✋|help
How to combine project together?
ohh okiee
10 replies
RRailway
Created by Croissant on 8/22/2024 in #✋|help
How to combine project together?
omo, will there be any side effect for separating two service?
10 replies
RRailway
Created by Croissant on 8/22/2024 in #✋|help
How to combine project together?
fae4afa5-cd04-4cad-af2a-2c49e9f2d489
10 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
I got my application up and running, how do I install New Relic?
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
Ahh okay
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
No worries, it will helps in my future project, I already started writing DockerFile :D
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
Copied, here's my Nginx config file:
events {
worker_connections 4096; # Default: 1024
}

http {
server {
listen 80;
listen [::]:80;
server_name localhost;

root /var/www/html/src;

location ~ /\.ht {
deny all;
}

client_max_body_size 10M;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

index index.php;

charset utf-8;

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

location / {
try_files $uri $uri.html $uri/ @extensionless-php;
index index.html index.php;
}

location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}

location /sso/organization/ {
rewrite ^/sso/organization/(.+)$ /sso/organization/update.php?id=$1 last;
}

location /sso/event/ {
rewrite ^/sso/event/(.+)$ /sso/event/update.php?id=$1 last;
}

location /portal/organization/ {
rewrite ^/portal/organization/(.+)$ /portal/organization/?id=$1 last;
}

location /portal/event/ {
rewrite ^/portal/event/(.+)$ /portal/event/update.php?id=$1 last;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}

error_page 404 /notfound.php;
}
}
events {
worker_connections 4096; # Default: 1024
}

http {
server {
listen 80;
listen [::]:80;
server_name localhost;

root /var/www/html/src;

location ~ /\.ht {
deny all;
}

client_max_body_size 10M;

add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";

index index.php;

charset utf-8;

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

location / {
try_files $uri $uri.html $uri/ @extensionless-php;
index index.html index.php;
}

location @extensionless-php {
rewrite ^(.*)$ $1.php last;
}

location /sso/organization/ {
rewrite ^/sso/organization/(.+)$ /sso/organization/update.php?id=$1 last;
}

location /sso/event/ {
rewrite ^/sso/event/(.+)$ /sso/event/update.php?id=$1 last;
}

location /portal/organization/ {
rewrite ^/portal/organization/(.+)$ /portal/organization/?id=$1 last;
}

location /portal/event/ {
rewrite ^/portal/event/(.+)$ /portal/event/update.php?id=$1 last;
}

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}

location ~ /\.(?!well-known).* {
deny all;
}

error_page 404 /notfound.php;
}
}
Now I have to add PORT variable into my deployment and in the docs mentioned its not recommended to do so. But whenever I try using variable like ${PORT} it doesnt work. How do I fix it?
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
yay niceee
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
@Brody really need your help 😭 Now the issue is it's serving the nginx example page rather than my actual website, but whenever I try running the docker in my PC it's working perfectly. What could be the issue?
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
Um a little bit more help, here's my dockerfile
# Stage 1: Build the application with Node.js and Composer
FROM node:18 AS build-stage

# Set the working directory
WORKDIR /app

# Install PHP and PostgreSQL extension
RUN apt-get update && \
apt-get install -y php php-pgsql

# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./

# Install pnpm
RUN npm install -g pnpm

# Install Node.js dependencies using pnpm
RUN pnpm install

# Copy Composer files
COPY composer.json composer.lock ./

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install PHP dependencies
RUN composer install

# Copy the application code to the container
COPY src/ /app/src

# Stage 2: Set up the PHP and Nginx environment
FROM php:8.1-fpm

# Install Nginx
RUN apt-get update && apt-get install -y nginx

# Install PostgreSQL extension for PHP
RUN apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql pgsql

# Copy Nginx configuration file
COPY nginx/default.conf /etc/nginx/conf.d/default.conf

# Copy the PHP application from the build stage
COPY --from=build-stage /app /var/www/html

# Set the working directory
WORKDIR /var/www/html

# Expose port 80
EXPOSE 80

# Start Nginx and PHP-FPM
CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]
# Stage 1: Build the application with Node.js and Composer
FROM node:18 AS build-stage

# Set the working directory
WORKDIR /app

# Install PHP and PostgreSQL extension
RUN apt-get update && \
apt-get install -y php php-pgsql

# Copy package.json and pnpm-lock.yaml
COPY package.json pnpm-lock.yaml ./

# Install pnpm
RUN npm install -g pnpm

# Install Node.js dependencies using pnpm
RUN pnpm install

# Copy Composer files
COPY composer.json composer.lock ./

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install PHP dependencies
RUN composer install

# Copy the application code to the container
COPY src/ /app/src

# Stage 2: Set up the PHP and Nginx environment
FROM php:8.1-fpm

# Install Nginx
RUN apt-get update && apt-get install -y nginx

# Install PostgreSQL extension for PHP
RUN apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql pgsql

# Copy Nginx configuration file
COPY nginx/default.conf /etc/nginx/conf.d/default.conf

# Copy the PHP application from the build stage
COPY --from=build-stage /app /var/www/html

# Set the working directory
WORKDIR /var/www/html

# Expose port 80
EXPOSE 80

# Start Nginx and PHP-FPM
CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]
Now it works on my PC when I use docker run --env-file .env -p 8080:80 my-php-nginx-app, but it doesn't work when I run on railway
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
Thanks for the encouragement, Imma spend my night playing with docker
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
Alright Ill check it out
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
Because I kinda developed my application using the nixpacks way, so if I have to write Dockerfile myself then I'll have to figure a lot of things
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
ahh, so if I have Dockerfile it will not run nixpacks anymore right?
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
umm sorry, but what's the difference between nixpacks and Dockerfile?
31 replies
RRailway
Created by Croissant on 5/25/2024 in #✋|help
How to Install New Relic on my php application?
Can I still use nixpacks?
31 replies