techvalidate / portrait Goto Github PK
View Code? Open in Web Editor NEWWeb service that turns a web page into an image
License: MIT License
Web service that turns a web page into an image
License: MIT License
Right now you are required to install node, npm, puppeteer, and minimist globally.
We should either put this into the bin/setup script OR reconfigure to use the version installed by yarn.
ping yahoo.com
to see if network was established. If no response, you will need to configure network:nmtui
Update the system:
sudo yum -y update
sudo yum install -y curl-devel sqlite-devel libyaml-devel
sudo command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
sudo curl -L get.rvm.io | bash -s stable
source /home/imageserver/.rvm/scripts/rvm
rvm reload
rvm install 2.3.3
This takes time, as it compiles from source. Drink some coffee.
su
yum clean all && yum update
curl -L https://rpm.nodesource.com/setup_7.x | bash -
exit
sudo yum install nodejs -y
gem install bundler rails
gem install passenger
run passenger to ensure that install succeeded. If no errors, proceed
sudo chmod o+x "/home/imageserver"
rvmsudo passenger-install-nginx-module
/var
sudo mkdir www
sudo git clone https://github.com/techvalidate/portait.git
sudo vi /etc/rc.d/init.d/nginx
paste/create:
#!/bin/sh
. /etc/rc.d/init.d/functions
. /etc/sysconfig/network
[ "$NETWORKING" = "no" ] && exit 0
nginx="/opt/nginx/sbin/nginx"
prog=$(basename $nginx)
NGINX_CONF_FILE="/opt/nginx/conf/nginx.conf"
lockfile=/var/lock/subsys/nginx
start() {
[ -x $nginx ] || exit 5
[ -f $NGINX_CONF_FILE ] || exit 6
echo -n $"Starting $prog: "
daemon $nginx -c $NGINX_CONF_FILE
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog -QUIT
retval=$?
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
configtest || return $?
stop
start
}
reload() {
configtest || return $?
echo -n $”Reloading $prog: ”
killproc $nginx -HUP
RETVAL=$?
echo
}
force_reload() {
restart
}
configtest() {
$nginx -t -c $NGINX_CONF_FILE
}
rh_status() {
status $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart|configtest)
$1
;;
reload)
rh_status_q || exit 7
$1
;;
force-reload)
force_reload
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}"
exit 2
esac
sudo vi /opt/nginx/conf/nginx.conf
uncomment #user nobody;
and change to user imageserver;
Comment out the default location:
location / {
root html;
index index.html index.htm
}
to
#location / {
# root html;
# index index.html index.htm;
#}
Create a new location node:
location / {
root /var/www/portrait/public;
passenger_enabled on;
}
sudo /etc/init.d/nginx restart
To show nginx status: sudo /etc/init.d/nginx status
sudo yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver-1.2.2-6.1.el7.x86_64 libXrandr.x86_64 GConf2 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 -y
sudo yum install ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
**note: I had to install libXScrnSaver-1.2.2-6.1.el7.x86_64
twice on both installations I did. I am uncertain if this was because I fat-fingered the name both times or if something overwrote the libXss
library that's needed by Puppeteer each time. Something to keep in mind when testing Puppeteer. The nginx error log will show the error for libXss
. If it does, simply reinstall libXScrnSaver-1.2.2-6.1.el7.x86_64
Code needs to be changed in our node tasks, for now, on the Linux platform. See puppeteer/puppeteer#290. This may change in the future.
const browser = await puppeteer.launch({args: ['--no-sandbox', '--disable-setuid-sandbox']});
sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo
sudo yum install yarn -y
Proper permissions have to be on the files and dirs in the app directory
/var/www
sudo chown -R imageserver portfolio/
sudo chmod -R 750 portfolio/
sudo chmod g+s portfolio/
firewall-cmd
needs to be configured for port 80 access (see https://linuxconfig.org/how-to-open-http-port-80-on-redhat-7-linux-using-firewall-cmd):
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload
Since I wasn't sure how to get scripts in ./bin
to execute, I performed the following steps manually, instead of using ./bin/setup
:
First, copy config/database.yml.example
to config/database.yml
Migration files may need version
bundle install
rails db:migrate RAILS_ENV=production
yarn install
rails webpacker:install
rails restart
rails c production
u = User.create name: "name", password: "password", admin: true
u.valid?
u.save
I'm still getting notifications for this. Please remove my user ckizer from the Techvalidate repos.
Better security I think.
Cheers :-)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.