mirror of
https://github.com/astuto/astuto.git
synced 2025-12-15 03:07:52 +01:00
Make production environment work
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
ENVIRONMENT=development
|
||||
SECRET_KEY_BASE=secretkeybasehere
|
||||
|
||||
POSTGRES_USER=yourusernamehere
|
||||
POSTGRES_PASSWORD=yourpasswordhere
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
||||
// import { composeWithDevTools } from 'redux-devtools-extension';
|
||||
import thunkMiddleware from 'redux-thunk';
|
||||
|
||||
import rootReducer from '../reducers/rootReducer';
|
||||
|
||||
const composeEnhancers = composeWithDevTools({
|
||||
trace: true,
|
||||
});
|
||||
// const composeEnhancers = composeWithDevTools({
|
||||
// trace: true,
|
||||
// });
|
||||
|
||||
const createStoreHelper = () => (
|
||||
createStore(
|
||||
rootReducer,
|
||||
composeEnhancers(
|
||||
// composeEnhancers(
|
||||
applyMiddleware(thunkMiddleware)
|
||||
)
|
||||
// )
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@ default: &default
|
||||
host: db
|
||||
username: <%= ENV['POSTGRES_USER'] %>
|
||||
password: <%= ENV['POSTGRES_PASSWORD'] %>
|
||||
database: <%= ENV['POSTGRES_USER'] %>
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
database: app_development
|
||||
|
||||
# The specified database role being used to connect to postgres.
|
||||
# To create additional roles in postgres see `$ createuser --help`.
|
||||
# When left blank, postgres will use the default role. This is
|
||||
@@ -59,7 +58,7 @@ development:
|
||||
test:
|
||||
<<: *default
|
||||
database: app_test
|
||||
|
||||
|
||||
# As with config/credentials.yml, you never want to store sensitive information,
|
||||
# like your database password, in your source code. If your source code is
|
||||
# ever seen by anyone, they now have access to your database.
|
||||
@@ -81,4 +80,3 @@ test:
|
||||
#
|
||||
production:
|
||||
<<: *default
|
||||
database: app_production
|
||||
|
||||
@@ -20,7 +20,7 @@ Rails.application.configure do
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
||||
config.public_file_server.enabled = true
|
||||
|
||||
# Compress CSS using a preprocessor.
|
||||
# config.assets.css_compressor = :sass
|
||||
|
||||
16
config/secrets.yml
Normal file
16
config/secrets.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
# Be sure to restart your server when you change the secret.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# Make sure the secret is at least 30 characters and all random,
|
||||
# no regular words or you'll be exposed to dictionary attacks.
|
||||
|
||||
development:
|
||||
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
|
||||
|
||||
test:
|
||||
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
|
||||
|
||||
production:
|
||||
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
|
||||
@@ -12,6 +12,7 @@ services:
|
||||
environment:
|
||||
- UPDATE=0
|
||||
- ENVIRONMENT
|
||||
- SECRET_KEY_BASE
|
||||
- POSTGRES_USER
|
||||
- POSTGRES_PASSWORD
|
||||
- EMAIL_CONFIRMATION
|
||||
|
||||
@@ -18,7 +18,16 @@ rm -f /app/tmp/pids/server.pid
|
||||
if [ "$UPDATE" = 1 ]; then
|
||||
# Create database, load schema, run migrations and seed data in an idempotent way.
|
||||
echo "Preparing database..."
|
||||
rake db:prepare
|
||||
db_version=$(bundle exec rake db:version)
|
||||
echo "$db_version"
|
||||
if [ "$db_version" = "Current version: 0" ]; then
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
bundle exec rake db:migrate
|
||||
bundle exec rake db:seed
|
||||
else
|
||||
bundle exec rake db:migrate
|
||||
fi
|
||||
echo "Database prepared."
|
||||
|
||||
# Use webpack to build JS and CSS.
|
||||
@@ -37,11 +46,13 @@ fi
|
||||
|
||||
# Use case 3
|
||||
echo "Environment is: $ENVIRONMENT"
|
||||
export RAILS_ENV="$ENVIRONMENT"
|
||||
export NODE_ENV="$ENVIRONMENT"
|
||||
if [ $ENVIRONMENT == "development" ]; then
|
||||
# Launch Rails server and webpack-dev-server using Foreman
|
||||
foreman start -p 3000
|
||||
else # production
|
||||
# Compile assets with Webpack and then launch Rails server
|
||||
# Compile assets and launch server
|
||||
./bin/webpack
|
||||
rails server -e production
|
||||
fi
|
||||
Reference in New Issue
Block a user