10 months ago
Error 4: Undefined variable liqfolder Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/62d7cf46-6d8c-4a85-8c7c-d7656ffed892/vol_40vkxj864q32cq6f Mounting volume on: /var/lib/containers/railwayapp/bind-mounts/62d7cf46-6d8c-4a85-8c7c-d7656ffed892/vol_40vkxj864q32cq6f Starting with UID/GID: 1000/1000 At line 2, char 1-10:
Hello, I have a docker compose that I am able to run in local development server. All the services work together great locally. However, in production Liquidsop service throws errors that I assume are related to Railway folder structure. I'm attaching my docker-compose to provide more context.
7 Replies
10 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 10 months ago
10 months ago
Railway doesn't have docker-compose support, you'd need to separate each item in the docker-compose file into its own service
For example, let's say you have a docker-compose file like this:
version: '3.8'
services:
mongodb:
image: mongo:latest
container_name: mongodb
environment:
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=secretpassword
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
networks:
- app_network
app:
build:
context: .
dockerfile: Dockerfile
container_name: myapp
environment:
- MONGODB_URI=mongodb://admin:secretpassword@mongodb:27017/mydb
ports:
- "3000:3000"
depends_on:
- mongodb
networks:
- app_network
volumes:
mongodb_data:
networks:
app_network:
driver: bridgeIn this case you'll notice we have a mongodb service and an app service. The way you'd get this to work on Railway would be something like this:
Create a project ( akin to
networks: app_network: driver: bridge)Right Click -> Database -> MongoDB ( akin to
services: mongodb: ...and adds the volume and environment variables automatically )Right Click -> GitHub/Docker -> Your Application's Source ( akin to
services: app: ...)Add the environment variables to your application, in this case
PORT=3000andMONGODB_URI, you can do this using shared variables and private networking
And then you'd have translated that docker-compose over to a Railway project
10 months ago
Thanks for the guidance. I've deployed services separately and added a custom start command. while all three services seem to be up and running, the public-url provided by Railway does not work for me with message: "502 Bad Gateway Application failed to respond, this error appears to be caused by the application". I attached 8000 as port number for my service to run on
10 months ago
The target port has been always there, the problem was me not adding an endpoint to get to the server admin page. Now to run these services together, I need to run a pre-deployment and a start command like "docker network create app_network
"
Deployment is failing because of that, I wonder if I have to install a docker executable during image build or is there any thoughts around that?
10 months ago
You don't need to create any docker networks, all the services under a project is already connected under a private network. See: https://docs.railway.com/guides/private-networking
10 months ago
When I go this route, I get connection refused message in the service logs, the error I never get when I've set up docker network locally
10 months ago
Make sure you're using http when using the private network, and also you have to specify the port your service is running on, meaning if your app's name is "example" and its running on port 3000 then you'd connect to it via http://example.railway.internal:3000, also make sure the service is listening for IPv6 connections, most web-frameworks I know of does dualbind to both IPv6 and IPv4 but some don't, so make sure yours do
Status changed to Solved dev • 10 months ago