/babylon-gatsby

Homepage for Babylon Metropolis Verlag

Primary LanguageHTMLMIT LicenseMIT

Babylon Metropolis Verlag Homepage

The Babylon Metropolis homepage is a static site that is generated by the Gatsby and with Strapi as CMS.

The code is open (MIT) so the one can inspect it and maybe get inspired how to build a site with Gatsby and Strapi. For Stapi checkout the git repository babylon-strapi.

Instalation

Clone the repository and install.

Install Gatsby

git clone https://github.com/gitmathub/babylon-gatsby.git
npm install

Install Strapi

Check the most recent Strapi documentation > Guides > Deployment.

Make sure you're running a node version >= 10.

$ node -v
v10.8.0

Clone and install

git clone https://github.com/gitmathub/babylon-strapi.git
cd babylon-strapi/
npm install

Check and adjust your server settings ./config/environments/production/server.json.

$ egrep 'host|port' config/environments/production/server.json
"host": "babylon-metropolis.de",
"port": 61337,

Build the admin panel.

NODE_ENV=production npm run build

Run the server.

NODE_ENV=production npm start

You should get this on the console:

To manage your project 🚀, go to the administration panel at:
http://babylon-metropolis.com:61337/admin

To access the server ⚡️, go to:
http://babylon-metropolis.com:61337

Check if the API works

$ nc babylon-metropolis.com 61337
GET /categories

HTTP/1.1 403 Forbidden

Hoster specific configuration

This section is very specific. It contains notes for my provider uberspace.de

Nodeversion

https://wiki.uberspace.de/development:nodejs#versionen

Service Monitor and Manager

https://wiki.uberspace.de/development:nodejs#einrichtung_als_dienst

uberspace-setup-service babylon-strapi npm start

check logs and ports

tail -f ~/service/babylon-strapi/log/main/current

patch start script

export NODE_ENV=production
cd $HOME/projects/babylon-strapi
exec node $HOME/projects/babylon-strapi/node_modules/.bin/strapi start 2>&1

service starting an stopping

# To start the service (hint: u = up):
svc -u ~/service/babylon-strapi
# To stop the service (hint: d = down):
svc -d ~/service/babylon-strapi
# To reload the service (hint: h = HUP):
svc -h ~/service/babylon-strapi
# To restart the service (hint: du = down, up):
svc -du ~/service/babylon-strapi

firewall ports

check on which ports services are running for user belab

 netstat -tulpe | grep belab

check which of your services are running

uberspace-list-ports --listen

check which ports of your firewall are open

uberspace-list-ports --open

open a port if needed

uberspace-add-port --protocol tcp --firewal

Development

http://localhost:8000

http://localhost:8000/___graphql

Browser Testing

Test in different browsers on Windows: https://www.browserling.com

Strapi Docs

Build & Deployment

Prefix Path

https://www.gatsbyjs.org/docs/recipes/deploying-your-site

Test deploy under the path prefix: /next

module.exports = {
  pathPrefix: `/next`,
}
npm run build -- --prefix-paths

test

npm run serve -- --prefix-paths

http://localhost:9000/next

Check speed

compression via .htaccess (don't compress html for gatsby)

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript text/javascript application/json

Maintenaince

Database dump

cd babylon-strapi/data
sqlite3 sqlite.db .dump > 20191226-02-strapi-babylon-dump.sql

Todos

Must have

  • Footer navigation
  • Page with all items (Verlagsprogramm)
  • Authors page
  • SSL certificate
  • CMS installation
    • strapi installation
    • pm2 installation
    • data import
    • webhooks
  • Deployment automation
  • Enable SSL after intallation

Good to have

  • Web app manifest gatsby-plugin-manifest
  • Meta tags
  • Adjust link on Wikipedia

Goodies