<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gregoire Renaldo on Medium]]></title>
        <description><![CDATA[Stories by Gregoire Renaldo on Medium]]></description>
        <link>https://medium.com/@gregoire.renaldo?source=rss-398df984a238------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8FL77D8MBswCHDTdyLVBTw.jpeg</url>
            <title>Stories by Gregoire Renaldo on Medium</title>
            <link>https://medium.com/@gregoire.renaldo?source=rss-398df984a238------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 20:58:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gregoire.renaldo/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to deploy a basic rails 8 app on OVH with Kamal]]></title>
            <link>https://medium.com/@gregoire.renaldo/how-to-deploy-a-basic-rails-8-app-on-ovh-with-kamal-a57b32e326a5?source=rss-398df984a238------2</link>
            <guid isPermaLink="false">https://medium.com/p/a57b32e326a5</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[kamal]]></category>
            <category><![CDATA[rails-8]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Gregoire Renaldo]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 14:57:03 GMT</pubDate>
            <atom:updated>2024-12-04T14:57:03.804Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial I will explain how to deploy a rails 8 app on OVH, using Docker and Kamal. This tutorial will be focused on rails 8 app with sqlite for a db and jobs.</p><p>What do you need ?</p><ul><li>A rails 8 new app to deploy. If you don’t have one, <a href="https://guides.rubyonrails.org/getting_started.html">here</a> is how to do one</li><li>A server on <a href="https://www.ovhcloud.com/">OVH</a>, its IP, an ssh connection set to this server</li><li>Your username on the server: on OVH, user depends on the OS of your server: ubuntu, debian, centos etc …</li><li>Your password : when you buy a server on OVH, you receive an email with a temporary password. Connect via ssh to your server you will be prompted to change it immediately. Keep it somewhere safe :-)</li></ul><pre>ssh my_username@my_server_ip_address<br># then you will be prompted for your password, enter you temporary password,<br># or the password you&#39;ve set instead of the temporary one :-)</pre><ul><li><a href="https://docs.docker.com/get-started/get-docker/">Docker installed on your machine</a></li><li>A registry for your docker images, here i use the default one : <a href="https://hub.docker.com/">Docker Hub</a>. Feel free to take whatever registry you want: ghcr.io, registry.digitalocean.com</li><li>Your ssh public key. If you don’t have an ssh public key, here is how can create an ssh key: <a href="https://medium.com/@gregoire.renaldo/how-to-create-an-ssh-key-on-linux-macos-or-window-55daa55258af">create an ssh key</a></li></ul><h3>1/ ssh key</h3><h4>Retrieve or get a ssh key</h4><p>List your ssh keys:</p><pre>ls -al ~/.ssh</pre><p>and depends on the format of your key (rsa or ed25519)</p><pre>cat ~/.ssh/id_rsa.pub </pre><p>or</p><pre>cat ~/.ssh/id_ed25519.pub<br></pre><h4>Set your ssh key on OVH</h4><p>On OVH, go to your dashboard, then my services, click on the tab ssh screen and add your ssh public key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mq_lzUWXd1BygrK7pZwadQ.png" /></figure><h4><a href="https://kamal-deploy.org/docs/installation/">KAMAL</a></h4><p>you already have everything you need if you created a rails 8 app. Otherwise, if you are on rails 7 and above:</p><pre>gem install kamal<br>kamal init</pre><p>set your deploy.yml:</p><pre># Name of your application. Used to uniquely configure containers.<br>service: my_service<br><br># Name of the container image.<br>image: my_image<br><br># Deploy to these servers.<br>servers:<br>  web:<br>    - my_ip # for ovh retrieve it on your dashboard<br>  # job:<br>  #   hosts:<br>  #     - 192.168.0.1<br>  #   cmd: bin/jobs<br><br># Enable SSL auto certification via Let&#39;s Encrypt and allow for multiple apps on a single web server.<br># Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.<br>#<br># Note: If using Cloudflare, set encryption mode in SSL/TLS setting to &quot;Full&quot; to enable CF-to-app encryption.<br># proxy:<br>#   ssl: true<br>#   host: app.example.com<br><br># Credentials for your image host.<br>registry:<br>  # Specify the registry server, if you&#39;re not using Docker Hub<br>  # server: registry.digitalocean.com / ghcr.io / ...<br>  username: <br>    - REGISTRY_USERNAME<br><br>  # Always use an access token rather than real password when possible.<br>  password:<br>    - KAMAL_REGISTRY_PASSWORD<br><br># Inject ENV variables into containers (secrets come from .kamal/secrets).<br>&lt;% require &quot;dotenv&quot;; Dotenv.load(&quot;.env&quot;) %&gt; # Load .env file for secrets<br>env:<br>  secret:<br>    - RAILS_MASTER_KEY<br>  clear:<br>    # Run the Solid Queue Supervisor inside the web server&#39;s Puma process to do jobs.<br>    # When you start using multiple servers, you should split out job processing to a dedicated machine.<br>    SOLID_QUEUE_IN_PUMA: true<br><br>    # Set number of processes dedicated to Solid Queue (default: 1)<br>    # JOB_CONCURRENCY: 3<br><br>    # Set number of cores available to the application on each server (default: 1).<br>    # WEB_CONCURRENCY: 2<br><br>    # Match this to any external database server to configure Active Record correctly<br>    # Use keep_it_simple-db for a db accessory server on same machine via local kamal docker network.<br>    # DB_HOST: 192.168.0.2<br><br>    # Log everything from Rails<br>    # RAILS_LOG_LEVEL: debug<br><br># Aliases are triggered with &quot;bin/kamal &lt;alias&gt;&quot;. You can overwrite arguments on invocation:<br># &quot;bin/kamal logs -r job&quot; will tail logs from the first server in the job section.<br>aliases:<br>  console: app exec --interactive --reuse &quot;bin/rails console&quot;<br>  shell: app exec --interactive --reuse &quot;bash&quot;<br>  logs: app logs -f<br>  dbc: app exec --interactive --reuse &quot;bin/rails dbconsole&quot;<br><br><br># Use a persistent storage volume for sqlite database files and local Active Storage files.<br># Recommended to change this to a mounted volume path that is backed up off server.<br>volumes:<br>  - &quot;keep_it_simple_storage:/rails/storage&quot;<br><br><br># Bridge fingerprinted assets, like JS and CSS, between versions to avoid<br># hitting 404 on in-flight requests. Combines all files from new and old<br># version inside the asset_path.<br>asset_path: /rails/public/assets<br><br># Configure the image builder.<br>builder:<br>  arch: amd64<br><br>  # # Build image via remote server (useful for faster amd64 builds on arm64 computers)<br>  # remote: ssh://docker@docker-builder-server<br>  #<br>  # # Pass arguments and secrets to the Docker build process<br>  # args:<br>  #   RUBY_VERSION: 3.3.5<br>  # secrets:<br>  #   - GITHUB_TOKEN<br>  #   - RAILS_MASTER_KEY<br><br># Use a different ssh user than root<br>ssh:<br>  # on ovh, user depends on the os of your server: ubuntu, debian, centos etc ...<br>  user: ubuntu<br><br># Use accessory services (secrets come from .kamal/secrets).<br># accessories:<br>#   db:<br>#     image: mysql:8.0<br>#     host: 192.168.0.2<br>#     # Change to 3306 to expose port to the world instead of just local network.<br>#     port: &quot;127.0.0.1:3306:3306&quot;<br>#     env:<br>#       clear:<br>#         MYSQL_ROOT_HOST: &#39;%&#39;<br>#       secret:<br>#         - MYSQL_ROOT_PASSWORD<br>#     files:<br>#       - config/mysql/production.cnf:/etc/mysql/my.cnf<br>#       - db/production.sql:/docker-entrypoint-initdb.d/setup.sql<br>#     directories:<br>#       - data:/var/lib/mysql<br>#   redis:<br>#     image: redis:7.0<br>#     host: 192.168.0.2<br>#     port: 6379<br>#     directories:<br>#       - data:/data</pre><p>kamal uses secrets file in kamal folder, you can set it like this:</p><pre># Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,<br># and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either<br># password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.<br><br># Example of extracting secrets from 1password (or another compatible pw manager)<br># SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)<br># KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})<br># RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})<br><br># Use a GITHUB_TOKEN if private repositories are needed for the image<br># GITHUB_TOKEN=$(gh config get -h github.com oauth_token)<br><br># Grab the registry password from ENV<br>KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD<br><br># Improve security by using a password manager. Never check config/master.key into git!<br>RAILS_MASTER_KEY=$(cat config/master.key)<br>REGISTRY_USERNAME=$REGISTRY_USERNAME</pre><p>create a .env file, at the root of your project:</p><pre>KAMAL_REGISTRY_PASSWORD=dckr_*************************<br>RAILS_MASTER_KEY=*********************************<br>REGISTRY_USERNAME=*****************************</pre><p>in the deploy.yml, you can add:</p><pre>&lt;% require &quot;dotenv&quot;; Dotenv.load(&quot;.env&quot;) %&gt;</pre><p>.. to load your ENV variables.</p><p>user will be the OS of your server:</p><ul><li>if you chose ubuntu, it will be user: ubuntu</li><li>if you chose debian: user:debian</li><li>… and so on</li></ul><p>When you are all set, start docker on your local machine (necessary to create your image), then run:</p><pre>kamal setup</pre><p>and that’s all !</p><p>Go to your ip, your site should be on.</p><h3>Troubleshooting</h3><p>You may encounter this error: <br>“permission denied while trying to connect to the Docker daemon socket at unix”.<br>You need to authorise your user to use Docker on your server. It’s a good practise that users in the docker group can interact with Docker, preventing unauthorized users from managing containers and services.</p><p>Connect to the server via ssh:</p><pre>ssh ubuntu/debian/centos@ip_of_my_server <br># example ubuntu@255.255.255.255</pre><p>This will open a terminal on your server.<br>then :</p><pre>sudo usermod -aG docker $USER</pre><p>close your terminal.</p><p>Retry kamal setup on your local machine.</p><p>Enjoy ! Navigate to the IP address of your server, it should be working.</p><h3>What’s next ?</h3><p>Now you need to add some security to your server, use Traeffic for SSL and HTTPS, get a domain name.</p><p>Here are some useful commands from Kamal’s doc:</p><pre>$ kamal proxy<br>Commands:<br>  kamal proxy boot            # Boot proxy on servers<br>  kamal proxy boot_config &lt;set|get|reset&gt;  # Manage kamal-proxy boot configuration<br>  kamal proxy details         # Show details about proxy container from servers<br>  kamal proxy help [COMMAND]  # Describe subcommands or one specific subcommand<br>  kamal proxy logs            # Show log lines from proxy on servers<br>  kamal proxy reboot          # Reboot proxy on servers (stop container, remove container, start new container)<br>  kamal proxy remove          # Remove proxy container and image from servers<br>  kamal proxy restart         # Restart existing proxy container on servers<br>  kamal proxy start           # Start existing proxy container on servers<br>  kamal proxy stop            # Stop existing proxy container on servers</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a57b32e326a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create an ssh key on linux macOs or Window]]></title>
            <link>https://medium.com/@gregoire.renaldo/how-to-create-an-ssh-key-on-linux-macos-or-window-55daa55258af?source=rss-398df984a238------2</link>
            <guid isPermaLink="false">https://medium.com/p/55daa55258af</guid>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[terminal]]></category>
            <dc:creator><![CDATA[Gregoire Renaldo]]></dc:creator>
            <pubDate>Wed, 04 Dec 2024 14:07:55 GMT</pubDate>
            <atom:updated>2024-12-04T14:07:55.622Z</atom:updated>
            <content:encoded><![CDATA[<p>Creating an SSH key involves generating a public-private key pair that you can use to securely authenticate to servers. Here’s how to create one:</p><h3>Steps to Create an SSH Key</h3><h4>1. Open a Terminal</h4><ul><li>On <strong>Linux/macOS</strong>: Open the terminal.</li><li>On <strong>Windows</strong>: Use PowerShell, Command Prompt, or the <a href="https://learn.microsoft.com/en-us/windows/wsl/">Windows Subsystem for Linux (WSL)</a>.</li></ul><h4>2. Run the SSH Key Generation Command</h4><p>Type the following command, for an rsa key:</p><pre>ssh-keygen -t rsa -b 4096 -C &quot;your_email@example.com&quot;</pre><ul><li>-t rsa: Specifies the type of key to create (RSA is a widely used algorithm).</li><li>-b 4096: Sets the key length to 4096 bits for added security.</li><li>-C &quot;your_email@example.com&quot;: Adds a label (usually your email) to identify your key.</li></ul><h4>3. Specify a File Location</h4><p>You’ll be prompted to choose a file location. Press Enter to save the key in the default location:</p><pre>~/.ssh/id_rsa</pre><p>If you want to save it to a different file, type the path and press Enter.</p><h4>4. Set a Passphrase (Optional)</h4><p>You’ll be asked to set a passphrase for added security. This is optional but recommended:</p><ul><li>If you set a passphrase, you’ll need to enter it every time you use the key unless you use an SSH agent.</li><li>If you don’t want a passphrase, press Enter.</li></ul><h4>5. Key Pair Generated</h4><p>The command will generate two files:</p><ul><li><strong>Private key</strong>: id_rsa (keep this secure and do not share it).</li><li><strong>Public key</strong>: id_rsa.pub (share this with servers or services).</li></ul><h3>6. Add the Public Key to a Server</h3><p>Copy the contents of the public key (id_rsa.pub) to the ~/.ssh/authorized_keys file on the server you want to access.</p><p>To copy it manually:</p><pre>cat ~/.ssh/id_rsa.pub</pre><p>Copy the output and paste it into the server’s authorized_keys.</p><p>Alternatively, you can use the ssh-copy-id command to copy the key to the server:</p><pre>ssh-copy-id user@your_server_ip</pre><h3>7. Test Your SSH Key</h3><p>Test the connection to the server:</p><pre>ssh user@your_server_ip</pre><p>If set up correctly, you should connect without needing to enter a password.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=55daa55258af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Implement redis in a Ruby On Rails 7 app]]></title>
            <link>https://medium.com/@gregoire.renaldo/implement-redis-in-a-ruby-on-rails-7-app-eab02fe59057?source=rss-398df984a238------2</link>
            <guid isPermaLink="false">https://medium.com/p/eab02fe59057</guid>
            <category><![CDATA[redis]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Gregoire Renaldo]]></dc:creator>
            <pubDate>Sun, 12 Feb 2023 13:25:14 GMT</pubDate>
            <atom:updated>2023-02-12T13:33:56.025Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kweAChrF5o0hO83KK2fQHQ.png" /></figure><p>Here is a quick tutorial to implement Redis in a Ruby On Rails 7 app. Let’s code !</p><ol><li>Installation: First, you need to install Redis on your system. You can download Redis from its official website and follow the instructions to install it on your system.</li><li>Gemfile: To use Redis in your Rails app, you need to add the “redis” gem to your Gemfile. You can add the following line to your Gemfile:</li></ol><pre>gem &#39;redis&#39;</pre><p>3. Bundle Install: After adding the gem to your Gemfile, run the following command to install it:</p><pre>bundle install</pre><p>4. Configure Redis: Next, you need to configure Redis in your Rails app. You can add the following code to your config/application.rb file</p><pre># config/application.rb<br>config.cache_store = :redis_store, &#39;redis://localhost:6379/0/cache&#39;, { expires_in: 90.minutes }</pre><p>5. Connection: To connect to Redis, you can create an initializer in the config/initializers folder. Let’s name it redis.rb. Here is the code to connect to Redis:lessCopy code</p><pre>$redis = Redis.new(host: &#39;localhost&#39;, port: 6379)</pre><p>6. Caching: Now that you have connected to Redis, you can start using it to cache data in your Rails app. You can use the Rails cache API to store data in Redis. For example, the following code stores a value in the cache:</p><pre>Rails.cache.write(&#39;key&#39;, &#39;value&#39;)</pre><p>And the following code retrieves the value from the cache:</p><pre>Rails.cache.read(&#39;key&#39;)</pre><p>7. Start Redis Server: Finally, start the Redis server on your system by running the following command in your terminal</p><pre>redis-server</pre><p>With these steps, you should be able to implement Redis in your Rails 7 app. Redis can help you speed up your app by caching data and reducing the number of database queries.</p><p>Enjoy using Redis !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eab02fe59057" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>