config.push.define "ftp" do |push|
# Login Credentials
push.host = "104.131.46.134"
push.username = "root"
push.password = "password"
# FTP vs SFTP
push.secure = "true"
# Where to copy the files on the server
push.destination = "/var/www/html"
# Where are App is
push.dir = "public"
end
I have above code above. I understand push.destination = "/var/www/html" points to actually directory on the remote server. How do you specify source directory on guest machine? My Wordpress Theme is hosted on /usr/usrname/public_html/wp_content.
Should I put
push.dir = "/usr/usrname/public_html/wp_content"
and it would work?
Yes, per doc
dir - The base directory containing the files to upload. By default this is the same directory as the Vagrantfile, but you can specify this if you have a src folder or bin folder or some other folder you want to upload.
so if the host files that you want to push are on /usr/usrname/public_html/wp_content you will have
push.dir = "/usr/usrname/public_html/wp_content"
Related
I'm running an Nginx server on a Vagrant Homestead box and I would like to add this piece of code to the server part of the Nginx config file for my site (in '/etc/ngnix/sites-available'):
location /storage/ {
add_header "Access-Control-Allow-Origin" "*";
}
I can type it in manually, but then it's gone every time I run vagrant provision.
What would be the best way to add this code during or after the provisioning?
Update 1
I found this article: https://medium.com/#maxxscho/laravel-homestead-with-custom-nginx-configurations-2e0fda4ba7dc
which brings me a step closer but now I have to figure out a way to place the custom serve-###.sh file outside the vendor folder. If anyone has thoughts on this, they are welcome as well!
Update 2
After fiddling some more I came up with a fairly decent solution:
Copy the vendor/laravel/homestead/scripts/serve-laravel.sh to a folder outside the vendor folder (e.g. ./scripts).
Edit the file to your needs.
Place some additional code in the Vagrant file to copy the script to the vendor folder before provisioning.
Add this to the Vegrantfile:
....
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.trigger.before :provision do |trigger|
trigger.info = "Copy custom scripts to vendor folder"
trigger.run = {
inline: "cp -r /scripts/* vendor/laravel/homestead/scripts/"
}
end
....
Any other solutions are still welcome!
Hello I am currently building a site using Rails and Heroku as well as GoDaddy for a custom domain name.
I am using Carrierwave with Fog, Amazon S3, and have set up a cloudfront with my Heroku domain name as the Origin Domain. Currently, the site loads up images very slow which is why I set up a cloudfront, but my carrierwave's config file doesn't seem to change the urls to the cloudfront counterparts. Here is my carrierwave config file. I would like users to be able to upload images through Carrierwave and then have those served back with my cloudfront.
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws' # required
config.fog_credentials = {
provider: 'AWS', # required
aws_access_key_id: 'acesskey', # required
aws_secret_access_key: 'secretkey', # required
region: 'us-east-1', # optional, defaults to 'us-east-1'
}
config.fog_directory = 'directory' # required
# config.fog_public = false # optional, defaults to true
config.asset_host = 'randomjunk.cloudfront.net'
config.fog_public = false
config.fog_attributes = { 'Cache-Control' => "max-age=#{365.day.to_i}" } # optional, defaults to {}
end
It works as long as config.fog_public is false but when I change it to config.fog_public = true the urls are now correct but the images are not found. Is this something to do with my configuration settings or have I set up my cloudfront with Heroku incorrectly?
It depends on the settings that were used when you created the files initially. If they were created with config.fog_public = false they will be private files and access will be done with a special signed url to s3. I think the asset host is just used for files that are public (hence what you are seeing). If you upload files with fog_public = true then I don't think you would see the not found. You may also be able to just set it to true and re-save images to change that attribute (I'm less sure about specifics here, you certainly should be able to change them to public though).
Recently I started taking an interest in Salt and begun doing a tutorial on it.I am currently working on a Mac and I having a hard time trying to start the vm[the minion] from my laptop[I am using Vagrant as an application to start the process]
The vagrant file for the vm contains these lines:
# salt-vagrant config
config.vm.provision :salt do |salt|
salt.run_highstate = true
salt.minion_config = "/etc/salt/minion"
salt.minion_key = "./minion1.pem"
salt.minion_pub = "./minion1.pub"
end
even though I wrote this it gets stuck at:
Calling state.highstate... (this may take a while)
Any ideas why?
One more thing.I seem to need to modify the top.sls file at the next step which is located in /srv/salt.Unfortunately I can not find the /srv file anywhere,why is that?is there a way to tell the master that the top file is somewhere else?
If you don't have a top.sls created, then you won't be able to run a hightstate like you have configured with the salt.run_highstate = true line.
If you don't have a /srv/salt/ directory created, then you can just create it yourself. Just make sure the user the salt-master is running as can read it.
The /srv/salt/ directory is the default location of what is known as the file_root. You can modify its location in the master config file /etc/salt/master and modify the file_roots config option.
Hey guys I'm trying to change in httpd.conf using ruby code 1.8.5 could you help me with it please
Apache configuration file The Apache configuration file must be configured specifically
for the server you have installed it on, i.e. the ServerName configuration item must be set to the IP address of the VM, not to 127.0.0.1 or any other generic address. TheServerAdmin configuration item must be set to cit470-sp2014-teamYOUR_TEAM_NUMBER#gmail.com. Create a gmail account with that name if you
have not done so already.
SSL All content must also be accessible using encrypted https versions of your URLs.
User directories Configure the server so that individual users can create their own web
sites by putting files in the public_html subdirectory of their home directory. These files should be available by both URLs of the form http://your_ip/~username and of the form http://your_ip/users/username. This may require that you create rewrite rules with mod_rewrite.
]# ./apconfigure.rb
./apconfigure.rb:8: warning: parenthesize argument(s) for future version
./apconfigure.rb:18: syntax error
.gsub(/ServerAdmin (.+)/, "ServerAdmin cit470su2015team2#gmail.com")
^
./apconfigure.rb:19: syntax error
.gsub(/UserDir disable/, "UserDir public_html")
^
./apconfigure.rb:20: syntax error
.gsub(userdir_regex, replacement) + "\nServerName 10.2.7.84 \nRewriteEngine on\nRewriteRule ^/users/(.*)$ /~$1 [PT]"
^
this is my code
#!/usr/bin/ruby
# This script edits the Apache configuration files and enables UserDir,
# as well as a custom RewriteRule
# path to apache config file
config_file = "/etc/httpd/conf/httpd.conf"
file = File.read(config _file)
# regex to uncomment the sample UserDir directives
userdir_regex = /#<Directory \/home\/\*\/public_html>.+?<\/Directory>/m
replacement = file.match(userdir_regex).to_s.gsub('#','')
# make some substitutions: change ServerName and ServerAdmin, enable UserDir,
# add rewrite rules.
edited_file =
file
.gsub(/ServerAdmin (.+)/, "ServerAdmin cit470su2015team2#gmail.com")
.gsub(/UserDir disable/, "UserDir public_html")
.gsub(userdir_regex, replacement) + "\nServerName 10.2.7.84 \nRewriteEngine on\nRewriteRule ^/users/(.*)$ /~$1 [PT]"
# write the changes to the file
File.open(config_file, 'w') do |f|
f.puts edited_file
end
I'd like to seperate my custom theme folder from the default MoinMoin htdocs folder. Here is my directory structure of my current installation:
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/...
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/index.html
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/classic
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/modern
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/mytheme
/path/to/python2.7/lib/site-packages/MoinMoin/web/static/htdocs/mytheme/style.css
And my custom Git-versioned wiki/data directory:
/path/to/git-repo/wikiconfig.py
/path/to/git-repo/wikiserver.py
/path/to/git-repo/wiki/data/...
/path/to/git-repo/wiki/data/plugin/theme/mytheme.py
/path/to/git-repo/wiki/underlay/...
The wikiconfig.py contains the following configuration:
class LocalConfig(multiconfig.DefaultConfig):
wikiconfig_dir = os.path.abspath(os.path.dirname(__file__))
instance_dir = os.path.join(wikiconfig_dir, 'wiki')
data_dir = os.path.join(instance_dir, 'data', '') # path with trailing /
data_underlay_dir = os.path.join(instance_dir, 'underlay', '') # path with trailing /
DesktopEdition = True # give all local users full powers
acl_rights_default = u"All:read,write,delete,revert,admin"
surge_action_limits = None # no surge protection
sitename = u'Foo'
logo_string = u'<span><img src="...">Bar</span>' % url_prefix_static
page_front_page = u'StartPage'
theme_default = 'mytheme'
I would like to move the theme's static files to the /path/to/git-repo folder, because this directory is a Git repository which should contain all custom modifications, and also the theme's static files.
Any ideas how this could be done?
Regards
I suggest you just leave the builtin static stuff where it is.
What you can do for custom and separate theme development is to serve your static stuff at some specific URL and catch that URL in the web server before it gets given to moin.wsgi (and ends up being served by MoinMoin's builtin static file server), something like:
Alias /moin_static196/mytheme /path/to/git-repo/static
WSGIScriptAlias / /..../moin.wsgi
/moin_static196 is the url path moin 1.9.6 uses by default, you can modify it in wikiconfig.py to use anything you like.
You would put the theme python code also into your git repo and just symlink it from the instances data/plugin/theme/ directory.