Skip to content
Snippets Groups Projects
Commit 788107af authored by AndrewCz's avatar AndrewCz
Browse files

Completely untested rake task modifications

parent 6cc5d5a7
No related branches found
No related tags found
1 merge request!120Allow portal to clone the env to disk
Pipeline #294168442 passed
DB_HOST=127.0.0.1
DB_NAME=skeleton
DB_USER=user
DB_PASS=password
EMAIL_HOST=localhost:3000
MG_API_KEY=skeleton
MG_DOMAIN=skeleton
\ No newline at end of file
export DB_HOST=127.0.0.1
export DB_NAME=skeleton
export DB_USER=user
export DB_PASS=password
export EMAIL_HOST=localhost:3000
export MG_API_KEY=skeleton
export MG_DOMAIN=skeleton
default: &default
service: Disk
root: <%= Rails.root.join("storage") %>
tmp: <%= Rails.root.join("tmp") %>
development:
service: Disk
root: <%= Rails.root.join("storage") %>
tmp: <%= Rails.root.join("tmp") %>
local:
service: Disk
root: <%= Rails.root.join("storage") %>
tmp: <%= Rails.root.join("tmp") %>
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
# amazon:
......
# Manjaro
```
$ pamac install rvm docker docker-compose mariadb
$ systemctl -aG $USER docker
$ systemctl enable docker
$ systemctl reboot
$ source /usr/share/rvm/scripts/rvm
$ rvm install 2.7.0
$ bundle install
$ yarn install
$ source .env.development
$ docker-compose up -d --build
$ docker-compose down website
$ ./bin/webpack-server-dev
$ bundle exec rails s
```
# TODO
- Sample keys
- Fixed sign-up emails
namespace :ansible_environment do
desc "Checks to see if the dirs exist"
task :clone_env => :environment do
setup_dirs
unless setup_dirs
Rails.logger.error "Could Not Set up dirs appropriately"
fail "Could Not Set up dirs appropriately"
end
end
def setup_dirs
......@@ -22,10 +25,9 @@ namespace :ansible_environment do
# Test for git
unless system('which git')
Rails.logger.error "Could not find 'git' executable in $PATH".
return
return False
end
# Clone the master branch
# TODO: Environment is a controlled git repo. We'll need a read-only user to access it
# This means that we'll have to create an ourcomposebot_ro user and store creds
# and all that good stuff. We'll also be linked to the gitlab repo for the time
......@@ -39,7 +41,21 @@ namespace :ansible_environment do
# branches (including their existance) to be private. Either that, or just a
# separate repo with the environment. That's what this comment seems to be pointing
# to: https://forum.gitlab.com/t/private-branch-public-repo/3136
#system('git clone ')
unless ENV['OURCOMPOSEBOT_RO_KEY'].blank?
#
# Clone the private repo with the RO bot user's creds
#
# Make the app-specific ssh keys dir
Dir.mkdir Rails.application.config.storage.tmp + '/.ssh'
File.open("#{Rails.application.config.storage.tmp}/.ssh/id_rsa", 'w+') do |f|
f.write(ENV['OURCOMPOSEBOT_RO_KEY'])
end
git_ssh_cmd = "GIT_SSH_COMMAND='ssh -i #{Rails.application.config.storage.tmp}/.ssh/id_rsa'"
system("#{git_ssh_cmd} git clone https://gitlab.com/compositionalenterprises/environment.git #{Rails.application.config.storage.root}/ansible/environment")
else
# Clone the master branch of the template repo
system("git clone https://gitlab.com/compositionalenterprises/template-environment.git #{Rails.application.config.storage.root}/ansible/environment")
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment