rails new SampleDockerRails --database=postgresql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MillisecondsDateTime < ActiveRecord::Migration | |
def up | |
ActiveRecord::Base.connection.tables.each do |table| | |
ActiveRecord::Base.connection.columns(table).each do |column| | |
if column.type == :datetime | |
change_column table, column.name, :datetime, limit: 6 | |
add_index table, column.name | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# remove exited containers: | |
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v | |
# remove unused images: | |
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi | |
# remove unused volumes: | |
docker volume ls -f dangling=true | awk '{ print $2 }' | xargs docker volume rm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionMailer::Base.smtp_settings = { | |
address: 'premium47.web-hosting.com', | |
port: 465, | |
authentication: 'plain', | |
enable_starttls_auto: true, | |
user_name: '[email protected]', | |
password: '2chb3ne4n!' | |
} | |
ActionMailer::Base.mail( |
NOTE: We can now use an AMI for this. Once you enter the launch wizard make sure that "My AMIs" and "Shared with me" is selected and then search for the term "Rotati". Select the Rotati Staging AMI and continue with the wizard. This AMI will have everything you need to run the staging application (so no need to run though the process below if everything is working on the AMI already!)
- Launch the AWS instance in Singapore region (unless the client specially stated to launch in a different region). For Staging use t2.micro. For Production use t2.micro (and higher).
- Configure the settings as per the wizard. Ensure to enable termination protection. Most other settings can remain unchanged.
- Create a new security group for the server giving it a meaningful name (e.g. the name of the project). Open only the ports that are required which are generally HTTP, HTTPS and SSH.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html = '<a href="https://google.com"></a>' | |
fragment = Nokogiri::HTML::fragment(html) | |
fragment.css('a[href]').each do |link| | |
link.set_attribute('target', '_blank') | |
end | |
fragment.to_html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is to enable WS support. Credits: # https://gist.github.com/Bubelbub/0a942a0d51a3d329897d | |
# THIS WORKS! for running the example 5.0.0.beta1 chat app on a single instance Elastic beanstalk AWS instance | |
files: | |
"/etc/nginx/conf.d/elasticbeanstalk/00_webapp.conf" : | |
content: | | |
upstream backend { | |
server unix:///var/run/puma/my_app.sock; | |
} |
OlderNewer