50 Experience
0 Lessons Completed
0 Questions Solved


Posted in Deploy RoR app from Azure DevOps to Linux Server

Hi all.
Have some problem.
I'm newest in Azure DevOps (AD).

I created AD git repository for RoR project.
Created pipeline for master branch:

- master

  vmImage: 'ubuntu-18.04'

- task: UseRubyVersion@0
    versionSpec: '= 2.5.5'
    addToPath: true

- script: |
    sudo apt install freetds-dev
    sudo apt install libpq-dev
    sudo apt install sqlite3 libsqlite3-dev
    sudo apt install postgresql postgresql-contrib
  displayName: 'lib for tiny_tds, postgres'

- script: |
    sudo -i -u postgres psql -c "CREATE USER user WITH PASSWORD 'pppppp';"
    sudo -i -u postgres psql -c "ALTER USER user WITH SUPERUSER;"
    sudo -i -u postgres psql -c "CREATE DATABASE db WITH OWNER = user;"
    sudo -i -u postgres psql -c "CREATE DATABASE db_test WITH OWNER = user;"
  displayName: 'create pg user & db'

- script: |
    echo "gem: --no-document" > ~/.gemrc
    gem install bundler
    bundle install --retry=3 --jobs=4
  displayName: 'bundle install'

- script: rails db:migrate RAILS_ENV=test
  displayName: 'db migrate ENV=test'

- script: bundle exec rake
  displayName: 'bundle exec rake'

- task: PublishTestResults@2
    testResultsFormat: 'JUnit'
    testResultsFiles: '**/TEST-*.xml'
    failTaskOnFailedTests: true

- task: CopyFiles@2
    SourceFolder: '$(agent.builddirectory)'
    Contents: '**'
    TargetFolder: '$(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

Successfully passed the tests in pipeline above.

How now use releases & environments for deploy project to linux server? How use pipeline above and created artifact?
I don't want use Azure Subscription. Maybe Kubernetes...
The main question is where I can compile ruby project and how deploy it on server? How automate this process?
Who can help with advice, tutorial, documentations?

Thanks all!

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.