Openstad
  • Introductie
  • Projectmanagement
    • Algemene kaders
    • Participatieprocessen
      • Voorkeurspeiling
      • Wedstrijd
      • Participatief begroten
  • Digitale tools
    • OpenStad CMS basis
      • Inloggen
      • De bouwstenen
      • Live in-page editing
      • Bewerkmodus (Draft)
      • Versiebeheer
    • Participatieprocessen
      • Voorkeurspeiling
      • Wedstrijd
      • Participatief begroten
    • How-to's
      • Nieuwe site aanmaken
      • Nieuwe pagina's toevoegen
      • Pagina's vullen
      • Inzendingen uploaden
      • Inzendingen weergeven
      • Filteren en categoriseren van inzendingen
      • Likes verzamelen
      • Reacties en argumenten
      • Interactieve kaart
      • Polygonen
      • Newsletter
      • Moderatie
      • Unieke stemcodes
      • Stemmen
      • Gebruikersbeheer
      • Gebruikers anonimiseren per website
      • Inzendingen exporteren en importeren
      • Vormgeving & logo aanpassen
      • E-mail notificaties
    • Widgets referentie
      • Accordeon
      • Agenda
      • Arguments
      • Columns
      • Slider
      • Counter
      • Date countdown bar
      • Ideas map
      • Ideeën op een kaart (Kaart applicatie)
      • iFrame
      • Image
      • Info bar
      • Link or button
      • List
      • Like
      • Location
      • Participatory budgeting
      • Keuzewijzer
      • Keuzewijzer resultaten
      • Rich text
      • Resource admin buttons
      • Resource overview
      • Resource form
      • Resource representation
      • Resource raw widget
      • Resource image
      • Speech bubble
      • Share widgets
      • Title
      • User remove form
      • Video upload
      • Video 3d party
      • Vorige volgende knoppen
    • Algemeen
      • Terminologie
      • Waarschuwingen
      • Adminpanel
      • Adminpanel (beta)/React admin
      • Page Settings
      • OpenStad hoofdmenu
        • Tags
        • Global
        • Open palette
        • Clear cache
        • Pages
        • Users
        • Images
        • Files
        • Workflow
        • Logout
      • Styles for the container
      • Interactieve kaart thema iconen
      • Inzendingen (ideas)
      • Artikelen (articles)
      • Gebruikers (users)
      • Authenticatie methodes
      • Rollen
      • URL's
      • Testen
      • Raw
      • Resources
  • Technical documentation (English)
    • Architecture
    • Getting started
    • Deploying to production
      • Kubernetes
      • Installing on Digital ocean with Kubernetes
      • Backups
      • Deploying a custom image
    • Frontend: CMS
      • Apostrophe CMS
      • The Openstad version of ApostropheCMS
      • Using openstad-components
      • Configuration
    • Frontend: Components
      • Use and configuration
      • Publishing
      • Components
        • Choices Guide
        • Ideas On Map
    • Api
      • Site
      • Idea
      • Argument
      • Vote
      • Article
      • Newsletter Signup
      • User
      • Auth
      • Resource & Data permissions
      • Pagination and search
      • Email settings
      • Database migrations
      • API configuration
    • oAuth2
      • Oauth2 configuration
    • Management panel
      • Management Panel configuration
    • Image server
    • Contributing & versioning
    • Git flow
    • Roadmap
Powered by GitBook
On this page
  • 1. Checkout openstad-app git repo
  • 2. Create MySQL databases
  • 3. Create an .env file
  • 4. Run setup
  • 5. Run the servers
  • What to expect
  • 6. Setup a reverse proxy
  • Notes
  1. Technical documentation (English)

Getting started

PreviousArchitectureNextDeploying to production

Last updated 1 year ago

These instructions are meant for running the openstad servers locally.

The are 5 different node servers working together. To make it easier to get started quickly and not manually configure every server, we made an overlaying git that bundles the 5 servers and added a few node scripts to install and run them with just a few commands.

Prerequisites:

  • NodeJS 16

  • Access to a Mysql server

  • Also access to a MongoDB server

  • A local mongo installation (See )

  • make command

1. Checkout openstad-app git repo

We've bundled our 5 nodejs servers in one git repo openstad-app with git submodules.

git clone https://github.com/openstad/openstad-app

After checking out the repo, the git submodules need to be pulled separately, this is one way of doing that:

cd openstad-app
git submodule update --init --recursive

After this you will see 5 directories, each of which contains an autonomous node server. These servers can be run and managed separately, but it's easier to use the scripts provided in the root level.

2. Create MySQL databases

The setup script will initialize the databases, i.e. create the tables, but it does expect the MySQL database to exist. In SQL:

CREATE DATABASE `openstad-api`;
CREATE DATABASE `openstad-image-server`;
CREATE DATABASE `openstad-oauth-server`;

Do not forget to make these databases accessible by the user from the .env file:

CREATE USER `USERNAME`@`%` IDENTIFIED BY 'PASSWORD';
GRANT ALL ON `openstad-api`.* TO `USERNAME`@`%`;
GRANT ALL ON `openstad-image-server`.* TO `USERNAME`@`%`;
GRANT ALL ON `openstad-oauth-server`.* TO `USERNAME`@`%`;

3. Create an .env file

First create the .env before installing everything. There is an .env.example in the root openstad-app repo. Copy it and rename it to .env in the same folder.

  • Make sure the MySQL credentials are correct, using the username and password from the previous step

  • Change the AUTH_FIRST_CLIENT_LOGIN_CODE - this is a code that will be used later to login; choose any code you like.

  • Outgoing email is used for login on sites and feedback to users. It can be circumvented, but only if you know what you are doing

The rest of the defaults should suffice in most situations.

By default this will run the CMS at http://localhost:4444/ after the next steps.

A login token will be generated following the given value for AUTH_FIRST_CLIENT_LOGIN_CODE.

4. Run setup

First initialize the node modules:

npm install

Now the command

npm run setup

will create the necessary configuration, install npm modules and initialize the DB. It should be smart enough to be run again: existing databases will then not be overriden.

Note: if you see an arror like use this SQL command to fix this:

ALTER USER 'USERNAME'@'%' IDENTIFIED WITH mysql_native_password BY 'PASSWORD'

5. Run the servers

Use

npm run start

to start the servers.

What to expect

Five servers should now be running. You could try and use them with the description below, but preferably you now go to step 5.

By default the CMS is found at http://localhost:31401. It uses Basic Authentication with username openstad and password openstad. Login via http://localhost:31401/login with the login token set in the .env file as AUTH_FIRST_CLIENT_LOGIN_CODE. Note: this value was only used during the creation of the mysql tables. Changing it afterwards in .env will not change the login token.

The admin panel is found at http://localhost:31404. It is of limited use locally because it allows for copying sites and managing setting per site and it expects dynamic DNS settings. For a kubernetes cluster it also manages the Ingress host and SSL settings. If you want to run multiple local sites it's easiest to add a few urls that point to 127.0.0.1 in the etc/hosts file of your machine then it's possible to create them in the admin panel, be aware it's needed to at the port number: http://local.budgeting:31401

6. Setup a reverse proxy

To make the above a bit more usefull you may want to setup a reverse proxy server to make the sites and servers available.

If you the ran npm run setup command above a file nginx.config.example was created in de openstad-app directory. Use this to setup your local nginx server by copying this file to the sites-available directory. Create a link in sites-enabled, and restart nginx.

You will probably need an entry in your /etc/hosts file:

127.0.0.1 openstad-api.openstad.local openstad-oauth.openstad.local openstad-image.openstad.local openstad-cms.openstad.local .openstad-cms.openstad.local openstad-admin.openstad.local

Use the admin panel to create a new user and make that user administrator on the new site.

Notes

  1. The site you created in step 5 has a basic auth setup. The login information can be found in the admin panel, under settings/password protection

  2. This setup is of course not secure. Remove the FORCE_HTTP param from the .env file and run npm run setup again. Then setup your proxy server to use https instead of http. If you already created sites then update the url for those sites.

  3. It might be useful for debugging purposes to run the servers separately every now and then, in this case the values from app.js should be copied to the .env of the server you are trying to run (the root file in the .env uses different keys).

The admin server should now be available on hbase-domain . If you create a new site here it will by default be available on

if your server does not resolve the url correctly changes you make in the admin panel (like the just mentioned basic auth) may not be directly available. Restarting the servers will help, but using existing DNS names would be nicer.

https://github.com/openstad/openstad-management-panel/issues/84
ttp://openstad-admin.
http://name-of-site.openstad-cms.base-domain
http://name-of-site.openstad-cms.base-domain