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:
trigger:
- master
pool:
vmImage: 'ubuntu-18.04'
steps:
- task: UseRubyVersion@0
inputs:
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
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/TEST-*.xml'
failTaskOnFailedTests: true
- task: CopyFiles@2
inputs:
SourceFolder: '$(agent.builddirectory)'
Contents: '**'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
Successfully passed the tests in pipeline above.
And...
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!
I used your above script to install postgres in AZ Devops Pipeline..
it is failing in
- 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'
With Below error
psql: error: could not connect to server: No such file or directory
Can i also know what host config you gave in your database.yml file.
Thanks in advance.