This guide provides general instructions for deploying your PropertyWebBuilder application to Domcloud. As of this writing, there is no specific documentation available from Domcloud for deploying Rails applications, so these instructions are based on a typical deployment process for a traditional hosting provider.
- A Domcloud account.
- SSH access to your Domcloud server.
- Your application code pushed to a Git repository.
- Connect to your Domcloud server via SSH.
- Install the necessary software:
- Ruby (using a version manager like rbenv or RVM is recommended).
- Bundler.
- Node.js and Yarn.
- PostgreSQL.
- Nginx or another web server.
- Clone your application's repository to a directory on your server (e.g.,
/home/user/your-app).git clone https://github.com/your-username/propertywebbuilder.git /home/user/your-app
- Navigate to your application directory and install the dependencies:
cd /home/user/your-app bundle install yarn install
- Create a PostgreSQL database and a user for your application.
- Create a
.envfile in your application's root directory to store your environment variables. Do not commit this file to git. - Add the
DATABASE_URLandRAILS_MASTER_KEYto your.envfile:DATABASE_URL="postgresql://user:password@localhost/your-db" RAILS_MASTER_KEY="your-master-key"
- Precompile your assets:
RAILS_ENV=production bundle exec rails assets:precompile - Run the database migrations:
RAILS_ENV=production bundle exec rails db:migrate
You will need to set up a web server (like Nginx) to act as a reverse proxy for your Rails application, which will be run by an application server (like Puma).
Here is an example Nginx configuration. You would typically place this in /etc/nginx/sites-available/your-app and create a symlink to it in /etc/nginx/sites-enabled/.
upstream your_app {
server unix:/home/user/your-app/tmp/sockets/puma.sock;
}
server {
listen 80;
server_name your-domain.com;
root /home/user/your-app/public;
location / {
proxy_pass http://your_app;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}You should configure Puma to run as a service using systemd. This will ensure your application starts on boot and is automatically restarted if it crashes.
- Create a systemd service file (e.g.,
/etc/systemd/system/your-app.service). - Add a configuration like the following, adjusting the paths and user as necessary:
[Unit]
Description=Puma HTTP Server
After=network.target
[Service]
User=user
WorkingDirectory=/home/user/your-app
ExecStart=/home/user/.rbenv/shims/bundle exec puma -C /home/user/your-app/config/puma.rb
Restart=always
[Install]
WantedBy=multi-user.target- Enable and start the service:
sudo systemctl enable your-app sudo systemctl start your-app