Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 15a5017c86 | |||
| dd5caa4056 | |||
| 360ddbe6d2 | |||
| b3b886f0b3 | |||
| 93aa007c14 | |||
| 4e32f4a60d | |||
| 2759880a53 | |||
| 7bc1a852db | |||
| 00119f9723 | |||
| ff2a0e867d | |||
| 1fae85ff9d | |||
| 10fe82ab6a | |||
| 9812a92d59 | |||
| e8b12c307a | |||
| ae00ac8672 | |||
| bf92201721 | |||
| 1f2e3d41dd | |||
| f31b6da49c | |||
| f32d153b69 | |||
| 15d9ade2cf | |||
| 4587c35806 | |||
| 340614dadc | |||
| 8a0fef63b2 | |||
| 8691d19e8d | |||
| 35d196bdc2 | |||
| e2c3cb7035 | |||
| a69b3e4226 | |||
| 36285b060b | |||
| a0a9e84b91 | |||
| 01d9f9a21c | |||
| 621a777a46 | |||
| 6fbecd78a4 | |||
| 873b86a809 | |||
| 47393a5ead | |||
| 69c56ae31a | |||
| b2cdf60a32 | |||
| 91f45965a0 | |||
| 3097cb69aa | |||
| eed17d61a3 | |||
| 9e5a4069a4 | |||
| f8c20541d5 | |||
| ee07312b86 | |||
| e4eabf8aa6 | |||
| 3ec0f0ff7b | |||
| 27b32fc8f4 | |||
| ceab408ec0 | |||
| b56b618a8c |
@@ -3,3 +3,5 @@
|
||||
*.db
|
||||
.env.rb
|
||||
coverage
|
||||
vendor
|
||||
.ruby-version
|
||||
|
||||
Vendored
+35
-10
@@ -1,20 +1,17 @@
|
||||
pipeline {
|
||||
agent any
|
||||
agent { label 'ruby && freebsd' }
|
||||
|
||||
environment {
|
||||
APP_SESSION_SECRET = ''
|
||||
DB_NAME = 'url_shortener.db'
|
||||
}
|
||||
stages {
|
||||
stage('Init') {
|
||||
steps {
|
||||
sh 'rbenv local 3.2.2'
|
||||
script {
|
||||
env.APP_SESSION_SECRET = sh(script: 'ruby secret.rb', returnStdout: true)
|
||||
}
|
||||
sh 'echo "ENV[\\\"APP_SESSION_SECRET\\\"] ||= $(ruby secret.rb)" > .env.rb'
|
||||
sh 'echo "ENV[\\\"DB_NAME\\\"] ||= \\\"${DB_NAME}\\\"" >> .env.rb'
|
||||
sh 'cat .env.rb'
|
||||
sh ''' #!/usr/local/bin/bash
|
||||
rbenv local 3.2.2
|
||||
echo "ENV[\\\"APP_SESSION_SECRET\\\"] ||= $(ruby -rsecurerandom -e 'puts SecureRandom.base64(64).inspect()')" > .env.rb
|
||||
echo "ENV[\\\"DB_NAME\\\"] ||= \\\"${DB_NAME}\\\"" >> .env.rb
|
||||
'''
|
||||
}
|
||||
}
|
||||
stage('Build dependencies') {
|
||||
@@ -35,7 +32,6 @@ pipeline {
|
||||
}
|
||||
stage('Report results') {
|
||||
steps {
|
||||
archive(includes: 'pkg/*.gem')
|
||||
publishHTML (target: [
|
||||
allowMissing: false,
|
||||
alwaysLinkToLastBuild: false,
|
||||
@@ -46,6 +42,32 @@ pipeline {
|
||||
reportTitles: 'Cucumber Results, RSpec Results, Test Coverage'])
|
||||
}
|
||||
}
|
||||
stage('Build production deliverable') {
|
||||
steps {
|
||||
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
|
||||
sh ''' #!/usr/local/bin/bash
|
||||
ZIP_FILE="url-shortener_${BRANCH_NAME}_$(date "+%Y-%m-%d_%H-%M-%S").tgz"
|
||||
CUR_DIR=$(pwd)
|
||||
mkdir -p /tmp/url-shortener
|
||||
cp -R * /tmp/url-shortener
|
||||
cp .env.rb /tmp/url-shortener/
|
||||
cp .ruby-version /tmp/url-shortener/
|
||||
cd /tmp/url-shortener
|
||||
rm -rf features spec coverage db/*.db .git* Jenkinsfile *.html
|
||||
cd /tmp
|
||||
tar -czvf $ZIP_FILE url-shortener/
|
||||
mv /tmp/$ZIP_FILE $CUR_DIR/
|
||||
'''
|
||||
}
|
||||
archiveArtifacts artifacts: '*.tgz'
|
||||
}
|
||||
}
|
||||
stage('Clean up deliverable') {
|
||||
steps {
|
||||
sh 'rm -rf /tmp/url-shortener'
|
||||
sh 'rm -rf *.tgz'
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
success {
|
||||
@@ -57,5 +79,8 @@ pipeline {
|
||||
failure {
|
||||
mattermostSend channel: 'git-messages', color: 'danger', message: "[${JOB_NAME}](${JOB_URL}) [#${BUILD_NUMBER}](${BUILD_URL}) ([Gitea](${GIT_URL}))", text: "Build Failed"
|
||||
}
|
||||
always {
|
||||
cleanWs deleteDirs: true, patterns: [[pattern: '*', type: 'INCLUDE']]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# simple url shortener
|
||||
|
||||
this project is a simple solution to build out a URL shortener using
|
||||
Roda, Falcon, Sequel, and SQLite
|
||||
Roda, Puma, Sequel, and SQLite on a FreeBSD Jail
|
||||
|
||||
the point of this project is to quickly build something and work on continuous deployment while making small refinements to the functional pieces.
|
||||
|
||||
the outside pieces of software that this project relies on are sqlite3 and pkgconf.
|
||||
the outside pieces of software that this project relies on are rbenv, ruby-build, sqlite3, and pkgconf.
|
||||
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ first you have to install the dependencies:
|
||||
`bundle install`
|
||||
|
||||
|
||||
if you want the development group included run this first:
|
||||
if you want to skip the test dependencies:
|
||||
|
||||
`bundle config set --local with 'development'`
|
||||
`bundle config set --local without 'test'`
|
||||
|
||||
|
||||
then create a .env.rb file in the root directory that contains the following ENV attributes:
|
||||
@@ -24,15 +24,19 @@ then create a .env.rb file in the root directory that contains the following ENV
|
||||
```
|
||||
ENV["APP_SESSION_SECRET"] = {output of a random 64 byte secret}
|
||||
|
||||
ENV["DB_NAME"] = {db file name}
|
||||
ENV["DB_NAME"] = {DB_NAME}
|
||||
```
|
||||
|
||||
|
||||
after the dependencies are installed, you have to create the db
|
||||
after the dependencies are installed, you have to create the db and schema
|
||||
|
||||
`sequel -m db/migrations sqlite://db/{DB_NAME}`
|
||||
|
||||
|
||||
to start the application with Falcon:
|
||||
to start the application with Puma:
|
||||
|
||||
`rackup -o {ip address} -p {port} -s falcon`
|
||||
`rackup -o {ip address} -p {port}`
|
||||
|
||||
to run it as a daemon:
|
||||
|
||||
`rackup -o {ip address} -p {port} -D`
|
||||
|
||||
Reference in New Issue
Block a user