{"id":13724296,"url":"https://github.com/OpenCarbonWatch/Website","last_synced_at":"2025-05-07T17:33:59.800Z","repository":{"id":41757438,"uuid":"219131028","full_name":"OpenCarbonWatch/Website","owner":"OpenCarbonWatch","description":"Source code (back-end and front-end) of our main website, which monitors greenhouse gases emissions reports by organizations","archived":false,"fork":false,"pushed_at":"2023-03-15T08:10:11.000Z","size":1620,"stargazers_count":10,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-29T19:57:34.776Z","etag":null,"topics":["carbon-emissions","database","laravel","opendata","vuejs"],"latest_commit_sha":null,"homepage":"https://opencarbonwatch.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpenCarbonWatch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-11-02T09:22:52.000Z","updated_at":"2024-02-10T00:45:56.000Z","dependencies_parsed_at":"2023-09-21T19:58:47.898Z","dependency_job_id":null,"html_url":"https://github.com/OpenCarbonWatch/Website","commit_stats":{"total_commits":139,"total_committers":1,"mean_commits":139.0,"dds":0.0,"last_synced_commit":"9149896ab4538ecab464773a6596e14e2dd02f46"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCarbonWatch%2FWebsite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCarbonWatch%2FWebsite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCarbonWatch%2FWebsite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenCarbonWatch%2FWebsite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenCarbonWatch","download_url":"https://codeload.github.com/OpenCarbonWatch/Website/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236684449,"owners_count":19188642,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["carbon-emissions","database","laravel","opendata","vuejs"],"created_at":"2024-08-03T01:01:53.927Z","updated_at":"2025-05-07T17:33:59.752Z","avatar_url":"https://github.com/OpenCarbonWatch.png","language":"PHP","funding_links":[],"categories":["Emissions"],"sub_categories":["Emission Observation and Modeling"],"readme":"# Website\n\nResources used to build our main website\n\n## Installation of the database server\n\n### Database\n\nWe use PostgreSQL on Ubuntu 18.04.\n\n```bash\nsudo su postgres\npsql -c \"CREATE USER ocw_user PASSWORD 'secret_password';\"\npsql -c \"CREATE DATABASE ocw OWNER ocw_user ENCODING 'UTF-8';\"\n```\n\n### Import data\n\n```bash\nsudo su postgres\npsql -d ocw -c \"TRUNCATE activities, cities, legal_types, assessment_organization, assessments, organizations;\"\npsql -d ocw -c \"DROP INDEX IF EXISTS idx_organizations_name;\"\npsql -d ocw -c \"COPY activities FROM '/home/data/activities.csv' CSV HEADER;\"\npsql -d ocw -c \"COPY cities FROM '/home/data/cities.csv' CSV HEADER;\"\npsql -d ocw -c \"COPY legal_types FROM '/home/data/legal_types.csv' CSV HEADER;\"\npsql -d ocw -c \"COPY assessments FROM '/home/data/assessments.csv' CSV HEADER;\"\npsql -d ocw -c \"COPY organizations FROM '/home/data/organizations.csv' CSV HEADER;\"\npsql -d ocw -c \"COPY assessment_organization FROM '/home/data/assessment_organization.csv' CSV HEADER;\"\npsql -d ocw -c \"CREATE INDEX idx_organizations_name ON organizations USING gin (name gin_trgm_ops);\"\n```\n\n## Installation of the application server\n\nWe install the application layer on an Ubuntu 22.04 server.\n\n### Packages\n\nStart by installing the underlying software packages, including PHP, Composer, Node.JS and Yarn.\n\n```bash\nsudo apt update\nsudo apt -y upgrade\nsudo apt install -y php8.1 php8.1-{cli,curl,fpm,common,pgsql,intl,xml,mbstring,zip,soap,gd,gmp}\nsudo apt -y install composer\nwget -qO- https://deb.nodesource.com/setup_16.x | sudo -E bash\nsudo apt-get install -y nodejs\ncurl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -\necho \"deb https://dl.yarnpkg.com/debian/ stable main\" | sudo tee /etc/apt/sources.list.d/yarn.list\nsudo apt update\nsudo apt install -y yarn\n```\n\n### Application\n\n```bash\nsudo git clone https://github.com/OpenCarbonWatch/Website.git /srv/ocw\ncd /srv/ocw\nsudo cp .env.example .env\nsudo composer install\nsudo php artisan key:generate\n```\n\nConfigure the `.env`file (mostly with the connection information towards the database).\n\nInstall the application\n\n```bash\nsudo php artisan migrate\nsudo yarn install\nsudo yarn run prod\nsudo chown -R www-data:www-data ocw\n```\n\n### Nginx\n\nUninstall Apache and install Nginx\n```bash\nsudo systemctl disable --now apache2\nsudo apt remove -y apache2\nsudo apt install -y nginx\nsudo systemctl start nginx\n```\n\nCreate a configuration file `/etc/nginx/sites-available/ocw` with the following content\n\n```\nserver {\n        if ($host = opencarbonwatch.org) {\n                return 301 https://$host$request_uri;\n        }\n        listen 80;\n        server_name opencarbonwatch.org;\n        return 301 https://$host$request_uri;\n}\n\nserver {\n    listen 443 ssl http2;\n    server_name opencarbonwatch.org;\n    client_max_body_size 100M;\n    gzip on;\n    gzip_types text/plain text/css application/javascript application/xml;\n    root /srv/ocw/public;\n    index index.php index.html index.htm index.nginx-debian.html;\n    location / {\n        try_files $uri $uri/ /index.php?$query_string;\n    }\n    # Cache header\n    location ~* \\.(?:css|js|svg|ico)$ {\n      expires 1y;\n      access_log off;\n      add_header Cache-Control \"public\";\n      add_header X-Robots-Tag \"noindex, nofollow, nosnippet, noarchive\";\n    }\n    location ~ \\.php$ {\n        try_files $uri =404;\n        fastcgi_split_path_info  ^(.+\\.php)(/.+)$;\n        fastcgi_index            index.php;\n        fastcgi_pass             unix:/var/run/php/php8.1-fpm.sock;\n        include                  fastcgi_params;\n        fastcgi_param   PATH_INFO       $fastcgi_path_info;\n        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;\n        fastcgi_param   PHP_VALUE \"memory_limit = 2G\";\n    }\n    access_log /var/log/nginx/ocw_access.log;\n}\n```\n\nThen run\n```bash\nsudo ln -s /etc/nginx/sites-available/ocw /etc/nginx/sites-enabled/\nsudo rm /etc/nginx/sites-enabled/default\nsudo systemctl restart nginx\nsudo apt -y install certbot python3-certbot-nginx\nsudo certbot\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenCarbonWatch%2FWebsite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOpenCarbonWatch%2FWebsite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenCarbonWatch%2FWebsite/lists"}