stufro / chordly

A free, open-source, online chord sheet creator
https://chordly.co.uk
GNU General Public License v3.0
28 stars 1 forks source link

Documentation for building, configuring and deploying/running #22

Open dassystem opened 4 months ago

dassystem commented 4 months ago

Hi I really like the application but I cannot get it running by myself.

Could you please provide documentation about how to correctly build, configure and deploy chordly?

I was able to build a docker image from the Dockerfile (with docker build) and run it (with docker run) but I don't find the ports and where to configure them? How do I start up the application? What do I need to setup first? How to access the web frontend?

In the next step I want to deploy it on a Raspberry Pi with linux/arm64 so I might need to setup multiarch docker building – but that's too far away at the moment and I would really appreciate help.

stufro commented 4 months ago

The Dockerfile was generated by fly.io (my hosting provider) therefore I haven't ever built and run the image myself, I'd be happy to try to help you get it up and running though. You've actually got further than me as I can't even build the image on my M1 Mac currently - ha! 😄

Server Port

Looking at the config, when the Rails server starts, it uses the PORT env variable to decide which port to advertise the server on (config/puma.rb:18). In the Dockerfile, this env variable is set to 8080 (Dockerfile:132). I suppose when executing docker run you could set the port forwarding to expose that port on your host machine. (https://docs.docker.com/network/#published-ports)

How do I start the application?

I think docker run should start the server because in Dockerfile:135 it sets the CMD to be "bin/rails fly:server" which in turns calls sh 'bin/rails server' in lib/tasks/fly.rake

Other setup required

The only other thing I can think of is the database, in config/database.yml it's configured to use PostgreSQL and when running in production environment (which is where env variable RAILS_ENV=production) which in turns uses DATABASE_URL env variable.

If you have a PostgeSQL server running you could simply point DATABASE_URL to your server. A simpler approach might be to change the default adapter to sqlite3 on line 18 and set the DATABASE_URL to be a file path to save the SQLite database.


I hope that helps somewhat, let me know how you get on and if you have any further questions.

dassystem commented 4 months ago

Thanks for your quick reply but I need more time to figure things out (I'm not an expert in ruby or even docker).

I was able to build, but not with sqlite! And with PostgreSQL I got an error running the container

sh: 1: cannot create /proc/sys/vm/swappiness: Read-only file system
rails aborted!

Seems like I have to investigate this stuff first. Then I'll have a look into the database topic.

stufro commented 3 months ago

I was just reading my hosting providers docs again and found a much easier way to build and run this locally using docker. I tried added a docker compose file and building locally but still hitting some issues. I'll keep trying and let you know if I get it working.