Add staging and init scripts for DB

This commit is contained in:
Ari Timonen 2020-04-03 01:52:58 +03:00
parent c273a30047
commit b24d2e987d
4 changed files with 178 additions and 2 deletions

31
.env.staging Normal file
View file

@ -0,0 +1,31 @@
# This file is actually loaded by Dotenv when RAILS_ENV=development
RACK_ENV=development
RAILS_ENV=development
APP_SECRET=fe837ea72667ec3d8ecb94cfba1a1bba
DEPLOY_PATH=/var/www
FILES_PATH=/var/www/public/files
PUMA_WORKERS=0
PUMA_MIN_THREADS=1
PUMA_MAX_THREADS=16
PUMA_PORT=4000
# Set this to higher to enable debugging
PUMA_TIMEOUT=30
MYSQL_HOST=db
MYSQL_DATABASE=ensl_staging
MYSQL_USERNAME=ensl
MYSQL_PASSWORD=ensl
MYSQL_ROOT_PASSWORD=ensl
MYSQL_CONNECTION_POOL=32
NEW_RELIC_APP_NAME=ENSL
NEW_RELIC_LICENSE_KEY=
GOOGLE_API_KEY=
GOOGLE_CALENDAR_ID=
GOOGLE_CALENDAR=enabled

3
.gitignore vendored
View file

@ -21,9 +21,8 @@ db_data/*
db/data/
!db/data/.placeholder
db/initdb.d/*
!db/initdb.d/*setup.sql
!db/initdb.d/.placeholder
*.sql*
!db/initdb.d/*setup*.sql
# ignore dkim keys
dkim

View file

@ -0,0 +1,6 @@
-- FIXME: this should be somewhere else probably
CREATE DATABASE ensl_test;
GRANT ALL PRIVILEGES ON ensl_test.* TO 'ensl'@'%' WITH GRANT OPTION;
CREATE DATABASE ensl_staging;
GRANT ALL PRIVILEGES ON ensl_staging.* TO 'ensl'@'%' WITH GRANT OPTION;

View file

@ -0,0 +1,140 @@
update `articles` set `text` = replace(`text` ,'É','É');
update `articles` set `text` = replace(`text` ,'“','"');
update `articles` set `text` = replace(`text` ,'â€','"');
update `articles` set `text` = replace(`text` ,'Ç','Ç');
update `articles` set `text` = replace(`text` ,'Ã','Ã');
update `articles` set `text` = replace(`text` ,'Ã','À');
update `articles` set `text` = replace(`text` ,'ú','ú');
update `articles` set `text` = replace(`text` ,'•','-');
update `articles` set `text` = replace(`text` ,'Ø','Ø');
update `articles` set `text` = replace(`text` ,'õ','õ');
update `articles` set `text` = replace(`text` ,'í','í');
update `articles` set `text` = replace(`text` ,'â','â');
update `articles` set `text` = replace(`text` ,'ã','ã');
update `articles` set `text` = replace(`text` ,'ê','ê');
update `articles` set `text` = replace(`text` ,'á','á');
update `articles` set `text` = replace(`text` ,'é','é');
update `articles` set `text` = replace(`text` ,'ó','ó');
update `articles` set `text` = replace(`text` ,'–','');
update `articles` set `text` = replace(`text` ,'ç','ç');
update `articles` set `text` = replace(`text` ,'ª','ª');
update `articles` set `text` = replace(`text` ,'º','º');
update `articles` set `text` = replace(`text` ,'Ã ','à');
update `articles` set `text` = replace(`text` ,'ç','ç');
update `articles` set `text` = replace(`text` ,'ã','ã');
update `articles` set `text` = replace(`text` ,'á','á');
update `articles` set `text` = replace(`text` ,'â','â');
update `articles` set `text` = replace(`text` ,'é','é');
update `articles` set `text` = replace(`text` ,'í','í');
update `articles` set `text` = replace(`text` ,'õ','õ');
update `articles` set `text` = replace(`text` ,'ú','ú');
update `articles` set `text` = replace(`text` ,'ç','ç');
update `articles` set `text` = replace(`text` ,'Á','Á');
update `articles` set `text` = replace(`text` ,'Â','Â');
update `articles` set `text` = replace(`text` ,'É','É');
update `articles` set `text` = replace(`text` ,'Í','Í');
update `articles` set `text` = replace(`text` ,'Õ','Õ');
update `articles` set `text` = replace(`text` ,'Ú','Ú');
update `articles` set `text` = replace(`text` ,'Ç','Ç');
update `articles` set `text` = replace(`text` ,'Ã','Ã');
update `articles` set `text` = replace(`text` ,'À','À');
update `articles` set `text` = replace(`text` ,'Ê','Ê');
update `articles` set `text` = replace(`text` ,'Ó','Ó');
update `articles` set `text` = replace(`text` ,'Ô','Ô');
update `articles` set `text` = replace(`text` ,'Ü','Ü');
update `articles` set `text` = replace(`text` ,'ã','ã');
update `articles` set `text` = replace(`text` ,'à','à');
update `articles` set `text` = replace(`text` ,'ê','ê');
update `articles` set `text` = replace(`text` ,'ó','ó');
update `articles` set `text` = replace(`text` ,'ô','ô');
update `articles` set `text` = replace(`text` ,'ü','ü');
update `articles` set `text` = replace(`text` ,'&','&');
update `articles` set `text` = replace(`text` ,'>','>');
update `articles` set `text` = replace(`text` ,'&lt;','<');
update `articles` set `text` = replace(`text` ,'&circ;','ˆ');
update `articles` set `text` = replace(`text` ,'&tilde;','˜');
update `articles` set `text` = replace(`text` ,'&uml;','¨');
update `articles` set `text` = replace(`text` ,'&cute;','´');
update `articles` set `text` = replace(`text` ,'&cedil;','¸');
update `articles` set `text` = replace(`text` ,'&quot;','"');
update `articles` set `text` = replace(`text` ,'&ldquo;','');
update `articles` set `text` = replace(`text` ,'&rdquo;','');
update `articles` set `text` = replace(`text` ,'&lsquo;','');
update `articles` set `text` = replace(`text` ,'&rsquo;','');
update `articles` set `text` = replace(`text` ,'&lsaquo;','');
update `articles` set `text` = replace(`text` ,'&rsaquo;','');
update `articles` set `text` = replace(`text` ,'&laquo;','«');
update `articles` set `text` = replace(`text` ,'&raquo;','»');
update `articles` set `text` = replace(`text` ,'&ordm;','º');
update `articles` set `text` = replace(`text` ,'&ordf;','ª');
update `articles` set `text` = replace(`text` ,'&ndash;','');
update `articles` set `text` = replace(`text` ,'&mdash;','');
update `articles` set `text` = replace(`text` ,'&macr;','¯');
update `articles` set `text` = replace(`text` ,'&hellip;','');
update `articles` set `text` = replace(`text` ,'&brvbar;','¦');
update `articles` set `text` = replace(`text` ,'&bull;','');
update `articles` set `text` = replace(`text` ,'&para;','');
update `articles` set `text` = replace(`text` ,'&sect;','§');
update `articles` set `text` = replace(`text` ,'&sup1;','¹');
update `articles` set `text` = replace(`text` ,'&sup2;','²');
update `articles` set `text` = replace(`text` ,'&sup3;','³');
update `articles` set `text` = replace(`text` ,'&frac12;','½');
update `articles` set `text` = replace(`text` ,'&frac14;','¼');
update `articles` set `text` = replace(`text` ,'&frac34;','¾');
update `articles` set `text` = replace(`text` ,'&#8539;','');
update `articles` set `text` = replace(`text` ,'&#8540;','');
update `articles` set `text` = replace(`text` ,'&#8541;','');
update `articles` set `text` = replace(`text` ,'&#8542;','');
update `articles` set `text` = replace(`text` ,'&gt;','>');
update `articles` set `text` = replace(`text` ,'&lt;','<');
update `articles` set `text` = replace(`text` ,'&plusmn;','±');
update `articles` set `text` = replace(`text` ,'&minus;','');
update `articles` set `text` = replace(`text` ,'&times;','×');
update `articles` set `text` = replace(`text` ,'&divide;','÷');
update `articles` set `text` = replace(`text` ,'&lowast;','');
update `articles` set `text` = replace(`text` ,'&frasl;','');
update `articles` set `text` = replace(`text` ,'&permil;','');
update `articles` set `text` = replace(`text` ,'&int;','');
update `articles` set `text` = replace(`text` ,'&sum;','');
update `articles` set `text` = replace(`text` ,'&prod;','');
update `articles` set `text` = replace(`text` ,'&radic;','');
update `articles` set `text` = replace(`text` ,'&infin;','');
update `articles` set `text` = replace(`text` ,'&asymp;','');
update `articles` set `text` = replace(`text` ,'&cong;','');
update `articles` set `text` = replace(`text` ,'&prop;','');
update `articles` set `text` = replace(`text` ,'&equiv;','');
update `articles` set `text` = replace(`text` ,'&ne;','');
update `articles` set `text` = replace(`text` ,'&le;','');
update `articles` set `text` = replace(`text` ,'&ge;','');
update `articles` set `text` = replace(`text` ,'&there4;','');
update `articles` set `text` = replace(`text` ,'&sdot;','');
update `articles` set `text` = replace(`text` ,'&middot;','·');
update `articles` set `text` = replace(`text` ,'&part;','');
update `articles` set `text` = replace(`text` ,'&image;','');
update `articles` set `text` = replace(`text` ,'&real;','');
update `articles` set `text` = replace(`text` ,'&prime;','');
update `articles` set `text` = replace(`text` ,'&Prime;','');
update `articles` set `text` = replace(`text` ,'&deg;','°');
update `articles` set `text` = replace(`text` ,'&ang;','');
update `articles` set `text` = replace(`text` ,'&perp;','');
update `articles` set `text` = replace(`text` ,'&nabla;','');
update `articles` set `text` = replace(`text` ,'&oplus;','');
update `articles` set `text` = replace(`text` ,'&otimes;','');
update `articles` set `text` = replace(`text` ,'&alefsym;','');
update `articles` set `text` = replace(`text` ,'&oslash;','ø');
update `articles` set `text` = replace(`text` ,'&Oslash;','Ø');
update `articles` set `text` = replace(`text` ,'&isin;','');
update `articles` set `text` = replace(`text` ,'&notin;','');
update `articles` set `text` = replace(`text` ,'&cap;','');
update `articles` set `text` = replace(`text` ,'&cup;','');
update `articles` set `text` = replace(`text` ,'&sub;','');
update `articles` set `text` = replace(`text` ,'&sup;','');
update `articles` set `text` = replace(`text` ,'&sube;','');
update `articles` set `text` = replace(`text` ,'&supe;','');
update `articles` set `text` = replace(`text` ,'&exist;','');
update `articles` set `text` = replace(`text` ,'&forall;','');
update `articles` set `text` = replace(`text` ,'&empty;','');
update `articles` set `text` = replace(`text` ,'&not;','¬');
update `articles` set `text` = replace(`text` ,'&and;','');
update `articles` set `text` = replace(`text` ,'&or;','');
update `articles` set `text` = replace(`text` ,'&crarr;','');