In order to test the tickets above you have to have the following services up and running locally.
- Content-Service
- Eagle Webapp
- Nginx serving the Boxtop-Front-End resources
git clone [email protected]:photobox/content-service.git
cd content-service
git checkout master
mvn clean install
docker build -t content-service ./target/
docker run --name content-service -dit -p 9085:9085 content-service
docker run -p 9095:9095 content-service
Install the FE resources
git clone [email protected]:photobox/smash-asset-service.git
cd smash-asset-service
git checkout master
npm i && npm start
npm start generates a folder called build in the project directory that is consisted of all the front-end resources
Make the resources available to the local HTTP server
mkdir /opt/photobox
ln -s [installation_path_of_smash_asset_service]/build/ /opt/photobox/assets
git clone [email protected]:photobox/aviary-eagle-web.git
cd aviary-eagle-web
git checkout master
mvn clean install
cd eagle-webapp
mvn ninja:run -Dninja.jvmArgs="-Dninja.external.configuration=env-configuration/localhost.conf"
The best way to do run the front-end locally is to use nginx to serve the static files.
This offers the additional benefit of nginx to proxy the requests to whatever web server
you might be running on the same machine. Make sure to read the nginx docs for more info.
Below is a sample configuraton of how this can be achieved. This assumes you have a web
server running on port 8080, and you have deployed the front-end files to
/opt/photobox/assets
server {
listen 80;
server_name localhost;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
# all requests to http://localhost/static will pick up files from the alias
location /static {
alias /opt/photobox/website/static/;
}
# used to fixed CORs issue with custom fonts
location /static/font {
add_header Access-Control-Allow-Origin "*";
alias /opt/photobox/website/static/;
}
#
location / {
proxy_pass http://127.0.0.1:8080;
}
}
Once nginx and the services above are configured properly, the webpage should be available at
http://localhost/home
user bence;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
disable_symlinks off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Server
##
server {
listen 80;
server_name "UB-UK02414.local";
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
location /static {
alias /opt/photobox/assets/;
}
location /static/font {
add_header Access-Control-Allow-Origin "*";
alias /opt/photobox/assets/font/;
}
client_max_body_size 1024m;
location / {
proxy_pass http://127.0.0.1:8080;
}
}
##
# Model Content Service
##
server {
listen 9085;
server_name "content.service";
location / {
proxy_pass http://content-service-development.api.photobox.com/;
}
}
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
# include /etc/nginx/sites-enabled/*;
}